[jboss-svn-commits] JBL Code SVN: r19663 - in labs/jbossrules/branches/temporal_rete/drools-compiler-window: src and 116 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Apr 21 05:22:50 EDT 2008


Author: mgroch
Date: 2008-04-21 05:22:48 -0400 (Mon, 21 Apr 2008)
New Revision: 19663

Added:
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/.classpath
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/.project
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/log/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/pom.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngine.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldList.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldValue.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertLogicalFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionRetractFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionSetField.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionUpdateField.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFactPattern.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFieldConstraint.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ConnectiveConstraint.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/DSLSentence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FactPattern.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FieldConstraint.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IAction.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IPattern.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ISingleFieldConstraint.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/PortableObject.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleAttribute.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleModel.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/SingleFieldConstraint.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/ExecutionTrace.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Expectation.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FactData.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FieldData.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Fixture.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/RetractFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Scenario.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyField.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyRuleFired.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/converter/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/ClassWalker.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/SuggestionCompletionLoader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRDRLPersistence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRLPersistence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRXMLPersistence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/DataEnumLoader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/ScenarioXMLPersistence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/ResourceReader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/ResourceStore.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/RuleBuildError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ActionError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DescrBuildError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/Dialect.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectConfiguration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectRegistry.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DrlParser.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsParserException.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FactTemplateError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FieldTemplateError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FunctionError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/GlobalError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ImportError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderErrors.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ParserError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuildError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ReturnValueDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBaseLoader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBuildError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleFlowLoadError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/SourcePackageProvider.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/TypeDeclarationError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLLexer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLParser.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DrlDumper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Expander.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderException.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderResolver.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/GeneralParseException.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Location.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/MVELDumper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ParseException.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccessorDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccumulateDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ActionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AndDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AttributeDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/BaseDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/CollectDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ConditionalElementDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DeclarativeInvokerDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DescrFactory.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EntryPointDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvalDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvaluatorBasedRestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ExistsDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FactTemplateDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldAccessDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldBindingDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldConstraintDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldTemplateDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ForallDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FromDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionCallDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionImportDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/GlobalDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ImportDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/LiteralRestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MethodAccessDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MultiPatternDestinationDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/NotDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/OrDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescrDumper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDestinationDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternSourceDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PredicateDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ProcessDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QualifiedIdentifierRestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QueryDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/Restriction.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionConnectiveDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RuleDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TimeWindowDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/VariableRestrictionDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMapping.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingEntry.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingFile.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingParseException.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMapping.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMappingEntry.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpander.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpanderResolver.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/MappingError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ActionNodeBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/SplitNodeBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/processNodeBuilder.conf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/AccumulateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ActionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/CollectBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ConsequenceBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/EntryPointBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ForallBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FromBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FunctionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/GroupElementBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PackageBuildContext.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PatternBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PredicateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessBuildContext.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessClassBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/QueryBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuildContext.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleClassBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleConditionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/SalienceBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/TimeWindowBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaProcessBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaRuleBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DeclarationTypeFixer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DialectSession.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAnalysisResult.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectConfiguration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectError.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectSession.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaFunctionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaProcessClassBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaRuleClassBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaTimeWindowBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLexer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLocalDeclarationDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaModifyBlockDescr.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaParser.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAnalysisResult.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialectConfiguration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/RuleCoverageListener.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/ScenarioRunner.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/TestingEventListener.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/BaseAbstractHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Configuration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultConfiguration.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultSemanticModule.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ExtensibleXmlParser.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Handler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessBuildData.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessSemanticModule.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/RulesSemanticModule.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModule.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModules.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlDumper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlPackageReader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlProcessReader.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ActionNodeHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ConnectionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/EndNodeHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/GlobalHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ImportHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ProcessHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/StartNodeHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHelperHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AndHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/CollectHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/EvalHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExistsHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExpressionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldBindingHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldConstraintHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ForallHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FromHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FunctionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/LiteralRestrictionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/NotHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/OrHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PackageHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PatternHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PredicateHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QualifiedIdentifierRestrictionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QueryHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RestrictionConnectiveHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ReturnValueRestrictionHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RuleHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/VariableRestrictionsHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools-4.0.xsd
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools.default.packagebuilder.conf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/compiler/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/compiler/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRL.g
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLLexer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLParser.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/dsl/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/dsl/rule1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaFunction.mvel
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.lexer.g
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.tokens
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParserLexer.tokens
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/parser/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/parser/Java.g
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/xml/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/xml/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/log4j.properties
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Approve.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Driver.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Policy.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Rejection.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Address.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Alarm.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Approach.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Attribute.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cell.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheese.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/CheeseEqual.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheesery.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Child.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Close.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/DroolsTestCase.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/EmergencyTeam.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactA.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactB.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactC.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FirstClass.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FromTestClass.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Func.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/GrandParent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Guess.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/IndexedNumber.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/InsertedObject.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Message.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Order.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderItem.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OuterClass.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Parent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Person.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonFinal.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonInterface.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonWithEquals.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PolymorphicFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Precondition.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Primitives.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Process.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Query.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/RandomNumber.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Results.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SecondClass.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Sensor.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SpecialString.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/State.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods2.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StockTick.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Storage.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Target.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/TestParam.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELActivity.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELAssign.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELBasicActivity.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFaultHandlerContainer.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFlow.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELInvoke.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELProcess.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReceive.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReply.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELScope.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELSequence.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELStructuredActivity.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELAssignInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELFlowInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELLinkManager.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELNodeInstanceFactoryRegistry.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstanceFactory.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReplyInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELScopeInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELSequenceInstance.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/test/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/test/BPELTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/Alert.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngineTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionFieldValueTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionSetFieldTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFactPatternTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFieldConstraintTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ConstraintTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DSLSentenceTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DataEnumLoaderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/FactPatternTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/RuleModelTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource2.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/package.html
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/converter/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SomeFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SuggestionCompletionLoaderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRDRLPersistenceTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRLPersitenceTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/ScenarioXMLPersistenceTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/CompilerPerfProfileTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/DrlParserTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/Java5Test.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleBaseLoaderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleErrorTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleFlowErrorTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/SourcePackageProviderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_pseudoClock.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_systemClock.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/CepEspTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DslTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DynamicRulesTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/IteratorToList.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/LargeRuleBase.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MVELTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MiscTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/OutOfMemoryTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/PackageBuilderThreadSafetyTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatefulSessionTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessSessionTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessStressTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StreamsTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/AbstractEventListener.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/EVENT_TYPE.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/Event.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventGenerator.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventListener.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/CheeseEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/PersonEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ExampleScenario_FIXME.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/FailureEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/HeartbeatEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ProductionEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Resource.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SimpleEventGeneratorTest_FIXME.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SlidingWindow.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Status.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/StatusChangedEvent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Tools.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/rule_generator.rb
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Edge.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Junction.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Line.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/ReteOOWaltzTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Stage.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Waltz.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/WaltzUtil.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MVELDumperTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpander.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpanderResolver.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/RuleParserTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/AndDescrTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/PackageDescrTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DSLMappingFileTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultDSLMappingEntryTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultExpanderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/ProcessNodeBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/StoreNodeBuilder.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/reteoo/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/reteoo/ReteooBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/JavaAndMVELCombinedTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/AccumulateTemplateTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/RuleBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedBuildContent.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedDeclarationScopeResolver.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/DumbFact.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactDataTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactPopulatorTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockFactHandle.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockRuleBase.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockWorkingMemory.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleCoverageListenerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleUnit.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioRunnerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/TestingEventListenerTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/StoreHandler.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXml.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXmlDsl.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/processes/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/processes/ActionNodeTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTestHelper.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/XmlPackageReaderTest.java
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelNodeBuilderRegistry.conf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelProcessNodeInstanceFactory.conf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/mydsl.conf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/modeldriven/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/modeldriven/Some.enumeration
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/util/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/util/existing_brl.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/bad_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/java5_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumber.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumberMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/HelloWorld.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/MVEL_soundex.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/assert_retract.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/big_decimal_and_comparable.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_in_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_parser_multiple.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test_more.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/evalmodify.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/example_scenario.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_AccumulateEvent.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_eventGenerator.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/exists_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/globals_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/insurance_pricing_example.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/invalid_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_with_boolean.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/multiple_rules_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested_fields.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/no-loop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_with_bindings_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_behaviour.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_constraint.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/or_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_as_first_pattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/returnvalue_rule_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl_more.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflowgroup.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfile.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfileMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/simpleSequential.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/simple_query_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Accumulate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverage.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverageMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCount.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCountMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateInnerClass.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMax.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMaxMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMin.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMinMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModify.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModifyMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionJava.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulatePreviousBinds.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNull.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNullMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModify.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModifyMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSum.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSumMVEL.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateWithFromChaining.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationCancellation.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationGroups.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AgendaGroups.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AlphaEvalWithOrCE.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindingsErrors.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoVivificationVR.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_BooleanWrapper.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertion.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleTimeWindow.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_TimeRelationalOperators.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Collect.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectAlphaRestriction.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectContainsOperator.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectMemberOfOperator.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectWithNestedFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceBuilderException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintConnectors.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ContainsCheese.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CrossProductRemovingIdentityEquals.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclarationUsage.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclaringAndUsingBindsInSamePattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DefaultBetaConstraint.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DoubleQueryWithExists.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dumpers.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateLocalVariableMVELConsequence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration_with_NoLoop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic3.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic4.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction3.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EffectiveDate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyPattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyRule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EntryPoint.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewrite.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteMatches.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteWithSpecialOperators.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EventModel.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExistsWithBindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExplicitAnd.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactBindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactTemplate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndEvalSharing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndPredicateSharing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FireRuleAfterDuration.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Forall.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ForallSinglePattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromInsideNotAndExists.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromNestedAccessors.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithNewConstructor.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithParams.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionInConsequence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionWithPrimitives.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportConflict.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportFunctions.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Insert_Retract_Noloop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_IterateObjects.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JavaModifyBlock.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyObject.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyTuple.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LocalVariableMVELConsequence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActive.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActiveWithUpdate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Logger.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionWithExists.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsAccumulatorPattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsBacking.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsLoop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNoLoop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNot.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNotPingPong.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsSelfreferencing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsUpdateEqual.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsWithUpdate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MVELCollect.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MapAccess.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MatchesNotMatches.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ModifyRetractInsert.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MultiRestrictionFieldConstraint.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedAccessors.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedConditionalElements.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedCorrelatedRulesWithForall.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NoPatterns.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NotInStatelessSession.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullFieldOnCompositeSink.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHandling.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHashing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullValuesIndexing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NumberComparisons.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrCE.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrNesting.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrWithBindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemory.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemoryError.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PredicateException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PropertyChange.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QualifiedFieldReference.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Query.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QueryWithParams.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RemovePackage.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RetractModifyWithFunction.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueAndGlobal.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueException.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes3.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Serializable.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyInHirarchies.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyOnCollections.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_StaticField.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SubNetworks.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_TwoQuerries.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UnbalancedTrees.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateActivationCreationNoLoop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateNoloop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_alphaNodeSharing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_bindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_castsInsideEval.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_charComparisons.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_collectNodeSharing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_contains_in_array.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBinding.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBindingError.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_emptyIdentifier.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_equalitySupport.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_exists.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_expander.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_fireLimit.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_functionCallingFunction.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalCustomResolver.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalsAsConstraints.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_halt.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_implicitDeclarations.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_logicalInsertions3.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_memberOf.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_missing_import.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_multipleFroms.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_mvel.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nodeSharingNotExists.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nullBindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_primitiveArray.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_removeIdentitiesSubNetwork.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceExpressionRule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceIntegerRule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_skipModify.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/thread_class_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz50.dat
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateExternalFunction.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateReverse.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_multi_pattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_bindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_nested_from.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/almost_empty_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/and_or_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/application-data.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/autofocus.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/basic_binding.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/bindings.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/brackets_precedence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese-rules.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese.dsl.properties
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect_with_nested_from.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comma_misuse.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comment.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/complex.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declaration-in-consequence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declare_type.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/template/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/template/test.dsl.properties
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_expansion.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_metainfo.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/empty_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/enumeration.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eol_funny_business.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/escaped-string.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_multiple.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_parsing.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_newline.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_semicolon.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/exist_instead_of_exists_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_line_errors.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints_flush.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_post_errors.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_spread_lines.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/extra_lhs_newline.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/forall.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/from.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/function_arrays.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/functions.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/globals.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/import_event.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/in_operator_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/invalid_syntax.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin-sample.dslr
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/lhs_semicolon_delim.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/literal_bool_and_negative.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/misplaced_parenthesis.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_constraints.dsl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_errors.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_rules.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/nested_conditional_elements.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/no-loop.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_exist_with_brackets.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_binding_error.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_constraint.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/notin_operator_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/npe_on_parser.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/one-rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_complex.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_with_brackets.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_ce.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_nesting.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package-imports.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_attributes.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_garbage.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pattern_partial.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pluggable_operators.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/qualified_classname.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/query_and_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/quoted_string_name_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/restrictions_test.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes_alt.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_names_number_prefix.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_not.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ruleflowgroup.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/semicolon.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_expander.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_query.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/soundslike_operator.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/statement_ordering_1.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ternary_expression.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_CommentLineNumbersInConsequence.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_ComplexChainedCallWithFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EmptyPattern.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EndPosition.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_FunctionImport.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorArgWithFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorWithFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleFunctionCallWithFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleMethodCallWithFrom.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_Templates.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_eval.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_predicate.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_retval.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrs
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrs.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrsPerson.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_ThreePatternsWithConstraints.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/java/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/java/nestedConditionalElements.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/javaonly.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvel/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvel/mvel_rule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mveljavarules.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvelonly.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules2.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_stateful.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlDslTest.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlTest.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/processes/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_Dump.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseExists.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseForall.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseImport.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRule.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_accumulateall.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_complex.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_from.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_simplerule.drl
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/target/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/target/classes/
   labs/jbossrules/branches/temporal_rete/drools-compiler-window/target/test-classes/
Log:
Initial import.

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/.classpath
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/.classpath	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/.classpath	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="src" path="/drools-core"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Drools Developer Library"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/.project
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/.project	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/.project	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>drools-compiler</name>
+	<comment>A rule production system</comment>
+	<projects>
+		<project>drools-core</project>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/pom.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/pom.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/pom.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>drools</artifactId>
+    <groupId>org.drools</groupId>
+	  <version>4.1.0.SNAPSHOT</version>
+  </parent>
+
+  <artifactId>drools-compiler</artifactId>
+  <packaging>jar</packaging>
+  <name>Drools :: Compiler</name>
+
+  <repositories>
+    <repository>
+      <id>basedir</id>
+      <url>file://${basedir}/../m2_repo</url>
+    </repository>
+  </repositories>
+
+  <build/>
+
+  <dependencies>
+    <!-- Internal dependencies -->
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-core</artifactId>
+    </dependency>
+
+    <!-- External dependencies -->
+    <dependency>
+      <groupId>org.antlr</groupId>
+      <artifactId>antlr-runtime</artifactId>     
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jdt</groupId>
+      <artifactId>core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>janino</groupId>
+      <artifactId>janino</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.thoughtworks.xstream</groupId>
+      <artifactId>xstream</artifactId>
+      <optional>true</optional>
+    </dependency>      
+    
+    <dependency>
+      <groupId>com.thoughtworks.xstream</groupId>
+      <artifactId>xstream</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <!--
+    <dependency>
+      <groupId>javax.mail</groupId>
+      <artifactId>mail</artifactId>
+    </dependency>
+    -->  
+  </dependencies>
+
+</project>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngine.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngine.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngine.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,306 @@
+package org.drools.brms.client.modeldriven;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.brms.client.modeldriven.brl.ActionFieldList;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.FieldConstraint;
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+/**
+ * An suggestion completion processor. This should be usable in both GWT/Web and the IDE.
+ * The data for this can be loaded into this from simple string lists.
+ *
+ * @author Michael Neale
+ */
+public class SuggestionCompletionEngine
+    implements
+    PortableObject {
+
+    /** These are the explicit types supported */
+    public static final String    TYPE_COLLECTION        = "Collection";
+    public static final String    TYPE_COMPARABLE        = "Comparable";
+    public static final String    TYPE_STRING            = "String";
+    public static final String    TYPE_NUMERIC           = "Numeric";
+    public static final String    TYPE_BOOLEAN           = "Boolean";
+    //public static final String    TYPE_DATE              = "Date";
+    public static final String    TYPE_OBJECT            = "Object"; //for all other unknown types
+
+    /**
+     * The operators that are used at different times (based on type).
+     */
+    private static final String[] STANDARD_CONNECTIVES   = new String[]{"|| ==", "|| !=", "&& !="};
+    private static final String[] STRING_CONNECTIVES     = new String[]{"|| ==", "|| !=", "&& !=", "&& matches", "|| matches"};
+    private static final String[] COMPARABLE_CONNECTIVES = new String[]{"|| ==", "|| !=", "&& !=", "&& >", "&& <", "|| >", "|| <", "&& >=", "&& <=", "|| <=", "|| >="};
+    private static final String[] COLLECTION_CONNECTIVES = new String[]{"|| ==", "|| !=", "&& !=", "|| contains", "&& contains", "|| excludes", "&& excludes"};
+
+    private static final String[] STANDARD_OPERATORS     = new String[]{"==", "!="};
+    private static final String[] COMPARABLE_OPERATORS   = new String[]{"==", "!=", "<", ">", "<=", ">="};
+    private static final String[] STRING_OPERATORS       = new String[]{"==", "!=", "matches", "soundslike"};
+    private static final String[] COLLECTION_OPERATORS   = new String[]{"contains", "excludes", "==", "!="};
+
+    /** The top level conditional elements (first order logic) */
+    private static final String[] CONDITIONAL_ELEMENTS   = new String[]{"not", "exists", "or"};
+
+    /**
+     * A list of fact types (never fully qualified).
+     */
+    public String[]               factTypes;
+
+    /**
+     * A map of types to the fields. key is type, value is (String[] of fields)
+     *
+     * @gwt.typeArgs <java.lang.String, java.lang.String[]>
+     */
+    public Map                    fieldsForType;
+
+    /**
+     * A map of the Fields to their types, needed for operator completions,
+     * as well as other things like rendering strings, dates etc.
+     * This is in the format of: { 'Type.field' => 'typename' }.
+     * Should not be the exact type, perhaps just a high level interface, eg "Comparable".
+     *
+     * @gwt.typeArgs <java.lang.String, java.lang.String>
+     */
+    public Map                    fieldTypes;
+
+    /**
+     * Contains a map of globals (name is key) and their type (value).
+     * @gwt.typeArgs <java.lang.String, java.lang.String>
+     */
+    public Map                    globalTypes            = new HashMap();
+
+    /**
+     * Contains a map of { TypeName.field : String[] } - where a list is
+     * valid values to display in a drop down for a given Type.field combination.
+     * @gwt.typeArgs <java.lang.String, java.lang.String[]>
+     */
+    public Map 					  dataEnumLists			 = new HashMap();
+
+    /** Operators (from the grammar):
+     *      op=(    '=='
+     |   '>'
+     |   '>='
+     |   '<'
+     |   '<='
+     |   '!='
+     |   'contains'
+     |   'matches'
+     |       'excludes'
+     )
+     * Connectives add "&" and "|" to this.
+     */
+
+    /**
+     * DSL language extensions, if needed, if provided by the package.
+     */
+    public DSLSentence[]          conditionDSLSentences  = new DSLSentence[0];
+    public DSLSentence[]          actionDSLSentences     = new DSLSentence[0];
+
+    /**
+     * This is used to calculate what fields an enum list may depend on. Optional.
+     */
+	private transient Map dataEnumLookupFields;
+
+    //    /**
+    //     * For bulk loading up the data (from a previous rule save)
+    //     *
+    //     * @param factToFields A map of "FactType" (key - String) to String[] (value)
+    //     * @param factFieldToOperator A map of "FactType.field" (key - String) to String[] operators
+    //     * @param factFieldToConnectiveOperator A map of "FactType.field" (key -String) to String[] operators
+    //     *                                  that are valid CONNECTIVE operators.
+    //     *
+    //     * @param globals A map of global variable name to its fields (String[]).
+    //     * @param boundFacts A map of bound facts to types.
+    //     * @param conditionDSLs a list of DSLSentence suggestions for the LHS
+    //     * @param actionDSLs a list of DSLSentence suggestions for the RHS
+    //     *
+    //     */
+    //    public void load(
+    //                      Map factToFields,
+    //                      Map factFieldToOperator,
+    //                      Map factFieldToConnectiveOperator,
+    //                      Map globals,
+    //                      List conditionDSLs,
+    //                      List actionDSLs
+    //                    ) {
+    //        this.factToFields = factToFields;
+    //        this.factFieldToOperator = factFieldToOperator;
+    //        this.factFieldToConnectiveOperator = factFieldToConnectiveOperator;
+    //        this.actionDSLSentences = actionDSLs;
+    //        this.conditionDSLSentences = conditionDSLs;
+    //        this.globals = globals;
+    //
+    //    }
+
+    public SuggestionCompletionEngine() {
+
+    }
+
+    public String[] getConditionalElements() {
+        return CONDITIONAL_ELEMENTS;
+    }
+
+    public DSLSentence[] getDSLConditions() {
+        return this.conditionDSLSentences;
+    }
+
+    public DSLSentence[] getDSLActions() {
+        return this.actionDSLSentences;
+    }
+
+    public String[] getConnectiveOperatorCompletions(final String factType,
+                                                     final String fieldName) {
+        final String type = (String) this.fieldTypes.get( factType + "." + fieldName );
+        if ( type == null ) {
+            return STANDARD_CONNECTIVES;
+        } else if ( type.equals( TYPE_STRING ) ) {
+            return STRING_CONNECTIVES;
+        } else if ( type.equals( TYPE_COMPARABLE ) || type.equals( TYPE_NUMERIC ) ) {
+            return COMPARABLE_CONNECTIVES;
+        } else if ( type.equals( TYPE_COLLECTION ) ) {
+            return COLLECTION_CONNECTIVES;
+        } else {
+            return STANDARD_CONNECTIVES;
+        }
+
+    }
+
+    public String[] getFactTypes() {
+        return this.factTypes;
+    }
+
+    public String[] getFieldCompletions(final String factType) {
+        return (String[]) this.fieldsForType.get( factType );
+
+    }
+
+    public String[] getOperatorCompletions(final String factType,
+                                           final String fieldName) {
+        final String type = (String) this.fieldTypes.get( factType + "." + fieldName );
+        if ( type == null ) {
+            return STANDARD_OPERATORS;
+        } else if ( type.equals( TYPE_STRING ) ) {
+            return STRING_OPERATORS;
+        } else if ( type.equals( TYPE_COMPARABLE ) || type.equals( TYPE_NUMERIC ) ) {
+            return COMPARABLE_OPERATORS;
+        } else if ( type.equals( TYPE_COLLECTION ) ) {
+            return COLLECTION_OPERATORS;
+        } else {
+            return STANDARD_OPERATORS;
+        }
+
+    }
+
+
+    /**
+     * A map of the Fields to their types, needed for operator completions,
+     * as well as other things like rendering strings, dates etc.
+     * This is in the format of: { 'Type.field' => 'typename' }.
+     * Should not be the exact type, perhaps just a high level interface, eg "Comparable", "Numeric", "String".
+     *
+     */
+    public String getFieldType(final String factType,
+                               final String fieldName) {
+        return (String) this.fieldTypes.get( factType + "." + fieldName );
+    }
+
+    public boolean isGlobalVariable(final String variable) {
+        return this.globalTypes.containsKey( variable );
+    }
+
+    public String[] getFieldCompletionsForGlobalVariable(final String varName) {
+        final String type = (String) this.globalTypes.get( varName );
+        return (String[]) this.fieldsForType.get( type );
+    }
+
+    private String[] toStringArray(final Set set) {
+        final String[] f = new String[set.size()];
+        int i = 0;
+        for ( final Iterator iter = set.iterator(); iter.hasNext(); ) {
+            f[i] = (String) iter.next();
+            i++;
+        }
+        return f;
+    }
+
+    public String[] getGlobalVariables() {
+        return toStringArray( this.globalTypes.keySet() );
+    }
+
+    /**
+     * This returns a list of enums options (values) that can be used
+     * for the given field of the given FactPattern.
+     *
+     * This also takes into account enums that depend on other fields.
+     *
+     */
+	public String[] getEnums(FactPattern pat, String field) {
+
+		Map dataEnumLookupFields = loadDataEnumLookupFields();
+		String typeField = (String) dataEnumLookupFields.get(pat.factType + "." + field );
+
+		if (pat.constraintList != null && pat.constraintList.constraints != null) {
+			FieldConstraint[] cons = pat.constraintList.constraints;
+			for (int i = 0; i < cons.length; i++) {
+				FieldConstraint con = cons[i];
+				if (con instanceof SingleFieldConstraint) {
+					SingleFieldConstraint sfc = (SingleFieldConstraint) con;
+					if ( sfc.fieldName.equals(typeField)) {
+						String key = pat.factType + "." + field + "[" + typeField + "=" + sfc.value + "]";
+						return (String[]) this.dataEnumLists.get(key);
+					}
+				}
+			}
+		}
+
+		return (String[]) this.dataEnumLists.get(pat.factType + "." + field);
+	}
+
+	public String[] getEnums(String type, ActionFieldValue[] currentValues, String field) {
+		Map dataEnumLookupFields = loadDataEnumLookupFields();
+		String typeField = (String) dataEnumLookupFields.get(type + "." + field );
+
+		if (currentValues != null) {
+			for (int i = 0; i < currentValues.length; i++) {
+				ActionFieldValue val = currentValues[i];
+				if (val.field.equals(typeField)) {
+					String key = type + "." + field + "[" + typeField + "=" + val.value + "]";
+					return (String[]) this.dataEnumLists.get(key);
+				}
+			}
+		}
+
+		return (String[]) this.dataEnumLists.get(type + "." + field);
+
+
+	}
+
+
+	private Map loadDataEnumLookupFields() {
+		if (this.dataEnumLookupFields == null) {
+			this.dataEnumLookupFields = new HashMap();
+			Set keys = this.dataEnumLists.keySet();
+			for (Iterator iter = keys.iterator(); iter.hasNext();) {
+				String key = (String) iter.next();
+				if (key.indexOf('[') != -1) {
+					int ix = key.indexOf('[');
+					String factField = key.substring(0, ix);
+					String predicate = key.substring(ix + 1, key.indexOf(']'));
+					String typeField = predicate.substring(0, predicate.indexOf('='));
+					dataEnumLookupFields.put(factField, typeField);
+				}
+			}
+		}
+
+
+		return dataEnumLookupFields;
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldList.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldList.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldList.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This class is the parent for field setting or assertion actions.
+ * 
+ * Contains the list of fields and their values to be set.
+ * 
+ * @author Michael Neale
+ *
+ */
+public abstract class ActionFieldList
+    implements
+    IAction {
+
+    public ActionFieldValue[] fieldValues = new ActionFieldValue[0];
+
+    public void removeField(final int idx) {
+        //Unfortunately, this is kinda duplicate code with other methods, 
+        //but with typed arrays, and GWT, its not really possible to do anything "better" 
+        //at this point in time. 
+        final ActionFieldValue[] newList = new ActionFieldValue[this.fieldValues.length - 1];
+        int newIdx = 0;
+        for ( int i = 0; i < this.fieldValues.length; i++ ) {
+
+            if ( i != idx ) {
+                newList[newIdx] = this.fieldValues[i];
+                newIdx++;
+            }
+
+        }
+        this.fieldValues = newList;
+    }
+
+    public void addFieldValue(final ActionFieldValue val) {
+        if ( this.fieldValues == null ) {
+            this.fieldValues = new ActionFieldValue[1];
+            this.fieldValues[0] = val;
+        } else {
+            final ActionFieldValue[] newList = new ActionFieldValue[this.fieldValues.length + 1];
+            for ( int i = 0; i < this.fieldValues.length; i++ ) {
+                newList[i] = this.fieldValues[i];
+            }
+            newList[this.fieldValues.length] = val;
+            this.fieldValues = newList;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldValue.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldValue.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionFieldValue.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,50 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * Holds field and value for "action" parts of the rule.
+ * 
+ * @author Michael Neale
+ */
+public class ActionFieldValue
+    implements
+    PortableObject {
+
+    public String field;
+    public String value;
+    
+    /**
+     * This is the datatype archectype (eg String, Numeric etc).
+     */
+    public String type;
+
+    public ActionFieldValue(final String field,
+                            final String value,
+                            final String type) {
+        this.field = field;
+        this.value = value;
+        this.type = type;
+    }
+
+    public ActionFieldValue() {
+    }
+
+    /**
+     * This will return true if the value is really a "formula" - in 
+     * the sense of like an excel spreadsheet.
+     * 
+     *  If it IS a formula, then the value should never be turned into a 
+     *  string, always left as-is.
+     * 
+     */
+    public boolean isFormula() {
+        if ( this.value == null ) {
+            return false;
+        }
+        if ( this.value.trim().startsWith( "=" ) ) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This is used when asserting a new fact.
+ * @author Michael Neale
+ *
+ */
+public class ActionInsertFact extends ActionFieldList {
+
+
+    public String factType;
+
+    public ActionInsertFact(final String type) {
+        this.factType = type;
+    }
+
+    public ActionInsertFact() {
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertLogicalFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertLogicalFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionInsertLogicalFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * Logical assertions are used as part of "truth maintenance". 
+ * 
+ * @author Michael Neale
+ */
+public class ActionInsertLogicalFact extends ActionInsertFact {
+
+    public ActionInsertLogicalFact(final String fact) {
+        super( fact );
+    }
+
+    public ActionInsertLogicalFact() {
+        super();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionRetractFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionRetractFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionRetractFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This is used to specify that the bound fact should be retracted
+ * when the rule fires.
+ * @author Michael Neale
+ *
+ */
+public class ActionRetractFact
+    implements
+    IAction {
+
+    public ActionRetractFact() {
+    }
+
+    public ActionRetractFact(final String var) {
+        this.variableName = var;
+    }
+
+    public String variableName;
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionSetField.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionSetField.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionSetField.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * For setting a field on a bound LHS variable or a global.
+ * If setting a field on a fact bound variable, this will 
+ * NOT notify the engine of any changes (unless done outside of the engine).
+ * 
+ * @author Michael Neale
+ */
+public class ActionSetField extends ActionFieldList {
+
+    public ActionSetField(final String var) {
+        this.variable = var;
+    }
+
+
+    public ActionSetField() {
+    }
+
+    public String variable;
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionUpdateField.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionUpdateField.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ActionUpdateField.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * Basically the same as setting fields, EXCEPT that
+ * it will notify the engine of the changes.
+ * This only applies to bound fact variables from the LHS.
+ * 
+ * @author Michael Neale
+ */
+public class ActionUpdateField extends ActionSetField {
+
+    public ActionUpdateField(final String itemText) {
+        super( itemText );
+    }
+
+    public ActionUpdateField() {
+        super();
+    }
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFactPattern.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFactPattern.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFactPattern.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,52 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * Represents first order logic like Or, Not, Exists.
+ * 
+ * @author Michael Neale
+ */
+public class CompositeFactPattern
+    implements
+    IPattern {
+    public static final String COMPOSITE_TYPE_NOT    = "not";
+    public static final String COMPOSITE_TYPE_EXISTS = "exists";
+    public static final String COMPOSITE_TYPE_OR     = "or";
+
+    /**
+     * this will one of: [Not, Exist, Or]
+     */
+    public String              type;
+    
+    /**
+     * The patterns.
+     */
+    public FactPattern[]       patterns;
+
+    
+    /**
+     * This type should be from the contants in this class of course.
+     */
+    public CompositeFactPattern(final String type) {
+        this.type = type;
+    }
+
+    public CompositeFactPattern() {
+    }
+
+    public void addFactPattern(final FactPattern pat) {
+        if ( this.patterns == null ) {
+            this.patterns = new FactPattern[0];
+        }
+
+        final FactPattern[] list = this.patterns;
+        final FactPattern[] newList = new FactPattern[list.length + 1];
+
+        for ( int i = 0; i < list.length; i++ ) {
+            newList[i] = list[i];
+        }
+        newList[list.length] = pat;
+
+        this.patterns = newList;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFieldConstraint.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/CompositeFieldConstraint.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,74 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This is a field constraint that may span multiple fields.
+ *
+ * @author Michael Neale
+ */
+public class CompositeFieldConstraint implements FieldConstraint {
+
+
+    /**
+     * Means that any of the children can resolve to be true.
+     */
+    public static final String COMPOSITE_TYPE_OR = "||";
+
+    /**
+     * Means that ALL of the children constraints must resolve to be true.
+     */
+    public static final String COMPOSITE_TYPE_AND = "&&";
+
+
+    /**
+     * The type of composite that it is.
+     */
+    public String compositeJunctionType = null;
+
+
+    /**
+     * This is the child field constraints of the composite.
+     * They may be single constraints, or composite themselves.
+     * If this composite is it at the "top level"  - then
+     * there is no need to look at the compositeType property
+     * (as they are all children that are "anded" together anyway in the fact
+     * pattern that contains it).
+     */
+    public FieldConstraint[] constraints = null;
+
+    //Note this is a bit ugly, GWT had some early limitations which required this to kind of work this way.
+    //when generics are available, could probably switch to it, but remember this is persistent stuff
+    //so don't want to break backwards compat (as XStream is used)
+    public void addConstraint(final FieldConstraint constraint) {
+        if ( this.constraints == null ) {
+            this.constraints = new FieldConstraint[1];
+            this.constraints[0] = constraint;
+        } else {
+            final FieldConstraint[] newList = new FieldConstraint[this.constraints.length + 1];
+            for ( int i = 0; i < this.constraints.length; i++ ) {
+                newList[i] = this.constraints[i];
+            }
+            newList[this.constraints.length] = constraint;
+            this.constraints = newList;
+        }
+    }
+
+    public void removeConstraint(final int idx) {
+        //Unfortunately, this is kinda duplicate code with other methods,
+        //but with typed arrays, and GWT, its not really possible to do anything "better"
+        //at this point in time.
+        final FieldConstraint[] newList = new FieldConstraint[this.constraints.length - 1];
+        int newIdx = 0;
+        for ( int i = 0; i < this.constraints.length; i++ ) {
+
+            if ( i != idx ) {
+                newList[newIdx] = this.constraints[i];
+                newIdx++;
+            }
+
+        }
+        this.constraints = newList;
+
+    }
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ConnectiveConstraint.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ConnectiveConstraint.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ConnectiveConstraint.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This is for a connective constraint that adds more options to a field constraint. 
+ * @author Michael Neale
+ */
+public class ConnectiveConstraint extends ISingleFieldConstraint {
+
+    public ConnectiveConstraint() {
+    }
+
+    public ConnectiveConstraint(final String opr,
+                                final String val) {
+        this.operator = opr;
+        this.value = val;
+    }
+
+    public String operator;
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/DSLSentence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/DSLSentence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/DSLSentence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This represents a DSL sentence.
+ * @author Michael Neale
+ */
+public class DSLSentence
+    implements
+    IPattern,
+    IAction {
+
+    public String sentence;
+
+    /**
+     * This will strip off any residual "{" stuff...
+     */
+    public String toString() {
+        final char[] chars = this.sentence.toCharArray();
+        String result = "";
+        for ( int i = 0; i < chars.length; i++ ) {
+            final char c = chars[i];
+            if ( c != '{' && c != '}' ) {
+                result += c;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * This is used by the GUI when adding a sentence to LHS or RHS.
+     * @return
+     */
+    public DSLSentence copy() {
+        final DSLSentence newOne = new DSLSentence();
+        newOne.sentence = this.sentence;
+        return newOne;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FactPattern.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FactPattern.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FactPattern.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,65 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * A fact pattern is a declaration of a fact type, and its constraint,
+ * and perhaps a variable that is it bound to
+ * It is the equivalent of a "pattern" in drools terms. 
+ * @author Michael Neale
+ *
+ */
+public class FactPattern
+    implements
+    IPattern {
+
+    public CompositeFieldConstraint constraintList;
+    public String       factType;
+    public String       boundName;
+
+    public FactPattern() {
+        //this.constraints = new CompositeFieldConstraint();
+    }
+
+    public FactPattern(final String factType) {
+        this.factType = factType;
+        //this.constraints = new CompositeFieldConstraint();
+    }
+
+    /**
+     * This will add a top level constraint.  
+     */
+    public void addConstraint(final FieldConstraint constraint) {
+        if (constraintList == null) constraintList = new CompositeFieldConstraint();
+        this.constraintList.addConstraint( constraint );
+    }
+
+    public void removeConstraint(final int idx) {
+        this.constraintList.removeConstraint( idx );
+    }
+
+    /**
+     * Returns true if there is a variable bound to this fact.
+     */
+    public boolean isBound() {
+        if ( this.boundName != null && !"".equals( this.boundName ) ) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+    
+    /**
+     * This will return the list of field constraints that are in the root
+     * CompositeFieldConstraint object.
+     * If there is no root, then an empty array will be returned.
+     * 
+     * @return an empty array, or the list of constraints (which may be composites).
+     */
+    public FieldConstraint[] getFieldConstraints() {
+        if (this.constraintList == null) {
+            return new FieldConstraint[0];
+        } else {
+            return this.constraintList.constraints;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FieldConstraint.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FieldConstraint.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/FieldConstraint.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This is the top level interface for all field constraints.
+ * These may be composites. 
+ * 
+ * @author Michael Neale
+ */
+public interface FieldConstraint extends PortableObject {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IAction.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IAction.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IAction.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools.brms.client.modeldriven.brl;
+
+public interface IAction
+    extends
+    PortableObject {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IPattern.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IPattern.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/IPattern.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools.brms.client.modeldriven.brl;
+
+public interface IPattern
+    extends
+    PortableObject {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ISingleFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ISingleFieldConstraint.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/ISingleFieldConstraint.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,47 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * Represents a constraint, which may be part of a direct field constraint or a connective.
+ * @author Michael Neale
+ *
+ */
+public class ISingleFieldConstraint
+    implements
+    PortableObject {
+
+    /**
+     * This is used only when constraint is first created. 
+     * This means that there is no value yet for the constraint.
+     */
+    public static final int TYPE_UNDEFINED = 0;
+
+    /**
+     * This may be string, or number, anything really. 
+     */
+    public static final int TYPE_LITERAL   = 1;
+
+    /**
+     * This is when it is set to a valid previously bound variable.
+     */
+    public static final int TYPE_VARIABLE  = 2;
+
+    /**
+     * This is for a "formula" that calculates a value.
+     */
+    public static final int TYPE_RET_VALUE = 3;
+
+    /**
+     * This is not used yet. ENUMs are not suitable for business rules
+     * until we can get data driven non code enums.
+     */
+    public static final int TYPE_ENUM      = 4;
+
+    /**
+     * The fieldName and fieldBinding is not used in the case of a predicate. 
+     */
+    public static final int TYPE_PREDICATE = 5;
+
+    public String           value;
+    public int              constraintValueType;
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/PortableObject.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/PortableObject.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/PortableObject.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.brms.client.modeldriven.brl;
+
+import java.io.Serializable;
+
+/**
+ * This is the marker interface for portable Ajaxy type objects.
+ * This is replaced in the BRMS with a GWT specific one, and only used here so the RuleModel
+ * can compile. It does nothing, and is strictly a marker interface only. 
+ * @author Michael Neale
+ *
+ */
+public interface PortableObject extends Serializable {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleAttribute.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleAttribute.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleAttribute.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+package org.drools.brms.client.modeldriven.brl;
+
+/**
+ * This holds values for rule attributes (eg salience, agenda-group etc).
+ * @author Michael Neale
+ */
+public class RuleAttribute
+    implements
+    PortableObject {
+
+    private static final String NOLOOP   = "no-loop";
+    private static final String SALIENCE = "salience";
+
+    public RuleAttribute(final String name,
+                         final String value) {
+        this.attributeName = name;
+        this.value = value;
+    }
+
+    public String attributeName;
+    public String value;
+
+    public RuleAttribute() {
+    }
+
+    public String toString() {
+        StringBuffer ret = new StringBuffer();
+        ret.append( this.attributeName );
+        if ( NOLOOP.equals( attributeName ) ) {
+            ret.append( " " );
+            ret.append( this.value == null ? "true" : this.value );
+        } else if ( SALIENCE.equals( this.attributeName ) ) {
+            ret.append( " " );
+            ret.append( this.value );
+        } else if ( this.value != null ) {
+            ret.append( " \"" );
+            ret.append( this.value );
+            ret.append( "\"" );
+        }
+        return ret.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleModel.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleModel.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/RuleModel.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,301 @@
+package org.drools.brms.client.modeldriven.brl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RuleModel
+    implements
+    PortableObject {
+
+    /**
+     * This name is generally not used - the asset name or the
+     * file name is preferred (ie it could get out of sync with the name of the file it is in).
+     */
+    public String          name;
+    public String          modelVersion = "1.0";
+
+    public RuleAttribute[] attributes   = new RuleAttribute[0];
+
+    public IPattern[]      lhs          = new IPattern[0];
+    public IAction[]       rhs          = new IAction[0];
+
+    /**
+     * This will return the fact pattern that a variable is bound to.
+     *
+     * @param var The bound fact variable (NOT bound field).
+     * @return null or the FactPattern found.
+     */
+    public FactPattern getBoundFact(final String var) {
+        if ( this.lhs == null ) {
+            return null;
+        }
+        for ( int i = 0; i < this.lhs.length; i++ ) {
+
+            if ( this.lhs[i] instanceof FactPattern ) {
+                final FactPattern p = (FactPattern) this.lhs[i];
+                if ( p.boundName != null && var.equals( p.boundName ) ) {
+                    return p;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @return A list of bound facts (String). Or empty list if none are found.
+     */
+    public List getBoundFacts() {
+        if ( this.lhs == null ) {
+            return null;
+        }
+        final List list = new ArrayList();
+        for ( int i = 0; i < this.lhs.length; i++ ) {
+            if ( this.lhs[i] instanceof FactPattern ) {
+                final FactPattern p = (FactPattern) this.lhs[i];
+                if ( p.boundName != null ) {
+                    list.add( p.boundName );
+                }
+            }
+        }
+        return list;
+
+    }
+
+    /**
+     *
+     * @param idx Remove this index from the LHS.
+     * @param Returns false if it was NOT allowed to remove this item (ie
+     * it is used on the RHS).
+     */
+    public boolean removeLhsItem(final int idx) {
+
+        final IPattern[] newList = new IPattern[this.lhs.length - 1];
+        int newIdx = 0;
+        for ( int i = 0; i < this.lhs.length; i++ ) {
+
+            if ( i != idx ) {
+                newList[newIdx] = this.lhs[i];
+                newIdx++;
+            } else {
+                if ( this.lhs[i] instanceof FactPattern ) {
+                    final FactPattern p = (FactPattern) this.lhs[i];
+                    if ( p.boundName != null && isBoundFactUsed( p.boundName ) ) {
+                        return false;
+                    }
+                }
+
+            }
+
+        }
+        this.lhs = newList;
+        return true;
+    }
+
+    /**
+     * @param binding The name of the LHS fact binding.
+     * @return Returns true if the specified binding is used on the RHS.
+     */
+    public boolean isBoundFactUsed(final String binding) {
+        if ( this.rhs == null ) {
+            return false;
+        }
+        for ( int i = 0; i < this.rhs.length; i++ ) {
+            if ( this.rhs[i] instanceof ActionSetField ) {
+                final ActionSetField set = (ActionSetField) this.rhs[i];
+                if ( set.variable.equals( binding ) ) {
+                    return true;
+                }
+            } else if ( this.rhs[i] instanceof ActionRetractFact ) {
+                final ActionRetractFact ret = (ActionRetractFact) this.rhs[i];
+                if ( ret.variableName.equals( binding ) ) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public void addLhsItem(final IPattern pat) {
+        if ( this.lhs == null ) {
+            this.lhs = new IPattern[0];
+        }
+
+        final IPattern[] list = this.lhs;
+        final IPattern[] newList = new IPattern[list.length + 1];
+
+        for ( int i = 0; i < list.length; i++ ) {
+            newList[i] = list[i];
+        }
+        newList[list.length] = pat;
+
+        this.lhs = newList;
+    }
+
+    public void addRhsItem(final IAction action) {
+        if ( this.rhs == null ) {
+            this.rhs = new IAction[0];
+        }
+
+        final IAction[] list = this.rhs;
+        final IAction[] newList = new IAction[list.length + 1];
+
+        for ( int i = 0; i < list.length; i++ ) {
+            newList[i] = list[i];
+        }
+        newList[list.length] = action;
+
+        this.rhs = newList;
+    }
+
+    public void removeRhsItem(final int idx) {
+        final IAction[] newList = new IAction[this.rhs.length - 1];
+        int newIdx = 0;
+        for ( int i = 0; i < this.rhs.length; i++ ) {
+
+            if ( i != idx ) {
+                newList[newIdx] = this.rhs[i];
+                newIdx++;
+            }
+
+        }
+        this.rhs = newList;
+    }
+
+    public void addAttribute(final RuleAttribute attribute) {
+
+        final RuleAttribute[] list = this.attributes;
+        final RuleAttribute[] newList = new RuleAttribute[list.length + 1];
+
+        for ( int i = 0; i < list.length; i++ ) {
+            newList[i] = list[i];
+        }
+        newList[list.length] = attribute;
+
+        this.attributes = newList;
+
+    }
+
+    public void removeAttribute(final int idx) {
+        final RuleAttribute[] newList = new RuleAttribute[this.attributes.length - 1];
+        int newIdx = 0;
+        for ( int i = 0; i < this.attributes.length; i++ ) {
+
+            if ( i != idx ) {
+                newList[newIdx] = this.attributes[i];
+                newIdx++;
+            }
+
+        }
+        this.attributes = newList;
+
+    }
+
+    /**
+     * This uses a deceptively simple algorithm to determine
+     * what bound variables are in scope for a given constraint (including connectives).
+     * Does not take into account globals.
+     */
+    public List getBoundVariablesInScope(final ISingleFieldConstraint con) {
+        final List result = new ArrayList();
+        for ( int i = 0; i < this.lhs.length; i++ ) {
+            final IPattern pat = this.lhs[i];
+            if ( pat instanceof FactPattern ) {
+                final FactPattern fact = (FactPattern) pat;
+
+                if ( fact.constraintList != null ) {
+                    final FieldConstraint[] cons = fact.constraintList.constraints;
+                    if (cons != null) {
+                        for ( int k = 0; k < cons.length; k++ ) {
+                            FieldConstraint fc = cons[k];
+                            if (fc instanceof SingleFieldConstraint) {
+                                final SingleFieldConstraint c = (SingleFieldConstraint) fc;
+                                if ( c == con ) {
+                                    return result;
+                                }
+                                if ( c.connectives != null ) {
+                                    for ( int j = 0; j < c.connectives.length; j++ ) {
+                                        if ( con == c.connectives[j] ) {
+                                            return result;
+                                        }
+                                    }
+                                }
+                                if ( c.isBound() ) {
+                                    result.add( c.fieldBinding );
+                                }
+                            }
+                        }
+                    }
+                    if ( fact.isBound() ) {
+                        result.add( fact.boundName );
+                    }
+                } else {
+                    if ( fact.isBound() ) {
+                        result.add( fact.boundName );
+                    }
+                }
+
+            }
+        }
+        return result;
+    }
+
+    /**
+     * This will get a list of all bound variables, including bound fields.
+     */
+    public List getAllVariables() {
+        List result = new ArrayList();
+        for ( int i = 0; i < this.lhs.length; i++ ) {
+            IPattern pat = this.lhs[i];
+            if (pat instanceof FactPattern) {
+                FactPattern fact = (FactPattern) pat;
+                if (fact.isBound()) {
+                    result.add( fact.boundName );
+                }
+
+                for ( int j = 0; j < fact.getFieldConstraints().length; j++ ) {
+                    FieldConstraint fc = fact.getFieldConstraints()[j];
+                    if (fc instanceof SingleFieldConstraint) {
+                        SingleFieldConstraint con = (SingleFieldConstraint) fc;
+                        if (con.isBound()) {
+                            result.add( con.fieldBinding );
+                        }
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Checks to see if a variable is used or not, includes fields
+     * as well as facts.
+     */
+    public boolean isVariableNameUsed(String s) {
+        return getAllVariables().contains( s );
+    }
+
+    /**
+     * Returns true if any DSLSentences are used.
+     */
+    public boolean hasDSLSentences() {
+
+        if (this.lhs != null) {
+            for ( int i = 0; i < this.lhs.length; i++ ) {
+                if ( lhs[i] instanceof DSLSentence ) {
+                    return true;
+                }
+            }
+        }
+
+        if (this.rhs != null) {
+            for ( int i = 0; i < this.rhs.length; i++ ) {
+                if ( rhs[i] instanceof DSLSentence ) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+   }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/SingleFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/SingleFieldConstraint.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/SingleFieldConstraint.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.brms.client.modeldriven.brl;
+
+
+/**
+ * This represents a contraint on a fact - involving a SINGLE FIELD.
+ * 
+ * Can also include optional "connective constraints" that extend the options for matches.
+ * @author Michael Neale
+ */
+public class SingleFieldConstraint extends ISingleFieldConstraint implements FieldConstraint {
+
+    public String                 fieldBinding;
+    public String                 fieldName;
+    public String                 operator;
+
+    public ConnectiveConstraint[] connectives;
+
+    public SingleFieldConstraint(final String field) {
+        this.fieldName = field;
+    }
+
+    public SingleFieldConstraint() {
+    }
+
+    /**
+     * This adds a new connective.
+     *
+     */
+    public void addNewConnective() {
+        if ( this.connectives == null ) {
+            this.connectives = new ConnectiveConstraint[]{new ConnectiveConstraint()};
+        } else {
+            final ConnectiveConstraint[] newList = new ConnectiveConstraint[this.connectives.length + 1];
+            for ( int i = 0; i < this.connectives.length; i++ ) {
+                newList[i] = this.connectives[i];
+            }
+            newList[this.connectives.length] = new ConnectiveConstraint();
+            this.connectives = newList;
+        }
+    }
+
+    /**
+     * Returns true of there is a field binding.
+     */
+    public boolean isBound() {
+        if ( this.fieldBinding != null && !"".equals( this.fieldBinding ) ) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/brl/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+<body>
+	This package holds classes that are used as RPC classes for the rule modeller, 
+	as well as the DOM for the BRL rule format that the rule modeller uses.
+	
+	IMPORTANT:
+	Do not change these unless you are adding fields or removing fields, not refactoring
+	fields. Especially if there is existing data. XSLT may need to be used to massage
+	the existing XML to suit the new structure.
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/ExecutionTrace.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/ExecutionTrace.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/ExecutionTrace.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,39 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This contains lists of rules to include in the scenario (or exclude, as the case may be !).
+ * This will be used to filter the rule engines behaviour under test.
+ * @author Michael Neale
+ */
+public class ExecutionTrace implements Fixture {
+
+
+
+	/**
+	 * This is the simulated date - leaving it as null means it will use
+	 * the current time.
+	 */
+	public Date		scenarioSimulatedDate = null;
+
+
+	/**
+	 * The time taken for execution.
+	 */
+	public Long executionTimeResult;
+
+	/**
+	 * This is pretty obvious really. The total firing count of all rules.
+	 */
+	public Long numberOfRulesFired;
+
+	public ExecutionTrace() {}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Expectation.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Expectation.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Expectation.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.brms.client.modeldriven.testing;
+
+
+/**
+ * All assertions on results.
+ *
+ *
+ * @author Michael Neale
+ */
+public interface Expectation extends Fixture {
+
+	/**
+	 * Return false if the assertion
+	 * @return
+	 */
+	boolean wasSuccessful();
+
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FactData.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FactData.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FactData.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,40 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FactData implements Fixture {
+
+	/**
+	 * The type (class)
+	 */
+	public String type;
+
+	/**
+	 * The name of the "variable"
+	 */
+	public String name;
+
+	/**
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.testing.FactData>
+	 */
+	public List fieldData = new ArrayList();
+
+	/**
+	 * If its a modify, obviously we are modifying existing data in working memory.
+	 */
+	public boolean isModify;
+
+	public FactData() {}
+	public FactData(String type, String name, List fieldData, boolean modify) {
+
+		this.type = type;
+		this.name = name;
+		this.fieldData = fieldData;
+		this.isModify = modify;
+
+	}
+
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FieldData.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FieldData.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/FieldData.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
+public class FieldData implements PortableObject {
+
+	/** the name of the field */
+	public String name;
+
+	/** The value of the field to be set to.
+	 * This will either be a literal value (which will be coerced by MVEL).
+	 * Or if it starts with an "=" then it is an EL that will be evaluated to yield a value.
+	 */
+	public String value;
+
+
+	public FieldData() {}
+	public FieldData(String name, String value) {
+		this.name = name;
+		this.value = value;
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Fixture.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Fixture.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Fixture.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
+/**
+ * All test fixtures implement this.
+ */
+public interface Fixture extends PortableObject {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/RetractFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/RetractFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/RetractFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.brms.client.modeldriven.testing;
+
+/**
+ * Retract a named fact.
+ * @author Michael Neale
+ *
+ */
+public class RetractFact implements Fixture {
+
+	public RetractFact() {}
+	public RetractFact(String s) {
+		this.name = s;
+	}
+
+	public String name;
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Scenario.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Scenario.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/Scenario.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,222 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
+/**
+ * This represents a test scenario.
+ * It also encapsulates the result of a scenario run.
+ *
+ * @author Michael Neale
+ */
+public class Scenario implements PortableObject {
+
+	/**
+	 * The maximum number of rules to fire so we don't recurse for ever.
+	 */
+	public int		maxRuleFirings = 100000;
+
+	/**
+	 * global data which must be setup before hand.
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.testing.FactData>
+	 */
+	public List globals = new ArrayList();
+
+	/**
+	 * Fixtures are parts of the test. They may be assertions, globals, data, execution runs etc.
+	 * Anything really.
+	 *
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.testing.Fixture>
+	 */
+	public List fixtures = new ArrayList();
+
+	/**
+	 * This is the date the last time the scenario was run (and what the results apply to).
+	 */
+	public Date lastRunResult;
+
+	/**
+	 * the rules to include or exclude
+	 * @gwt.typeArgs <java.lang.String>
+	 */
+	public List rules = new ArrayList();
+
+	/**
+	 * true if only the rules in the list should be allowed to fire. Otherwise
+	 * it is exclusive (ie all rules can fire BUT the ones in the list).
+	 */
+	public boolean inclusive = false;
+
+
+
+	/**
+	 * Returns true if this was a totally successful scenario, based on the results contained.
+	 */
+	public boolean wasSuccessful() {
+		for (Iterator iterator = fixtures.iterator(); iterator.hasNext();) {
+			Fixture f= (Fixture) iterator.next();
+			if (f instanceof Expectation) {
+				if (! ((Expectation) f ).wasSuccessful()) {
+					return false;
+				}
+			}
+
+		}
+		return true;
+	}
+
+	/**
+	 * Will slip in a fixture after the specified one.
+	 */
+	public void insertAfter(Fixture fix, Fixture toAdd) {
+		if (fix == null) {
+			this.fixtures.add(0, toAdd);
+		} else {
+			fixtures.add( fixtures.indexOf(fix) + 1, toAdd);
+		}
+	}
+
+	/**
+	 * Remove the specified fixture.
+	 */
+	public void removeFixture(Fixture f) {
+		this.fixtures.remove(f);
+		this.globals.remove(f);
+	}
+
+
+	/**
+	 *
+	 * @return A mapping of variable names to their fact type.
+	 */
+	public Map getVariableTypes() {
+		Map m = new HashMap();
+		for (Iterator iterator = fixtures.iterator(); iterator.hasNext();) {
+			Fixture f = (Fixture) iterator.next();
+			if (f instanceof FactData) {
+				FactData fd = (FactData)f;
+				m.put(fd.name, fd.type);
+			}
+		}
+		for (Iterator iterator = globals.iterator(); iterator.hasNext();) {
+			FactData fd = (FactData) iterator.next();
+			m.put(fd.name, fd.type);
+		}
+		return m;
+	}
+
+	/**
+	 * This will return a list of fact names that are in scope (including globals).
+	 * @return List<String>
+	 */
+	public List getFactNamesInScope(ExecutionTrace ex, boolean includeGlobals) {
+		if (ex == null) return new ArrayList();
+		List l = new ArrayList();
+		int p = this.fixtures.indexOf(ex);
+		for (int i = 0; i < p; i++) {
+			Fixture f = (Fixture) fixtures.get(i);
+			if (f instanceof FactData) {
+				FactData fd = (FactData) f;
+				l.add(fd.name);
+			} else if (f instanceof RetractFact) {
+				RetractFact rf = (RetractFact) f;
+				l.remove(rf.name);
+			}
+		}
+
+		if (includeGlobals) {
+			for (Iterator iterator = globals.iterator(); iterator.hasNext();) {
+				FactData f = (FactData) iterator.next();
+				l.add(f.name);
+			}
+		}
+		return l;
+	}
+
+	/**
+	 * @return true iff a fact name is already in use.
+	 */
+	public boolean isFactNameExisting(String factName) {
+		for (Iterator iterator = globals.iterator(); iterator.hasNext();) {
+			FactData fd = (FactData) iterator.next();
+			if (fd.name.equals(factName)) {
+				return true;
+			}
+		}
+		for (Iterator iterator = fixtures.iterator(); iterator.hasNext();) {
+			Fixture f = (Fixture) iterator.next();
+			if (f instanceof FactData) {
+				FactData fd = (FactData) f;
+				if (fd.name.equals(factName)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @return true iff a fact is actually used (ie if its not, its safe to remove it).
+	 */
+	public boolean isFactNameUsed(FactData fd) {
+		int start = this.fixtures.indexOf(fd);
+		for (int i = start + 1; i < fixtures.size(); i++) {
+			Fixture f = (Fixture) fixtures.get(i);
+			if (f instanceof RetractFact) {
+				 if (((RetractFact)f).name.equals(fd.name)) {
+					 return true;
+				 }
+			} else if (f instanceof VerifyFact) {
+				 if (((VerifyFact)f).name.equals(fd.name)) {
+					 return true;
+				 }
+			} else if (f instanceof FactData) {
+				 if (((FactData)f).name.equals(fd.name)) {
+					 return true;
+				 }
+			}
+		}
+		return false;
+	}
+
+
+	/**
+	 *
+	 * @return int[0] = failures, int[1] = total;
+	 */
+	public int[] countFailuresTotal() {
+		int total = 0;
+		int failures = 0;
+		for (Iterator iterator = fixtures.iterator(); iterator.hasNext();) {
+			Fixture f = (Fixture) iterator.next();
+			if (f instanceof VerifyRuleFired) {
+				total++;
+				VerifyRuleFired vr = (VerifyRuleFired) f;
+				if (vr.successResult != null && !vr.successResult.booleanValue()) {
+					failures++;
+				}
+			} else if (f instanceof VerifyFact) {
+				VerifyFact vf = (VerifyFact) f;
+				for (Iterator it = vf.fieldValues.iterator(); it
+						.hasNext();) {
+					VerifyField vfl = (VerifyField) it.next();
+					if (vfl.successResult != null && !vfl.successResult.booleanValue()) {
+						failures++;
+					}
+					total++;
+				}
+			}
+		}
+		return new int[] {failures, total};
+	}
+
+}
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This is for making assertions over a specific facts value/state AFTER execution.
+ * @author Michael Neale
+ *
+ */
+public class VerifyFact implements Expectation {
+
+	/**
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.testing.VerifyField>
+	 */
+	public List fieldValues = new ArrayList();
+	public String name;
+	public String description;
+
+
+	public VerifyFact() {}
+	public VerifyFact(String factName, List fieldValues) {
+		this.name = factName;
+		this.fieldValues = fieldValues;
+	}
+
+
+	public boolean wasSuccessful() {
+		for (int i = 0; i < fieldValues.size(); i++) {
+			VerifyField vf = (VerifyField) fieldValues.get(i);
+			if (! vf.successResult.booleanValue()) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyField.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyField.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyField.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+package org.drools.brms.client.modeldriven.testing;
+
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
+public class VerifyField implements PortableObject {
+
+	public String fieldName;
+	public String expected;
+
+	public String actualResult;
+	public Boolean successResult;
+
+	/**
+	 * This is a natural language explanation of the outcome for reporting purposes.
+	 */
+	public String explanation;
+
+	/**
+	 * Operator is generally "==" or "!="  - an MVEL operator.
+	 */
+	public String operator = "==";
+
+	public VerifyField() {}
+
+	public VerifyField(String fieldName, String expected, String operator) {
+		this.fieldName = fieldName;
+		this.expected = expected;
+		this.operator = operator;
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyRuleFired.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyRuleFired.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/modeldriven/testing/VerifyRuleFired.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+package org.drools.brms.client.modeldriven.testing;
+
+public class VerifyRuleFired implements Expectation {
+
+	public String ruleName;
+	public Integer expectedCount;
+
+	/**
+	 * This is a natural language explanation of this verification.
+	 * For reporting purposes.
+	 */
+	public String explanation;
+
+	/**
+	 * If this is true, then we expect it to fire at least once.
+	 * False means it should not fire at all (this is an alternative
+	 * to specifying an expected count).
+	 */
+	public Boolean expectedFire;
+
+
+	public VerifyRuleFired() {}
+	public VerifyRuleFired(String ruleName, Integer expectedCount, Boolean expectedFire) {
+		this.ruleName = ruleName;
+		this.expectedCount = expectedCount;
+		this.expectedFire = expectedFire;
+	}
+
+	public Boolean successResult;
+	public Integer actualResult;
+
+
+	public boolean wasSuccessful() {
+		return successResult.booleanValue();
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/client/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+<body>
+This package and subpackages are for items pertinent to the BRMS, that are kept in this module for re-usability.
+Items in this package and subpackage must be compilable via GWT to Javascript, which means a subset of java. 
+Generally, you won't need to look in this package.
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+<body>
+	This package has some server utilities that are used by the BRMS and IDE.
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/ClassWalker.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/ClassWalker.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/ClassWalker.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,139 @@
+package org.drools.brms.server.rules;
+/*
+ * Copyright 2007 Mark Derricutt
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+
+/**
+ * This is a utility to walk a tree of classes (recursively) and return a set
+ * of classes that match a package name.
+ *
+ * This is not currently used, as I can't work out a way to make it work including the dynamically added stuff into the MapBackedClassloader
+ * (ie classes added in memory only). It requires some more surgery to cope with this. Was worth a try though !
+ * (can be wired into the loadClass method of the SuggestionCompletionLoader).
+ *
+ * @author Mark Derricutt
+ * @author Michael Neale
+ */
+public class ClassWalker {
+
+
+    public static Set<Class> findClassesInPackage(String packageName, ClassLoader loader) {
+
+        Set<Class> acceptedClasses = new HashSet<Class>();
+
+        try {
+            String packageOnly = packageName;
+            boolean recursive = false;
+            if (packageName.endsWith(".*")) {
+                packageOnly = packageName.substring(0, packageName.lastIndexOf(".*"));
+                recursive = true;
+            }
+
+            String packageDirName = packageOnly.replace('.', '/');
+            Enumeration<URL> dirs = loader.getResources(packageDirName);
+
+            while (dirs.hasMoreElements()) {
+                URL url = dirs.nextElement();
+                if ("file".equals(url.getProtocol())) {
+                    findClassesInDirPackage(packageOnly,
+                            URLDecoder.decode(url.getFile(), "UTF-8"),
+                            recursive, acceptedClasses, loader
+                    );
+                } else if ("jar".equals(url.getProtocol())) {
+                    JarFile jar = ((JarURLConnection) url.openConnection()).getJarFile();
+
+                    Enumeration<JarEntry> entries = jar.entries();
+                    while (entries.hasMoreElements()) {
+                        JarEntry entry = entries.nextElement();
+                        String name = entry.getName();
+
+                        if (!name.endsWith("/")) {
+                            String className = name.replaceAll("/", ".").replaceAll("\\.class", "");
+                            checkValidClass(className, acceptedClasses, loader);
+                        }
+                    }
+                }
+
+
+            }
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        return acceptedClasses;
+
+
+    }
+
+    private static void checkValidClass(String className, Set<Class> acceptedClasses, ClassLoader loader) {
+        try {
+            Class classClass = loader.loadClass(className);
+
+
+                acceptedClasses.add(classClass);
+
+
+        } catch (ClassNotFoundException e) {
+            // e.printStackTrace();
+        } catch (NoClassDefFoundError e) {
+            //
+        }
+    }
+
+    private static void findClassesInDirPackage(String packageName,
+                                                String packagePath,
+                                                final boolean recursive,
+                                                Set<Class> classes, ClassLoader loader) {
+        File dir = new File(packagePath);
+
+        if (!dir.exists() || !dir.isDirectory()) {
+            return;
+        }
+
+        File[] dirfiles = dir.listFiles(new FileFilter() {
+            public boolean accept(File file) {
+                return (recursive && file.isDirectory()) || (file.getName().endsWith(".class"));
+            }
+        });
+
+        for (File file : dirfiles) {
+            if (file.isDirectory()) {
+                findClassesInDirPackage(packageName + "." + file.getName(),
+                        file.getAbsolutePath(),
+                        recursive,
+                        classes, loader);
+            } else {
+                String className = file.getName().substring(0, file.getName().length() - 6);
+                checkValidClass(packageName + "." + className, classes, loader);
+            }
+        }
+    }
+
+
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/SuggestionCompletionLoader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/SuggestionCompletionLoader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/rules/SuggestionCompletionLoader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,464 @@
+package org.drools.brms.server.rules;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.drools.base.ClassTypeResolver;
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.server.util.DataEnumLoader;
+import org.drools.brms.server.util.SuggestionCompletionEngineBuilder;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.ParserError;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FieldTemplateDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.dsl.DSLMapping;
+import org.drools.lang.dsl.DSLMappingEntry;
+import org.drools.lang.dsl.DSLMappingFile;
+import org.drools.rule.MapBackedClassLoader;
+import org.drools.util.asm.ClassFieldInspector;
+
+/**
+ * This utility class loads suggestion completion stuff for the package
+ * configuration, introspecting from models, templates etc.
+ *
+ * This also includes DSL stuff, basically, everything you need to get started
+ * with a package. It also validates the package configuration, and can provide
+ * errors.
+ *
+ * This does NOT validate assets in the package, other then to load up DSLs,
+ * models etc as needed.
+ *
+ * FYI: the tests for this are in the BRMS module, in context of a full BRMS.
+ *
+ * @author Michael Neale
+ *
+ */
+public class SuggestionCompletionLoader {
+
+    private final SuggestionCompletionEngineBuilder builder = new SuggestionCompletionEngineBuilder();
+
+    private final DrlParser                         parser  = new DrlParser();
+
+    private final MapBackedClassLoader              loader;
+
+    protected List                                  errors  = new ArrayList();
+
+    // iterating over the import list
+    final ClassTypeResolver                         resolver;
+
+    /**
+     * This uses the current classes classloader as a base, and jars can be
+     * added.
+     */
+    public SuggestionCompletionLoader() {
+        this( null );
+    }
+
+    /**
+     * This allows a pre existing classloader to be used (and preferred) for
+     * resolving types.
+     */
+    public SuggestionCompletionLoader(ClassLoader classLoader) {
+        if ( classLoader == null ) {
+            classLoader = Thread.currentThread().getContextClassLoader();
+            if ( classLoader == null ) {
+                classLoader = this.getClass().getClassLoader();
+            }
+        }
+        this.loader = new MapBackedClassLoader( classLoader );
+        this.resolver = new ClassTypeResolver( new HashSet(),
+                                               this.loader );
+    }
+
+    /**
+     * This will validate, and generate a new engine, ready to go. If there are
+     * errors, you can get them by doing getErrors();
+     *
+     * @param header
+     *            The package configuration file content.
+     * @param jars
+     *            a list of jars to look inside (pass in empty array if not
+     *            needed) this is a list of {@link JarInputStream}
+     * @param dsls
+     *            any dsl files. This is a list of {@link DSLMappingFile}.
+     * @return A SuggestionCompletionEngine ready to be used in anger.
+     */
+    public SuggestionCompletionEngine getSuggestionEngine(final String header,
+                                                          final List jars,
+                                                          final List dsls) {
+        return this.getSuggestionEngine( header, jars, dsls, Collections.EMPTY_LIST );
+    }
+
+
+    /**
+     * This will validate, and generate a new engine, ready to go. If there are
+     * errors, you can get them by doing getErrors();
+     *
+     * @param header
+     *            The package configuration file content.
+     * @param jars
+     *            a list of jars to look inside (pass in empty array if not
+     *            needed) this is a list of {@link JarInputStream}
+     * @param dsls
+     *            any dsl files. This is a list of {@link DSLMappingFile}.
+     * @param dataEnums
+     *            this is a list of String's which hold data enum definitions.
+     *             (normally will be just one, but for completeness can load multiple).
+     * @return A SuggestionCompletionEngine ready to be used in anger.
+     */
+    public SuggestionCompletionEngine getSuggestionEngine(final String header,
+                                                          final List jars,
+                                                          final List dsls,
+                                                          final List dataEnums) {
+        this.builder.newCompletionEngine();
+
+        if ( !header.trim().equals( "" ) ) {
+            processPackageHeader( header,
+                                  jars );
+        }
+
+        // populating DSL sentences
+        this.populateDSLSentences( dsls );
+
+
+
+        SuggestionCompletionEngine sce = this.builder.getInstance();
+
+        populateDateEnums( dataEnums, sce );
+
+        Arrays.sort(sce.factTypes);
+
+        return sce;
+    }
+
+    private void populateDateEnums(List dataEnums, SuggestionCompletionEngine sce) {
+        for ( Iterator iter = dataEnums.iterator(); iter.hasNext(); ) {
+            String enumFile = (String) iter.next();
+            DataEnumLoader enumLoader = new DataEnumLoader(enumFile);
+            if (enumLoader.hasErrors()) {
+                this.errors.addAll( enumLoader.getErrors() );
+            } else {
+                sce.dataEnumLists.putAll( enumLoader.getData() );
+            }
+        }
+
+    }
+
+    private void processPackageHeader(final String header,
+                                      final List jars) {
+        // get fact types from imports
+        PackageDescr pkgDescr;
+        try {
+            pkgDescr = this.parser.parse( header );
+        } catch ( final DroolsParserException e1 ) {
+            throw new IllegalStateException( "Serious error, unable to validate package." );
+        }
+
+        if ( this.parser.hasErrors() ) {
+            for ( final Iterator iter = this.parser.getErrors().iterator(); iter.hasNext(); ) {
+                final ParserError element = (ParserError) iter.next();
+                this.errors.add( element.getMessage() );
+            }
+        }
+        // populating information for the model itself
+        this.populateModelInfo( pkgDescr,
+                                jars );
+
+        // populating globals
+        this.populateGlobalInfo( pkgDescr,
+                                 jars );
+
+    }
+
+    /**
+     * @param pkg
+     * @param errors
+     */
+    private void populateDSLSentences(final List dsls) {
+        // AssetItemIterator it = pkg.listAssetsByFormat( new
+        // String[]{AssetFormats.DSL} );
+        // while ( it.hasNext() ) {
+        // AssetItem item = (AssetItem) it.next();
+        // String dslData = item.getContent();
+        // DSLMappingFile file = new DSLMappingFile();
+        // try {
+        // if ( file.parseAndLoad( new StringReader( dslData ) ) ) {
+        // DSLMapping mapping = file.getMapping();
+        // for ( Iterator entries = mapping.getEntries().iterator();
+        // entries.hasNext(); ) {
+        // DSLMappingEntry entry = (DSLMappingEntry) entries.next();
+        // if (entry.getSection() == DSLMappingEntry.CONDITION) {
+        // builder.addDSLConditionSentence( entry.getMappingKey() );
+        // } else if (entry.getSection() == DSLMappingEntry.CONSEQUENCE) {
+        // builder.addDSLActionSentence( entry.getMappingKey() );
+        // }
+        //
+        // }
+        // } else {
+        // errors.add( file.getErrors().toString() );
+        // }
+        // } catch ( IOException e ) {
+        // errors.add( "Error while loading DSL language configuration : " +
+        // item.getBinaryContentAttachmentFileName() + " error message: " +
+        // e.getMessage() );
+        // }
+        // }
+
+        for ( final Iterator it = dsls.iterator(); it.hasNext(); ) {
+            final DSLMappingFile file = (DSLMappingFile) it.next();
+            final DSLMapping mapping = file.getMapping();
+            for ( final Iterator entries = mapping.getEntries().iterator(); entries.hasNext(); ) {
+                final DSLMappingEntry entry = (DSLMappingEntry) entries.next();
+                if ( entry.getSection() == DSLMappingEntry.CONDITION ) {
+                    this.builder.addDSLConditionSentence( entry.getMappingKey() );
+                } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) {
+                    this.builder.addDSLActionSentence( entry.getMappingKey() );
+                }
+            }
+        }
+
+    }
+
+    /**
+     * Populate the global stuff.
+     */
+    private void populateGlobalInfo(final PackageDescr pkgDescr,
+                                    final List jars) {
+
+        // populating information for the globals
+        for ( final Iterator it = pkgDescr.getGlobals().iterator(); it.hasNext(); ) {
+            final GlobalDescr global = (GlobalDescr) it.next();
+            try {
+                final String shortTypeName = getShortNameOfClass(global.getType());
+                if ( !this.builder.hasFieldsForType( shortTypeName ) ) {
+                    final Class clazz = loadClass( global.getType(),
+                                                   jars );
+                    loadClassFields( clazz,
+                                     shortTypeName );
+
+                    this.builder.addGlobalType( global.getIdentifier(),
+                                                shortTypeName );
+                }
+
+                this.builder.addGlobalType( global.getIdentifier(),
+                                            shortTypeName );
+            } catch ( final IOException e ) {
+                this.errors.add( "Error while inspecting class for global: " + global.getType() + " error message: " + e.getMessage() );
+            }
+
+        }
+    }
+
+    /**
+     * Populate the fact type data.
+     */
+    private void populateModelInfo(final PackageDescr pkgDescr,
+                                   final List jars) {
+        for ( final Iterator it = pkgDescr.getImports().iterator(); it.hasNext(); ) {
+            final ImportDescr imp = (ImportDescr) it.next();
+            final String className = imp.getTarget();
+            resolver.addImport( className );
+
+            final Class clazz = loadClass( className,
+                                           jars );
+
+            if ( clazz != null ) {
+                try {
+                    final String shortTypeName = getShortNameOfClass( clazz.getName() );
+                    loadClassFields( clazz,
+                                     shortTypeName );
+                    this.builder.addFactType( shortTypeName );
+                } catch ( final IOException e ) {
+                    this.errors.add( "Error while inspecting the class: " + className + ". The error was: " + e.getMessage() );
+                } catch (NoClassDefFoundError e) {
+                	this.errors.add( "Unable to find the class: " + e.getMessage().replace('/', '.') + " which is required by: " + className + ". You may need to add more classes to the model.");
+                }
+            }
+        }
+
+        // iterating over templates
+        populateFactTemplateTypes( pkgDescr,
+                                   resolver );
+    }
+
+    /**
+     * Iterates over fact templates and add them to the model definition
+     *
+     * @param pkgDescr
+     */
+    private void populateFactTemplateTypes(final PackageDescr pkgDescr,
+                                           final ClassTypeResolver resolver) {
+        for ( final Iterator it = pkgDescr.getFactTemplates().iterator(); it.hasNext(); ) {
+            final FactTemplateDescr templ = (FactTemplateDescr) it.next();
+            final String factType = templ.getName();
+            this.builder.addFactType( factType );
+
+            final String[] fields = new String[templ.getFields().size()];
+
+
+            int index = 0;
+            for ( final Iterator fieldsIt = templ.getFields().iterator(); fieldsIt.hasNext(); ) {
+                final FieldTemplateDescr fieldDescr = (FieldTemplateDescr) fieldsIt.next();
+                fields[index++] = fieldDescr.getName();
+                final String fieldType = fieldDescr.getClassType();
+
+                Class fieldTypeClass = null;
+                try {
+                    fieldTypeClass = resolver.resolveType( fieldType );
+                } catch ( final ClassNotFoundException e ) {
+                    this.errors.add( "Fact template field type not found: " + fieldType );
+                }
+                this.builder.addFieldType( factType + "." + fieldDescr.getName(),
+                                           getFieldType( fieldTypeClass ) );
+            }
+
+            Arrays.sort(fields);
+            this.builder.addFieldsForType( factType,
+                    fields );
+
+        }
+    }
+
+    private Class loadClass(String className,
+                            List jars) {
+        Class clazz = null;
+        try {
+            clazz = resolver.resolveType( className );
+        } catch ( ClassNotFoundException e1 ) {
+            try {
+                addJars( jars );
+                clazz = resolver.resolveType( className );
+            } catch ( Exception e ) {
+                this.errors.add( "Class not found: " + className );
+            }
+        }
+        return clazz;
+    }
+
+    private void loadClassFields(final Class clazz,
+                                 final String shortTypeName) throws IOException {
+        if ( clazz == null ) {
+            return;
+        }
+        final ClassFieldInspector inspector = new ClassFieldInspector( clazz );
+        String[] fields = (String[]) inspector.getFieldNames().keySet().toArray( new String[inspector.getFieldNames().size()] );
+        Arrays.sort(fields);
+
+        fields = removeIrrelevantFields( fields );
+
+        this.builder.addFieldsForType( shortTypeName,
+                                       fields );
+        for ( int i = 0; i < fields.length; i++ ) {
+            final Class type = (Class) inspector.getFieldTypes().get( fields[i] );
+            final String fieldType = getFieldType( type );
+            this.builder.addFieldType( shortTypeName + "." + fields[i],
+                                       fieldType );
+        }
+    }
+
+    String getShortNameOfClass(final String clazz) {
+        return clazz.substring( clazz.lastIndexOf( '.' ) + 1 );
+    }
+
+    /**
+     * This will remove the unneeded "fields" that come from java.lang.Object
+     * these are really not needed for the modeller.
+     */
+    String[] removeIrrelevantFields(final String[] fields) {
+        final List result = new ArrayList();
+        for ( int i = 0; i < fields.length; i++ ) {
+            final String field = fields[i];
+            if ( field.equals( "class" ) || field.equals( "hashCode" ) || field.equals( "toString" ) ) {
+                // ignore
+            } else {
+                result.add( field );
+            }
+        }
+        return (String[]) result.toArray( new String[result.size()] );
+    }
+
+    /**
+     * This will add the given jars to the classloader.
+     */
+    private void addJars(final List jars) throws IOException {
+        for ( final Iterator it = jars.iterator(); it.hasNext(); ) {
+            final JarInputStream jis = (JarInputStream) it.next();
+            JarEntry entry = null;
+            final byte[] buf = new byte[1024];
+            int len = 0;
+            while ( (entry = jis.getNextJarEntry()) != null ) {
+                if ( !entry.isDirectory() ) {
+                    final ByteArrayOutputStream out = new ByteArrayOutputStream();
+                    while ( (len = jis.read( buf )) >= 0 ) {
+                        out.write( buf,
+                                   0,
+                                   len );
+                    }
+                    this.loader.addResource( entry.getName(),
+                                             out.toByteArray() );
+                }
+            }
+
+        }
+    }
+
+    /**
+     * @param inspector
+     * @param fields
+     * @param i
+     * @return
+     */
+    private String getFieldType(final Class type) {
+        String fieldType = null; // if null, will use standard operators
+        if ( type != null ) {
+            if ( type.isPrimitive() && (type != boolean.class) ) {
+                fieldType = SuggestionCompletionEngine.TYPE_NUMERIC;
+            } else if ( Number.class.isAssignableFrom( type ) ) {
+                fieldType = SuggestionCompletionEngine.TYPE_NUMERIC;
+            } else if ( String.class.isAssignableFrom( type ) ) {
+                fieldType = SuggestionCompletionEngine.TYPE_STRING;
+            } else if ( Collection.class.isAssignableFrom( type ) ) {
+                fieldType = SuggestionCompletionEngine.TYPE_COLLECTION;
+            } else if ( Boolean.class.isAssignableFrom( type ) || boolean.class.isAssignableFrom( type )) {
+                fieldType = SuggestionCompletionEngine.TYPE_BOOLEAN;
+            } else if ( Comparable.class.isAssignableFrom( type ) ) {
+                fieldType = SuggestionCompletionEngine.TYPE_COMPARABLE;
+            } /*else if ( Date.class.isAssignableFrom( type )) {
+                fieldType = SuggestionCompletionEngine.TYPE_DATE; MN: wait until we support it.
+
+            }*/ else {
+                fieldType = SuggestionCompletionEngine.TYPE_OBJECT;
+            }
+        }
+        return fieldType;
+    }
+
+    /**
+     * @return true if there were errors when processing the package.
+     */
+    public boolean hasErrors() {
+        return (this.errors.size() > 0);
+    }
+
+    /**
+     * Returns a list of String errors.
+     */
+    public List getErrors() {
+        return this.errors;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRDRLPersistence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRDRLPersistence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRDRLPersistence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,437 @@
+package org.drools.brms.server.util;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionInsertLogicalFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.ActionUpdateField;
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.ConnectiveConstraint;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.FieldConstraint;
+import org.drools.brms.client.modeldriven.brl.IAction;
+import org.drools.brms.client.modeldriven.brl.IPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+import org.drools.util.ReflectiveVisitor;
+
+/**
+ * This class persists the rule model to DRL and back
+ *
+ * @author etirelli
+ */
+public class BRDRLPersistence
+    implements
+    BRLPersistence {
+
+    private static final BRLPersistence INSTANCE = new BRDRLPersistence();
+
+    private BRDRLPersistence() {
+    }
+
+    public static BRLPersistence getInstance() {
+        return INSTANCE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.brms.server.util.BRLPersistence#marshal(org.drools.brms.client.modeldriven.brl.RuleModel)
+     */
+    public String marshal(RuleModel model) {
+        boolean isDSLEnhanced = model.hasDSLSentences();
+
+
+        StringBuffer buf = new StringBuffer();
+        buf.append( "rule \"" + model.name + "\"\n" );
+        this.marshalAttributes( buf,
+                                model );
+        buf.append( "\twhen\n" );
+        this.marshalLHS( buf,
+                         model,
+                         isDSLEnhanced );
+        buf.append( "\tthen\n" );
+        this.marshalRHS( buf,
+                         model,
+                         isDSLEnhanced );
+        buf.append( "end\n" );
+        return buf.toString();
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.brms.server.util.BRLPersistence#unmarshal(java.lang.String)
+     */
+    public RuleModel unmarshal(String str) {
+        throw new UnsupportedOperationException("Still not possible to convert pure DRL to RuleModel");
+    }
+
+    /**
+     * Marshal model attributes
+     *
+     * @param buf
+     * @param model
+     */
+    private void marshalAttributes(StringBuffer buf,
+                                   RuleModel model) {
+        boolean hasDialect = false;
+        for ( int i = 0; i < model.attributes.length; i++ ) {
+            RuleAttribute attr = model.attributes[i];
+
+            buf.append( "\t" );
+            buf.append( attr );
+
+            buf.append( "\n" );
+            if (attr.attributeName.equals( "dialect" )) {
+                hasDialect = true;
+            }
+        }
+//Un comment below for mvel
+        if (!hasDialect) {
+            RuleAttribute attr = new RuleAttribute("dialect", "mvel");
+            buf.append( "\t" );
+            buf.append( attr );
+            buf.append( "\n" );
+        }
+    }
+
+    /**
+     * Marshal LHS patterns
+     *
+     * @param buf
+     * @param model
+     */
+    private void marshalLHS(StringBuffer buf,
+                            RuleModel model,
+                            boolean isDSLEnhanced) {
+        IPattern[] lhs = model.lhs;
+        LHSPatternVisitor visitor = new LHSPatternVisitor( isDSLEnhanced,
+                                                           buf );
+        for ( int i = 0; i < lhs.length; i++ ) {
+            final IPattern cond = lhs[i];
+            visitor.visit( cond );
+        }
+    }
+
+    private void marshalRHS(StringBuffer buf,
+                            RuleModel model,
+                            boolean isDSLEnhanced) {
+        IAction[] rhs = model.rhs;
+        RHSActionVisitor visitor = new RHSActionVisitor( isDSLEnhanced,
+                                                         buf );
+        for ( int i = 0; i < rhs.length; i++ ) {
+            final IAction action = rhs[i];
+            visitor.visit( action );
+        }
+    }
+
+    public static class LHSPatternVisitor extends ReflectiveVisitor {
+        private StringBuffer buf;
+        private boolean      isDSLEnhanced;
+
+        public LHSPatternVisitor(boolean isDSLEnhanced,
+                                 StringBuffer b) {
+            this.isDSLEnhanced = isDSLEnhanced;
+            buf = b;
+        }
+
+        public void visitFactPattern(FactPattern pattern) {
+            buf.append( "\t\t" );
+            if ( isDSLEnhanced ) {
+                // adding passthrough markup
+                buf.append( ">" );
+            }
+            generateFactPattern( pattern );
+            buf.append( "\n" );
+        }
+
+        public void visitCompositeFactPattern(CompositeFactPattern pattern) {
+            buf.append( "\t\t" );
+            if ( isDSLEnhanced ) {
+                // adding passthrough markup
+                buf.append( ">" );
+            }
+            if ( CompositeFactPattern.COMPOSITE_TYPE_EXISTS.equals( pattern.type ) ) {
+                renderCompositeFOL(pattern);
+            } else if ( CompositeFactPattern.COMPOSITE_TYPE_NOT.equals( pattern.type ) ) {
+                renderCompositeFOL(pattern);
+            } else if ( CompositeFactPattern.COMPOSITE_TYPE_OR.equals( pattern.type ) ) {
+                buf.append( "( " );
+                if (pattern.patterns != null ) {
+                    for ( int i = 0; i < pattern.patterns.length; i++ ) {
+                        if ( i > 0 ) {
+                            buf.append( " " );
+                            buf.append( pattern.type );
+                            buf.append( " " );
+                        }
+                        renderSubPattern( pattern, i );
+                    }
+                }
+                buf.append( " )\n" );
+            }
+        }
+
+		private void renderCompositeFOL(CompositeFactPattern pattern) {
+			buf.append( pattern.type );
+			if (pattern.patterns != null && pattern.patterns.length > 1) {
+				buf.append(" (");
+				for (int i = 0; i < pattern.patterns.length; i++) {
+					renderSubPattern(pattern, i);
+					if (i != pattern.patterns.length -1) {
+						buf.append(" and ");
+					}
+				}
+				buf.append(") \n");
+			} else {
+				buf.append( " " );
+				renderSubPattern( pattern, 0 );
+				buf.append( "\n" );
+			}
+		}
+
+        private void renderSubPattern(CompositeFactPattern pattern, int subIndex) {
+            if (pattern.patterns == null || pattern.patterns.length == 0) return;
+            this.generateFactPattern( pattern.patterns[subIndex] );
+        }
+
+        public void visitDSLSentence(final DSLSentence sentence) {
+            buf.append( "\t\t" );
+            buf.append( sentence.toString() );
+            buf.append( "\n" );
+        }
+
+        private void generateFactPattern(FactPattern pattern) {
+            if ( pattern.boundName != null ) {
+                buf.append( pattern.boundName );
+                buf.append( " : " );
+            }
+            if ( pattern.factType != null ) {
+                buf.append( pattern.factType );
+            }
+            buf.append( "( " );
+
+            //top level constraints
+            if (pattern.constraintList != null) {
+                generateConstraints( pattern );
+            }
+            buf.append( ")" );
+        }
+
+        private void generateConstraints(FactPattern pattern) {
+            for ( int i = 0; i < pattern.getFieldConstraints().length; i++ ) {
+                if ( i > 0 ) {
+                    buf.append( ", " );
+                }
+                generateConstraint( pattern.constraintList.constraints[i], false );
+            }
+        }
+
+        /**
+         * Recursively process the nested constraints.
+         * It will only put brackets in for the ones that aren't at top level.
+         * This makes for more readable DRL in the most common cases.
+         */
+        private void generateConstraint(FieldConstraint con, boolean nested) {
+            if (con instanceof CompositeFieldConstraint) {
+                CompositeFieldConstraint cfc = (CompositeFieldConstraint) con;
+                if (nested) buf.append( "( " );
+                FieldConstraint[] nestedConstraints = cfc.constraints;
+                if (nestedConstraints != null) {
+                    for ( int i = 0; i < nestedConstraints.length; i++ ) {
+                        generateConstraint( nestedConstraints[i] , true);
+                        if (i < (nestedConstraints.length - 1)) {
+                            //buf.append(" ) ");
+                            buf.append( cfc.compositeJunctionType + " ");
+                            //buf.append(" ( ");
+                        }
+                    }
+                }
+                if (nested) buf.append( ")" );
+            } else {
+                generateSingleFieldConstraint( (SingleFieldConstraint) con );
+            }
+        }
+
+        private void generateSingleFieldConstraint(final SingleFieldConstraint constr) {
+            if ( constr.constraintValueType == ISingleFieldConstraint.TYPE_PREDICATE ) {
+                buf.append( "eval( " );
+                buf.append( constr.value );
+                buf.append( " )" );
+            } else {
+                if ( constr.fieldBinding != null ) {
+                    buf.append( constr.fieldBinding );
+                    buf.append( " : " );
+                }
+                if ((constr.operator != null && constr.value != null)
+                        || constr.fieldBinding != null) {
+                    buf.append( constr.fieldName );
+                }
+
+                addFieldRestriction( buf,
+                                     constr.constraintValueType,
+                                     constr.operator,
+                                     constr.value );
+
+                //and now do the connectives.
+                if ( constr.connectives != null ) {
+                    for ( int j = 0; j < constr.connectives.length; j++ ) {
+                        final ConnectiveConstraint conn = constr.connectives[j];
+                        addFieldRestriction( buf,
+                                             conn.constraintValueType,
+                                             conn.operator,
+                                             conn.value );
+                    }
+                }
+            }
+        }
+
+        /**
+         * @param constr
+         * @param constrDescr
+         */
+        private void addFieldRestriction(final StringBuffer buf,
+                                         final int type,
+                                         final String operator,
+                                         final String value) {
+            if (operator == null) {
+                return;
+            }
+
+            buf.append( " " );
+            buf.append( operator );
+            buf.append( " " );
+            switch ( type ) {
+                case ISingleFieldConstraint.TYPE_RET_VALUE :
+                    buf.append( "( " );
+                    buf.append( value );
+                    buf.append( " )" );
+                    break;
+                case ISingleFieldConstraint.TYPE_LITERAL :
+                    buf.append( '"' );
+                    buf.append( value );
+                    buf.append( '"' );
+                    break;
+                default :
+                    buf.append( value );
+            }
+            buf.append( " " );
+        }
+
+    }
+
+    public static class RHSActionVisitor extends ReflectiveVisitor {
+        private StringBuffer buf;
+        private boolean isDSLEnhanced;
+        private int          idx = 0;
+
+        public RHSActionVisitor(boolean isDSLEnhanced, StringBuffer b) {
+            this.isDSLEnhanced = isDSLEnhanced;
+            buf = b;
+        }
+
+        public void visitActionInsertFact(final ActionInsertFact action) {
+            this.generateInsertCall( action,
+                                     false );
+        }
+
+        public void visitActionInsertLogicalFact(final ActionInsertLogicalFact action) {
+            this.generateInsertCall( action,
+                                     true );
+        }
+
+        private void generateInsertCall(final ActionInsertFact action,
+                                        final boolean isLogic) {
+            buf.append( "\t\t" );
+            if( isDSLEnhanced ) {
+                buf.append( ">" );
+            }
+            if ( action.fieldValues.length == 0 ) {
+                buf.append( "insert( new " );
+                buf.append( action.factType );
+                buf.append( "() );\n" );
+            } else {
+                buf.append( action.factType );
+                buf.append( " fact" );
+                buf.append( idx );
+                buf.append( " = new " );
+                buf.append( action.factType );
+                buf.append( "();\n" );
+                generateSetMethodCalls( "fact" + idx,
+                                        action.fieldValues );
+                buf.append( "\t\t" );
+                if (isDSLEnhanced) {
+                    buf.append( ">" );
+                }
+                if ( isLogic ) {
+                    buf.append( "insertLogical( fact" );
+                } else {
+                    buf.append( "insert( fact" );
+                }
+                buf.append( idx++ );
+                buf.append( " );\n" );
+            }
+        }
+
+        public void visitActionUpdateField(final ActionUpdateField action) {
+            this.visitActionSetField( action );
+            buf.append( "\t\t" );
+            if( isDSLEnhanced ) {
+                buf.append( ">" );
+            }
+            buf.append( "update( " );
+            buf.append( action.variable );
+            buf.append( " );\n" );
+        }
+
+        public void visitActionRetractFact(final ActionRetractFact action) {
+            buf.append( "\t\t" );
+            if( isDSLEnhanced ) {
+                buf.append( ">" );
+            }
+            buf.append( "retract( " );
+            buf.append( action.variableName );
+            buf.append( " );\n" );
+        }
+
+        public void visitDSLSentence(final DSLSentence sentence) {
+            buf.append( "\t\t" );
+            buf.append( sentence.toString() );
+            buf.append( "\n" );
+        }
+
+        public void visitActionSetField(final ActionSetField action) {
+            this.generateSetMethodCalls( action.variable,
+                                         action.fieldValues );
+        }
+
+        private void generateSetMethodCalls(final String variableName,
+                                            final ActionFieldValue[] fieldValues) {
+            for ( int i = 0; i < fieldValues.length; i++ ) {
+                buf.append( "\t\t" );
+                if( isDSLEnhanced ) {
+                    buf.append( ">" );
+                }
+                buf.append( variableName );
+                buf.append( ".set" );
+                buf.append( Character.toUpperCase( fieldValues[i].field.charAt( 0 ) ) );
+                buf.append( fieldValues[i].field.substring( 1 ) );
+                buf.append( "( " );
+                if ( fieldValues[i].isFormula() ) {
+                    buf.append( fieldValues[i].value.substring( 1 ) );
+                } else if( SuggestionCompletionEngine.TYPE_STRING.equals( fieldValues[i].type ) ) {
+                    buf.append( "\"" );
+                    buf.append( fieldValues[i].value );
+                    buf.append( "\"" );
+                } else {
+                    buf.append( fieldValues[i].value );
+                }
+                buf.append( " );\n" );
+            }
+        }
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRLPersistence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRLPersistence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRLPersistence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.brms.server.util;
+
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+
+public interface BRLPersistence {
+
+    public String marshal(final RuleModel model);
+    public RuleModel unmarshal(final String str);
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRXMLPersistence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRXMLPersistence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/BRXMLPersistence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,94 @@
+package org.drools.brms.server.util;
+
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionInsertLogicalFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.ActionUpdateField;
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.ConnectiveConstraint;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+/**
+ * This class persists the rule model to XML and back.
+ * 
+ * This is the 'brl' xml format (Business Rule Language).
+ * 
+ * @author Michael Neale
+ */
+public class BRXMLPersistence implements BRLPersistence {
+
+    private XStream                     xt;
+    private static final BRLPersistence INSTANCE = new BRXMLPersistence();
+
+    private BRXMLPersistence() {
+        this.xt = new XStream( new DomDriver() );
+
+        this.xt.alias( "rule",
+                  RuleModel.class );
+        this.xt.alias( "fact",
+                  FactPattern.class );
+        this.xt.alias( "retract",
+                  ActionRetractFact.class );
+        this.xt.alias( "assert",
+                  ActionInsertFact.class );
+        this.xt.alias( "modify",
+                  ActionUpdateField.class );
+        this.xt.alias( "setField",
+                  ActionSetField.class );
+        this.xt.alias( "dslSentence",
+                  DSLSentence.class );
+        this.xt.alias( "compositePattern",
+                  CompositeFactPattern.class );
+        this.xt.alias( "attribute",
+                  RuleAttribute.class );
+
+        this.xt.alias( "fieldValue",
+                  ActionFieldValue.class );
+        this.xt.alias( "connectiveConstraint",
+                  ConnectiveConstraint.class );
+        this.xt.alias( "fieldConstraint",
+                  SingleFieldConstraint.class );
+
+        this.xt.alias( "compositeConstraint", 
+                       CompositeFieldConstraint.class );
+        
+        this.xt.alias( "assertLogical",
+                  ActionInsertLogicalFact.class );
+
+    }
+
+    public static BRLPersistence getInstance() {
+        return INSTANCE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.brms.server.util.BRLPersistence#toXML(org.drools.brms.client.modeldriven.brl.RuleModel)
+     */
+    public String marshal(final RuleModel model) {
+        return this.xt.toXML( model );
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.brms.server.util.BRLPersistence#toModel(java.lang.String)
+     */
+    public RuleModel unmarshal(final String xml) {
+        if ( xml == null ) {
+            return new RuleModel();
+        }
+        if ( xml.trim().equals( "" ) ) {
+            return new RuleModel();
+        }
+        return (RuleModel) this.xt.fromXML( xml );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/DataEnumLoader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/DataEnumLoader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/DataEnumLoader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,122 @@
+package org.drools.brms.server.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.mvel.MVEL;
+
+/**
+ * Use mvel to load up map/list of valid items for fields - used by the Guided rule editor.
+ */
+public class DataEnumLoader {
+
+	private final List errors;
+	private final Map data;
+
+	/**
+	 * This is the source of the asset, which is an MVEL map (minus the outer "[") of course.
+	 */
+	public DataEnumLoader(String mvelSource) {
+		errors = new ArrayList();
+		this.data = loadEnum(mvelSource);
+	}
+
+	private Map loadEnum(String mvelSource) {
+
+        if (mvelSource == null || (mvelSource.trim().equals( "" ))) {
+            return Collections.EMPTY_MAP;
+        }
+        if (mvelSource.startsWith("=")) {
+        	mvelSource = mvelSource.substring(1);
+        } else {
+        	mvelSource = "[ " + addCommasForNewLines(mvelSource) + " ]";
+        }
+		final Object mvelData;
+		try {
+			mvelData = MVEL.eval(mvelSource, new HashMap());
+		} catch (RuntimeException e) {
+			addError("Unable to load enumeration data.");
+			addError(e.getMessage());
+			addError("Error type: " + e.getClass().getName());
+			return Collections.EMPTY_MAP;
+		}
+		if (!(mvelData instanceof Map)) {
+			addError("The expression is not a map, it is a " + mvelData.getClass().getName());
+			return Collections.EMPTY_MAP;
+		}
+		Map map = (Map) mvelData;
+        Map newMap = new HashMap();
+		for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
+			String key = (String) iter.next();
+			Object list = map.get(key);
+			if (!(list instanceof List)) {
+				if (list == null) {
+					addError("The item with " + key + " is null.");
+				} else {
+					addError("The item with " + key + " is not a list, it is a " + list.getClass().getName());
+				}
+				return Collections.EMPTY_MAP;
+			}
+			List items = (List) list;
+			String[] newItems = new String[items.size()];
+			for (int i = 0; i < items.size(); i++) {
+				Object listItem = items.get(i);
+				if (!(listItem instanceof String)) {
+					newItems[i] = listItem.toString();
+				} else {
+					newItems[i] = (String) listItem;
+				}
+			}
+			newMap.put(key, newItems);
+		}
+		return newMap;
+	}
+
+	public static String addCommasForNewLines(String mvelSource) {
+        StringTokenizer st = new StringTokenizer(mvelSource, "\r\n");
+        StringBuffer buf = new StringBuffer();
+        while(st.hasMoreTokens()) {
+            String line = st.nextToken().trim();
+            if (st.hasMoreTokens() && line.endsWith( "," )) {
+                buf.append( line );
+            } else {
+                buf.append( line );
+                if (st.hasMoreTokens()) {
+                    buf.append( "," );
+                }
+            }
+            if (st.hasMoreTokens()) {
+                buf.append( "\n" );
+            }
+        }
+        return buf.toString();
+    }
+
+    private void addError(String string) {
+		this.errors.add(string);
+	}
+
+	/**
+	 * Return a list of any errors found.
+	 */
+	public List getErrors() {
+		return this.errors;
+	}
+
+    public boolean hasErrors() {
+        return this.errors.size() > 0;
+    }
+
+	/**
+	 * Return the map of Fact.field to List (of Strings).
+	 */
+	public Map getData() {
+		return this.data;
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/ScenarioXMLPersistence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/ScenarioXMLPersistence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/ScenarioXMLPersistence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,57 @@
+package org.drools.brms.server.util;
+
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.Expectation;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.Fixture;
+import org.drools.brms.client.modeldriven.testing.RetractFact;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+
+/**
+ * Persists the scenario model.
+ * @author Michael Neale
+ */
+public class ScenarioXMLPersistence {
+
+    private XStream                     xt;
+    private static final ScenarioXMLPersistence INSTANCE = new ScenarioXMLPersistence();
+
+    private ScenarioXMLPersistence() {
+    	xt = new XStream(new DomDriver());
+    	xt.alias("scenario", Scenario.class);
+    	xt.alias("execution-trace", ExecutionTrace.class);
+    	xt.alias("expectation", Expectation.class);
+    	xt.alias("fact-data", FactData.class);
+    	xt.alias("field-data", FieldData.class);
+    	xt.alias("fixture", Fixture.class);
+    	xt.alias("retract-fact", RetractFact.class);
+    	xt.alias("expect-fact", VerifyFact.class);
+    	xt.alias("expect-field", VerifyField.class);
+    	xt.alias("expect-rule", VerifyRuleFired.class);
+    }
+
+    public static ScenarioXMLPersistence getInstance() {
+    	return INSTANCE;
+    }
+
+
+
+    public String marshal(Scenario sc) {
+    	return xt.toXML(sc);
+    }
+
+    public Scenario unmarshal(String xml) {
+    	if (xml == null) return new Scenario();
+    	if (xml.trim().equals("")) return new Scenario();
+    	return (Scenario) xt.fromXML(xml);
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.brms.server.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+
+/**
+ * A builder to incrementally populate a SuggestionCompletionEngine
+ *
+ * @author etirelli
+ */
+public class SuggestionCompletionEngineBuilder {
+
+    private SuggestionCompletionEngine instance              = new SuggestionCompletionEngine();
+    private List                       factTypes             = new ArrayList();
+    private Map                        fieldsForType         = new HashMap();
+    private Map                        fieldTypes            = new HashMap();
+    private Map                        globalTypes           = new HashMap();
+    private List                       actionDSLSentences    = new ArrayList();
+    private List                       conditionDSLSentences = new ArrayList();
+
+    public SuggestionCompletionEngineBuilder() {
+    }
+
+    /**
+     * Start the creation of a new SuggestionCompletionEngine
+     */
+    public void newCompletionEngine() {
+        this.instance = new SuggestionCompletionEngine();
+        this.factTypes = new ArrayList();
+        this.fieldsForType = new HashMap();
+        this.fieldTypes = new HashMap();
+        this.globalTypes = new HashMap();
+        this.actionDSLSentences = new ArrayList();
+        this.conditionDSLSentences = new ArrayList();
+    }
+
+    /**
+     * Adds a fact type to the engine
+     *
+     * @param factType
+     */
+    public void addFactType(final String factType) {
+        this.factTypes.add( factType );
+    }
+
+    /**
+     * Adds the list of fields for a given type
+     *
+     * @param type
+     * @param fields
+     */
+    public void addFieldsForType(final String type,
+                                 final String[] fields) {
+        this.fieldsForType.put( type,
+                                fields );
+    }
+
+    /**
+     * @return true if this has the type already registered (field information).
+     */
+    public boolean hasFieldsForType(final String type) {
+        return this.fieldsForType.containsKey( type );
+    }
+
+    /**
+     * Adds a type declaration for a field
+     *
+     * @param field
+     * @param type
+     */
+    public void addFieldType(final String field,
+                             final String type) {
+        this.fieldTypes.put( field,
+                             type );
+    }
+
+    /**
+     * Adds a global and its corresponding type to the engine
+     *
+     * @param global
+     * @param type
+     */
+    public void addGlobalType(final String global,
+                              final String type) {
+        this.globalTypes.put( global,
+                              type );
+    }
+
+    /**
+     * Add a DSL sentence for an action.
+     */
+    public void addDSLActionSentence(final String sentence) {
+        final DSLSentence sen = new DSLSentence();
+        sen.sentence = sentence;
+        this.actionDSLSentences.add( sen );
+    }
+
+    /**
+     * Add a DSL sentence for a condition.
+     */
+    public void addDSLConditionSentence(final String sentence) {
+        final DSLSentence sen = new DSLSentence();
+        sen.sentence = sentence;
+        this.conditionDSLSentences.add( sen );
+    }
+
+    /**
+     * Returns a SuggestionCompletionEngine instance populated with
+     * all the data since last call to newCompletionEngine() method
+     *
+     * @return
+     */
+    public SuggestionCompletionEngine getInstance() {
+        this.instance.factTypes = (String[]) this.factTypes.toArray( new String[this.factTypes.size()] );
+        this.instance.fieldsForType = this.fieldsForType;
+        this.instance.fieldTypes = this.fieldTypes;
+        this.instance.globalTypes = this.globalTypes;
+        this.instance.actionDSLSentences = (DSLSentence[]) this.actionDSLSentences.toArray( new DSLSentence[this.actionDSLSentences.size()] );
+        this.instance.conditionDSLSentences = (DSLSentence[]) this.conditionDSLSentences.toArray( new DSLSentence[this.conditionDSLSentences.size()] );
+        return this.instance;
+    }
+
+
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblemHandler;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+
+
+/**
+ * Base class for compiler implementations. Provides just a few
+ * convenience methods.
+ * 
+ * @author tcurdt
+ */
+public abstract class AbstractJavaCompiler implements JavaCompiler {
+
+    protected CompilationProblemHandler problemHandler;
+
+    public void setCompilationProblemHandler( final CompilationProblemHandler pHandler ) {
+        problemHandler = pHandler;
+    }
+
+    public CompilationResult compile( final String[] pClazzNames, final ResourceReader pReader, final ResourceStore pStore ) {
+
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+        if (classLoader == null) {
+            classLoader = this.getClass().getClassLoader();
+        }
+
+        return compile(pClazzNames, pReader, pStore, classLoader, createDefaultSettings());
+    }
+
+    public CompilationResult compile( final String[] pClazzNames, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader ) {
+        return compile(pClazzNames, pReader, pStore, pClassLoader, createDefaultSettings());
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.drools.commons.jci.problems.CompilationProblem;
+
+/**
+ * A CompilationResult represents the result of a compilation.
+ * It includes errors (which failed the compilation) or warnings
+ * (that can be ignored and do not affect the creation of the
+ * class files)
+ * 
+ * @author tcurdt
+ */
+public final class CompilationResult {
+    
+    private final CompilationProblem[] errors;
+    private final CompilationProblem[] warnings;
+        
+    public CompilationResult( final CompilationProblem[] pProblems ) {
+        final Collection errorsColl = new ArrayList();
+        final Collection warningsColl = new ArrayList();
+
+        for (int i = 0; i < pProblems.length; i++) {
+            final CompilationProblem problem = pProblems[i];
+            if (problem.isError()) {
+                errorsColl.add(problem);
+            } else {
+                warningsColl.add(problem);
+            }
+        }
+        
+        errors = new CompilationProblem[errorsColl.size()];
+        errorsColl.toArray(errors);
+
+        warnings = new CompilationProblem[warningsColl.size()];
+        warningsColl.toArray(warnings);
+    }
+    
+    public CompilationProblem[] getErrors() {
+    	final CompilationProblem[] res = new CompilationProblem[errors.length];
+    	System.arraycopy(errors, 0, res, 0, res.length);
+        return res;
+    }
+
+    public CompilationProblem[] getWarnings() {
+    	final CompilationProblem[] res = new CompilationProblem[warnings.length];
+    	System.arraycopy(warnings, 0, res, 0, res.length);
+        return res;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.eclipse.jdt.core.compiler.IProblem;
+
+/**
+ * Wrapping an Eclipse compiler problem
+ * 
+ * @author tcurdt
+ */
+public final class EclipseCompilationProblem implements CompilationProblem {
+
+    private final IProblem problem;
+
+    public EclipseCompilationProblem(final IProblem pProblem) {
+        problem = pProblem;
+    }
+
+    public boolean isError() {
+        return problem.isError();
+    }
+
+    public String getFileName() {
+        return new String(problem.getOriginatingFileName());
+    }
+
+    public int getStartLine() {
+        return problem.getSourceLineNumber();
+    }
+
+    public int getStartColumn() {
+        return problem.getSourceStart();
+    }
+
+    public int getEndLine() {
+        return getStartLine();
+    }
+
+    public int getEndColumn() {
+        return problem.getSourceEnd();
+    }
+
+    public String getMessage() {
+        return problem.getMessage();
+    }
+
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append(getFileName()).append(" (");
+        sb.append(getStartLine());
+        sb.append(":");
+        sb.append(getStartColumn());
+        sb.append(") : ");
+        sb.append(getMessage());
+        return sb.toString();
+    }
+
+    public int getId() {
+        return problem.getID();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.commons.jci.compilers;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.drools.util.ClassUtils;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ClassFile;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
+import org.eclipse.jdt.internal.compiler.IProblemFactory;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+
+/**
+ * Eclipse compiler implemenation
+ * 
+ * @author tcurdt
+ */
+public final class EclipseJavaCompiler extends AbstractJavaCompiler {
+
+    private final EclipseJavaCompilerSettings defaultSettings;
+
+    public EclipseJavaCompiler() {
+        this(new EclipseJavaCompilerSettings());
+    }
+
+    public EclipseJavaCompiler( final Map pSettings ) {
+        defaultSettings = new EclipseJavaCompilerSettings(pSettings);
+    }
+
+    public EclipseJavaCompiler( final EclipseJavaCompilerSettings pSettings ) {
+        defaultSettings = pSettings;
+    }
+
+    final class CompilationUnit implements ICompilationUnit {
+
+        final private String clazzName;
+        final private String fileName;
+        final private char[] typeName;
+        final private char[][] packageName;
+        final private ResourceReader reader;
+
+        CompilationUnit( final ResourceReader pReader, final String pSourceFile ) {
+            reader = pReader;
+            clazzName = ClassUtils.convertResourceToClassName(pSourceFile);
+            fileName = pSourceFile;
+            int dot = clazzName.lastIndexOf('.');
+            if (dot > 0) {
+                typeName = clazzName.substring(dot + 1).toCharArray();
+            } else {
+                typeName = clazzName.toCharArray();
+            }
+            
+            final StringTokenizer izer = new StringTokenizer(clazzName, ".");
+            packageName = new char[izer.countTokens() - 1][];
+            for (int i = 0; i < packageName.length; i++) {
+                packageName[i] = izer.nextToken().toCharArray();
+            }
+        }
+
+        public char[] getFileName() {
+            return fileName.toCharArray();
+        }
+
+        public char[] getContents() {
+            final byte[] content = reader.getBytes(fileName);
+
+            if (content == null) {
+                return null;
+                //throw new RuntimeException("resource " + fileName + " could not be found");
+            }
+
+            return new String(content).toCharArray();
+        }
+
+        public char[] getMainTypeName() {
+            return typeName;
+        }
+
+        public char[][] getPackageName() {
+            return packageName;
+        }
+    }
+
+    
+    public org.drools.commons.jci.compilers.CompilationResult compile(
+            final String[] pSourceFiles,
+            final ResourceReader pReader,
+            final ResourceStore pStore,
+            final ClassLoader pClassLoader,
+            final JavaCompilerSettings pSettings
+            ) {
+
+        final Map settingsMap = new EclipseJavaCompilerSettings(pSettings).toNativeSettings();
+        
+        final Collection problems = new ArrayList();
+        
+        final ICompilationUnit[] compilationUnits = new ICompilationUnit[pSourceFiles.length];
+        for (int i = 0; i < compilationUnits.length; i++) {
+            final String sourceFile = pSourceFiles[i];
+            
+            if (pReader.isAvailable(sourceFile)) {            
+                compilationUnits[i] = new CompilationUnit(pReader, sourceFile);
+            } else {
+                // log.error("source not found " + sourceFile);
+
+                final CompilationProblem problem = new CompilationProblem() {
+
+                    public int getEndColumn() {
+                        return 0;
+                    }
+
+                    public int getEndLine() {
+                        return 0;
+                    }
+
+                    public String getFileName() {
+                        return sourceFile;
+                    }
+
+                    public String getMessage() {
+                        return "Source " + sourceFile + " could not be found";
+                    }
+
+                    public int getStartColumn() {
+                        return 0;
+                    }
+
+                    public int getStartLine() {
+                        return 0;
+                    }
+
+                    public boolean isError() {
+                        return true;
+                    }
+                    
+                    public String toString() {
+                        return getMessage();
+                    }
+                };
+
+                if (problemHandler != null) {
+                    problemHandler.handle(problem);
+                }
+                
+                problems.add(problem);
+            }
+        }
+
+        if (problems.size() > 0) {
+            final CompilationProblem[] result = new CompilationProblem[problems.size()];
+            problems.toArray(result);
+            return new org.drools.commons.jci.compilers.CompilationResult(result);
+        }
+        
+        final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
+        final IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
+        final INameEnvironment nameEnvironment = new INameEnvironment() {
+
+            public NameEnvironmentAnswer findType( final char[][] pCompoundTypeName ) {
+                final StringBuffer result = new StringBuffer();
+                for (int i = 0; i < pCompoundTypeName.length; i++) {
+                    if (i != 0) {
+                        result.append('.');
+                    }
+                    result.append(pCompoundTypeName[i]);
+                }
+
+                //log.debug("finding compoundTypeName=" + result.toString());
+
+                return findType(result.toString());
+            }
+
+            public NameEnvironmentAnswer findType( final char[] pTypeName, final char[][] pPackageName ) {
+                final StringBuffer result = new StringBuffer();
+                for (int i = 0; i < pPackageName.length; i++) {
+                    result.append(pPackageName[i]);
+                    result.append('.');
+                }
+                
+//                log.debug("finding typeName=" + new String(typeName) + " packageName=" + result.toString());
+
+                result.append(pTypeName);
+                return findType(result.toString());
+            }
+
+            private NameEnvironmentAnswer findType( final String pClazzName ) {
+                
+                if (isPackage(pClazzName)) {
+                    return null;
+                }                
+                
+                final String resourceName = ClassUtils.convertClassToResourcePath(pClazzName);
+                
+                final byte[] clazzBytes = pStore.read(pClazzName);
+                if (clazzBytes != null) {
+                    final char[] fileName = pClazzName.toCharArray();
+                    try {
+                        final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
+                        return new NameEnvironmentAnswer(classFileReader, null);
+                    } catch (final ClassFormatException e) {
+                        throw new RuntimeException( "ClassFormatException in loading class '" + fileName + "' with JCI." );
+                    }
+                }
+                
+                
+                final InputStream is = pClassLoader.getResourceAsStream(resourceName);
+                if (is == null) {
+                    return null;
+                }
+
+                final byte[] buffer = new byte[8192];
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length);
+                int count;
+                try {
+                    while ((count = is.read(buffer, 0, buffer.length)) > 0) {
+                        baos.write(buffer, 0, count);
+                    }
+                    baos.flush();
+                    final char[] fileName = pClazzName.toCharArray();
+                    final ClassFileReader classFileReader = new ClassFileReader(baos.toByteArray(), fileName, true);
+                    return new NameEnvironmentAnswer(classFileReader, null);
+                } catch ( final IOException e ) {
+                    throw new RuntimeException( "could not read class",
+                                                e );
+                } catch ( final ClassFormatException e ) {
+                    throw new RuntimeException( "wrong class format",
+                                                e );
+                } finally {
+                    try {
+                        baos.close();
+                    } catch ( final IOException oe ) {
+                        throw new RuntimeException( "could not close output stream",
+                                                    oe );
+                    }
+                    try {
+                        is.close();
+                    } catch ( final IOException ie ) {
+                        throw new RuntimeException( "could not close input stream",
+                                                    ie );
+                    }
+                }
+            }
+
+            private boolean isPackage( final String pClazzName ) {
+                
+                final InputStream is = pClassLoader.getResourceAsStream(ClassUtils.convertClassToResourcePath(pClazzName));
+                if (is != null) {
+                    return false;
+                }
+                
+                // FIXME: this should not be tied to the extension
+                final String source = pClazzName.replace('.', '/') + ".java";
+                if (pReader.isAvailable(source)) {
+                    return false;
+                }
+                
+                return true;
+            }
+
+            public boolean isPackage( char[][] parentPackageName, char[] pPackageName ) {
+                final StringBuffer result = new StringBuffer();
+                if (parentPackageName != null) {
+                    for (int i = 0; i < parentPackageName.length; i++) {
+                        if (i != 0) {
+                            result.append('.');
+                        }
+                        result.append(parentPackageName[i]);
+                    }
+                }
+                
+//                log.debug("isPackage parentPackageName=" + result.toString() + " packageName=" + new String(packageName));
+                
+                if (parentPackageName != null && parentPackageName.length > 0) {
+                    result.append('.');
+                }
+                result.append(pPackageName);
+                return isPackage(result.toString());
+            }
+
+            public void cleanup() {
+            }
+        };
+
+        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
+            public void acceptResult( final CompilationResult pResult ) {
+                if (pResult.hasProblems()) {
+                    final IProblem[] iproblems = pResult.getProblems();
+                    for (int i = 0; i < iproblems.length; i++) {
+                        final IProblem iproblem = iproblems[i];
+                        final CompilationProblem problem = new EclipseCompilationProblem(iproblem); 
+                        if (problemHandler != null) {
+                            problemHandler.handle(problem);
+                        }
+                        problems.add(problem);
+                    }
+                }
+                if (!pResult.hasErrors()) {
+                    final ClassFile[] clazzFiles = pResult.getClassFiles();
+                    for (int i = 0; i < clazzFiles.length; i++) {
+                        final ClassFile clazzFile = clazzFiles[i];
+                        final char[][] compoundName = clazzFile.getCompoundName();
+                        final StringBuffer clazzName = new StringBuffer();
+                        for (int j = 0; j < compoundName.length; j++) {
+                            if (j != 0) {
+                                clazzName.append('.');
+                            }
+                            clazzName.append(compoundName[j]);
+                        }
+                        pStore.write(clazzName.toString().replace('.', '/') + ".class", clazzFile.getBytes());
+                    }
+                }
+            }
+        };
+
+        final Compiler compiler = new Compiler(nameEnvironment, policy, settingsMap, compilerRequestor, problemFactory, false);
+
+        compiler.compile(compilationUnits);
+
+        final CompilationProblem[] result = new CompilationProblem[problems.size()];
+        problems.toArray(result);
+        return new org.drools.commons.jci.compilers.CompilationResult(result);
+    }
+
+    public JavaCompilerSettings createDefaultSettings() {
+        return this.defaultSettings;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+/**
+ * Native Eclipse compiler settings
+ * 
+ * @author tcurdt
+ */
+public final class EclipseJavaCompilerSettings extends JavaCompilerSettings {
+
+    final private Map defaultEclipseSettings = new HashMap();
+
+    public EclipseJavaCompilerSettings() {
+        defaultEclipseSettings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
+        defaultEclipseSettings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
+        defaultEclipseSettings.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
+        defaultEclipseSettings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
+    }
+    
+    public EclipseJavaCompilerSettings( final JavaCompilerSettings pSettings ) {
+    	super(pSettings);
+    	
+    	if (pSettings instanceof EclipseJavaCompilerSettings) {
+    		defaultEclipseSettings.putAll(((EclipseJavaCompilerSettings)pSettings).toNativeSettings());
+    	}
+    }
+    
+    public EclipseJavaCompilerSettings( final Map pMap ) {
+        defaultEclipseSettings.putAll(pMap);
+    }
+
+    private static Map nativeVersions = new HashMap() {
+		private static final long serialVersionUID = 1L;
+	{
+    	put("1.1", CompilerOptions.VERSION_1_1);
+    	put("1.2", CompilerOptions.VERSION_1_2);
+    	put("1.3", CompilerOptions.VERSION_1_3);
+    	put("1.4", CompilerOptions.VERSION_1_4);
+    	put("1.5", CompilerOptions.VERSION_1_5);
+    	put("1.6", CompilerOptions.VERSION_1_6);
+    }};
+    
+    private String toNativeVersion( final String pVersion ) {
+    	final String nativeVersion = (String) nativeVersions.get(pVersion);
+    	
+    	if (nativeVersion == null) {
+    		throw new RuntimeException("unknown version " + pVersion);
+    	}
+    	
+    	return nativeVersion;
+    }
+    
+    Map toNativeSettings() {
+        final Map map = new HashMap(defaultEclipseSettings);
+
+        map.put(CompilerOptions.OPTION_SuppressWarnings, isWarnings()?CompilerOptions.GENERATE:CompilerOptions.DO_NOT_GENERATE);
+        map.put(CompilerOptions.OPTION_ReportDeprecation, isDeprecations()?CompilerOptions.GENERATE:CompilerOptions.DO_NOT_GENERATE);
+        map.put(CompilerOptions.OPTION_TargetPlatform, toNativeVersion(getTargetVersion()));
+        map.put(CompilerOptions.OPTION_Source, toNativeVersion(getSourceVersion()));
+        map.put(CompilerOptions.OPTION_Encoding, getSourceEncoding());
+
+        return map;
+    }
+    
+    public String toString() {
+        return toNativeSettings().toString();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import org.codehaus.janino.Location;
+import org.codehaus.janino.Scanner.LocatedException;
+import org.drools.commons.jci.problems.CompilationProblem;
+
+/**
+ * Janino version of a CompilationProblem
+ * 
+ * @author tcurdt
+ */
+public final class JaninoCompilationProblem implements CompilationProblem {
+
+    private final Location location;
+    private final String fileName;
+    private final String message;
+    private final boolean error;
+
+    public JaninoCompilationProblem(final LocatedException pLocatedException) {
+        this(pLocatedException.getLocation(), pLocatedException.getMessage(), true);
+    }
+
+    public JaninoCompilationProblem(final Location pLocation, final String pMessage, final boolean pError) {
+      this(pLocation.getFileName(), pLocation, pMessage, pError);
+    }
+
+    public JaninoCompilationProblem(final String pFilename, final String pMessage, final boolean pError) {
+        this(pFilename, null, pMessage, pError);
+    }
+
+    public JaninoCompilationProblem(final String pFilename, final Location pLocation, final String pMessage, final boolean pError) {
+        location = pLocation;
+        fileName = pFilename;
+        message = pMessage;
+        error = pError;
+    }
+
+    public boolean isError() {
+        return error;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public int getStartLine() {
+        if (location == null) {
+            return 0;
+        }
+        return location.getLineNumber();
+    }
+
+    public int getStartColumn() {
+        if (location == null) {
+            return 0;
+        }
+        return location.getColumnNumber();
+    }
+
+    public int getEndLine() {
+        return getStartLine();
+    }
+
+    public int getEndColumn() {
+        return getStartColumn();
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append(getFileName()).append(" (");
+        sb.append(getStartLine());
+        sb.append(":");
+        sb.append(getStartColumn());
+        sb.append(") : ");
+        sb.append(getMessage());
+        return sb.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.codehaus.janino.ClassLoaderIClassLoader;
+import org.codehaus.janino.CompileException;
+import org.codehaus.janino.Compiler;
+import org.codehaus.janino.DebuggingInformation;
+import org.codehaus.janino.FilterWarningHandler;
+import org.codehaus.janino.Location;
+import org.codehaus.janino.WarningHandler;
+import org.codehaus.janino.Parser.ParseException;
+import org.codehaus.janino.Scanner.ScanException;
+import org.codehaus.janino.UnitCompiler.ErrorHandler;
+import org.codehaus.janino.util.StringPattern;
+import org.codehaus.janino.util.resource.Resource;
+import org.codehaus.janino.util.resource.ResourceCreator;
+import org.codehaus.janino.util.resource.ResourceFinder;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+
+/**
+ * @author tcurdt
+ */
+public final class JaninoJavaCompiler extends AbstractJavaCompiler {
+
+    private final JaninoJavaCompilerSettings defaultSettings;
+
+    public JaninoJavaCompiler() {
+    	this(new JaninoJavaCompilerSettings());
+    }
+    
+    public JaninoJavaCompiler( final JaninoJavaCompilerSettings pSettings ) {
+    	defaultSettings = pSettings;
+    }
+    
+    private final static class JciResource implements Resource {
+
+    	private final String name;
+    	private final byte[] bytes;
+    	
+    	public JciResource( final String pName, final byte[] pBytes ) {
+    		name = pName;
+    		bytes = pBytes;
+    	}
+    	
+		public String getFileName() {
+			return name;
+		}
+
+		public long lastModified() {
+			return 0;
+		}
+
+		public InputStream open() throws IOException {
+			return new ByteArrayInputStream(bytes);
+		}
+    }
+
+    private final class JciOutputStream extends ByteArrayOutputStream {
+
+    	private final String name;
+    	private final ResourceStore store;
+
+    	public JciOutputStream( final String pName, final ResourceStore pStore ) {
+    		name = pName;
+    		store = pStore;
+    	}
+
+		public void close() throws IOException {
+			super.close();
+
+			final byte[] bytes = toByteArray();		
+
+			store.write(name, bytes);
+		}
+    }
+    
+    public CompilationResult compile( final String[] pSourceNames, final ResourceReader pResourceReader, final ResourceStore pStore, final ClassLoader pClassLoader, final JavaCompilerSettings pSettings ) {
+
+    	final Collection problems = new ArrayList();
+    	
+    	final StringPattern[] pattern = StringPattern.PATTERNS_NONE;
+
+    	final Compiler compiler = new Compiler(
+    			new ResourceFinder() {
+					public Resource findResource( final String pSourceName ) {
+						final byte[] bytes = pResourceReader.getBytes(pSourceName);
+						
+						if (bytes == null) {
+							return null;
+						}						
+						
+						return new JciResource(pSourceName, bytes);
+					}    		
+    			},
+    			new ClassLoaderIClassLoader(pClassLoader),
+    			new ResourceFinder() {
+					public Resource findResource( final String pResourceName ) {
+						final byte[] bytes = pStore.read(pResourceName);
+						
+						if (bytes == null) {
+							return null;
+						}
+						
+						return new JciResource(pResourceName, bytes);
+					}    		
+    			},
+    			new ResourceCreator() {
+					public OutputStream createResource( final String pResourceName ) throws IOException {
+						return new JciOutputStream(pResourceName, pStore);
+					}
+
+					public boolean deleteResource( final String pResourceName ) {
+						pStore.remove(pResourceName);
+						return true;
+					}    				
+    			},
+    			pSettings.getSourceEncoding(),
+    			false,
+    			pSettings.isDebug()?DebuggingInformation.ALL:DebuggingInformation.NONE,
+    			new FilterWarningHandler(pattern, new WarningHandler() {
+						public void handleWarning( final String pHandle, final String pMessage, final Location pLocation ) {
+							final CompilationProblem problem = new JaninoCompilationProblem(pLocation.getFileName(), pLocation, pMessage, false);
+							if (problemHandler != null) {
+								problemHandler.handle(problem);
+							}
+							problems.add(problem);
+						}    		
+			    	})    			
+    			);            	
+    	
+    	compiler.setCompileErrorHandler(new ErrorHandler() {
+			public void handleError( final String pMessage, final Location pLocation ) throws CompileException {
+				final CompilationProblem problem = new JaninoCompilationProblem(pLocation.getFileName(), pLocation, pMessage, true);
+				if (problemHandler != null) {
+					problemHandler.handle(problem);
+				}
+				problems.add(problem);
+			}
+    	});
+    	
+
+    	final Resource[] resources = new Resource[pSourceNames.length];
+        for (int i = 0; i < pSourceNames.length; i++) {
+            final byte[] source = pResourceReader.getBytes(pSourceNames[i]);
+            resources[i] = new JciResource(pSourceNames[i], source);
+        }
+        try {
+            compiler.compile(resources);
+        } catch ( ScanException e ) {
+            problems.add(new JaninoCompilationProblem(e));
+        } catch ( ParseException e ) {
+            problems.add(new JaninoCompilationProblem(e));
+        } catch ( IOException e ) {
+            // I'm hoping the existing compiler problems handler catches these            
+        } catch ( CompileException e ) {
+            // I'm hoping the existing compiler problems handler catches these
+        }
+        
+        final CompilationProblem[] result = new CompilationProblem[problems.size()];
+        problems.toArray(result);
+        return new CompilationResult(result);
+    }
+
+    public JavaCompilerSettings createDefaultSettings() {
+        return this.defaultSettings;
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+public final class JaninoJavaCompilerSettings extends JavaCompilerSettings {
+    // TODO: implement the native janino compiler settings
+
+	public JaninoJavaCompilerSettings() {
+		
+	}
+
+	public JaninoJavaCompilerSettings( final JaninoJavaCompilerSettings pSettings ) {
+		super(pSettings);		
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblemHandler;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+
+
+/**
+ * The general compiler interface. All compilers implementing
+ * this interface should read the resources from the reader
+ * and store the java class files into the ResourceStore.
+ * 
+ * The actual compilation language does not matter. But the
+ * contract is that the result of the compilation will be a
+ * class file.
+ * 
+ * If possible the compiler should notify the optional
+ * CompilationProblemHandler as soon as a problem is found.
+ * 
+ * @author tcurdt
+ */
+public interface JavaCompiler {
+
+    /**
+     * Set the the handler that gets the notification of an error
+     * or warning as soon as this information is available from
+     * the compiler.
+     * Note: Some compilers might not support this feature.
+     * 
+     * @param pHandler
+     */
+    void setCompilationProblemHandler( final CompilationProblemHandler pHandler );
+
+    /**
+     * factory method to create the underlying default settings
+     */
+    JavaCompilerSettings createDefaultSettings();
+    
+    /**
+     * uses the default compiler settings and the current classloader
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore );
+
+    /**
+     * uses the default compiler settings
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader );
+
+    /**
+     * Compiles the java resources "some/path/to/MyJava.java"
+     * read through the ResourceReader and then stores the resulting
+     * classes in the ResourceStore under "some/path/to/MyJava.class".
+     * Note: As these are resource path you always have to use "/" 
+     * 
+     * The result of the compilation run including detailed error
+     * information is returned as CompilationResult. If you need to
+     * get notified already during the compilation process you can
+     * register a CompilationProblemHandler.
+     * Note: Not all compilers might support this notification mechanism.
+     * 
+     * @param pResourcePaths
+     * @param pReader
+     * @param pStore
+     * @param pClassLoader
+     * @param pSettings
+     * @return always a CompilationResult
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader, final JavaCompilerSettings pSettings );
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.util.ClassUtils;
+
+
+/**
+ * Creates JavaCompilers
+ * 
+ * TODO use META-INF discovery mechanism
+ * 
+ * @author tcurdt
+ */
+public final class JavaCompilerFactory {
+
+    /**
+     * @deprecated will be remove after the next release, please create an instance yourself
+     */
+    private static final JavaCompilerFactory INSTANCE = new JavaCompilerFactory();
+
+    private final Map classCache = new HashMap();
+    
+    /**
+     * @deprecated will be remove after the next release, please create an instance yourself
+     */
+    public static JavaCompilerFactory getInstance() {
+        return JavaCompilerFactory.INSTANCE;
+    }
+
+    /**
+     * Tries to guess the class name by convention. So for compilers
+     * following the naming convention
+     * 
+     *   org.apache.commons.jci.compilers.SomeJavaCompiler
+     *   
+     * you can use the short-hands "some"/"Some"/"SOME". Otherwise
+     * you have to provide the full class name. The compiler is
+     * getting instanciated via (cached) reflection.
+     * 
+     * @param pHint
+     * @return JavaCompiler or null
+     */
+    public JavaCompiler createCompiler(final String pHint) {
+        
+        final String className;
+        if (pHint.indexOf('.') < 0) {
+            className = "org.drools.commons.jci.compilers." + ClassUtils.toJavaCasing(pHint) + "JavaCompiler";
+        } else {
+            className = pHint;
+        }
+        
+        Class clazz = (Class) classCache.get(className);
+        
+        if (clazz == null) {
+            try {
+                clazz = Class.forName(className);
+                classCache.put(className, clazz);
+            } catch (ClassNotFoundException e) {
+                clazz = null;
+            }
+        }
+
+        if (clazz == null) {
+            return null;
+        }
+        
+        try {
+            return (JavaCompiler) clazz.newInstance();
+        } catch (Throwable t) {
+            return null;
+        }
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.compilers;
+
+
+
+/**
+ * Most common denominator for JavaCompiler settings.
+ * 
+ * If you need more specific settings you have to provide
+ * the native compiler configurations to the compilers.
+ * Writing of a custom factory is suggested. 
+ * 
+ * @author tcurdt
+ */
+public class JavaCompilerSettings {
+
+    private String targetVersion = "1.4";
+    private String sourceVersion = "1.4";
+    private String sourceEncoding = "UTF-8";
+    private boolean warnings = false;
+    private boolean deprecations = false;
+    private boolean debug = false;
+
+    /** @deprecated */
+    private boolean verbose = false;
+
+    public JavaCompilerSettings() {    	
+    }
+    
+    public JavaCompilerSettings( final JavaCompilerSettings pSettings ) {
+    	targetVersion = pSettings.targetVersion;
+    	sourceVersion = pSettings.sourceVersion;
+    	sourceEncoding = pSettings.sourceEncoding;
+    	warnings = pSettings.warnings;
+    	deprecations = pSettings.deprecations;
+    	debug = pSettings.debug;
+    }
+    
+    public void setTargetVersion( final String pTargetVersion ) {
+        targetVersion = pTargetVersion;
+    }
+
+    public String getTargetVersion() {
+        return targetVersion;
+    }
+
+
+    public void setSourceVersion( final String pSourceVersion ) {
+        sourceVersion = pSourceVersion;
+    }
+
+    public String getSourceVersion() {
+        return sourceVersion;
+    }
+
+
+    public void setSourceEncoding( final String pSourceEncoding ) {
+        sourceEncoding = pSourceEncoding;
+    }
+
+    public String getSourceEncoding() {
+        return sourceEncoding;
+    }
+
+
+    public void setWarnings( final boolean pWarnings ) {
+        warnings = pWarnings;
+    }
+
+    public boolean isWarnings() {
+        return warnings;
+    }
+
+
+    public void setDeprecations( final boolean pDeprecations )  {
+        deprecations = pDeprecations;
+    }
+
+    public boolean isDeprecations() {
+        return deprecations;
+    }
+
+    public void setDebug( final boolean pDebug )  {
+        debug = pDebug;
+    }
+
+    public boolean isDebug() {
+        return debug;
+    }
+
+    /** @deprecated */
+    public void setVerbose( final boolean pVerbose ) {
+        verbose = pVerbose;
+    }
+
+    /** @deprecated */
+    public boolean isVerbose() {
+        return verbose;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.problems;
+
+/**
+ * An abstract definition of a compilation problem
+ * 
+ * @author tcurdt
+ */
+public interface CompilationProblem {
+
+    /**
+     * is the problem an error and compilation cannot continue
+     * or just a warning and compilation can proceed
+     * 
+     * @return
+     */
+    boolean isError();
+
+    /**
+     * name of the file where the problem occurred
+     * 
+     * @return
+     */
+    String getFileName();
+
+    /**
+     * position of where the problem starts in the source code
+     * 
+     * @return
+     */
+    int getStartLine();
+    int getStartColumn();
+
+    /**
+     * position of where the problem stops in the source code
+     * 
+     * @return
+     */
+    int getEndLine();
+    int getEndColumn();
+
+    /**
+     * the description of the problem
+     * 
+     * @return
+     */
+    String getMessage();
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.problems;
+
+
+/**
+ * A CompilationProblemHandler gets access to a problem
+ * as soon as the problem is available while the
+ * CompilationResult only represents a summary at the
+ * end.
+ * The handler can be used to asynchronously update a
+ * GUI or stop compilation by returning false (e.g.
+ * when a maximum number of erros has been reached)
+ * 
+ * NOTE:
+ * has to be supported by the compiler implementation!!
+ * 
+ * @author tcurdt
+ */
+public interface CompilationProblemHandler {
+
+    boolean handle( final CompilationProblem pProblem );
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.readers;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * A memory based reader to compile from memory
+ * 
+ * @author tcurdt
+ */
+public class MemoryResourceReader implements ResourceReader {
+    
+    private Map resources = null;
+
+    public boolean isAvailable( final String pResourceName ) {
+        if (resources == null) {
+            return false;
+        }
+
+        return resources.containsKey(pResourceName);
+    }
+    
+    public void add( final String pResourceName, final byte[] pContent ) {
+        if (resources == null) {
+            resources = new HashMap();
+        }
+        
+        resources.put(pResourceName, pContent);
+    }
+    
+    public void remove( final String pResourceName ) {
+        if (resources != null) {
+            resources.remove(pResourceName);
+        }    
+    }    
+    
+
+    public byte[] getBytes( final String pResourceName ) {
+        return (byte[]) resources.get(pResourceName);
+    }
+
+    /**
+     * @deprecated
+     */
+    public String[] list() {
+        if (resources == null) {
+            return new String[0];
+        }
+        return (String[]) resources.keySet().toArray(new String[resources.size()]);
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/ResourceReader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/ResourceReader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/readers/ResourceReader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.commons.jci.readers;
+
+/**
+ * A ResourceReader provide acces to resource like e.g. source code
+ * 
+ * @author tcurdt
+ */
+public interface ResourceReader {
+
+    boolean isAvailable( final String pResourceName );
+    byte[] getBytes( final String pResourceName );
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/ResourceStore.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/ResourceStore.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/ResourceStore.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.commons.jci.stores;
+
+/**
+ * A Store is where the compilers are storing the results
+ * 
+ * @author tcurdt
+ */
+public interface ResourceStore {
+
+    void write( final String pResourceName, final byte[] pResourceData );
+    byte[] read( final String pResourceName );
+    //FIXME: return the result of the remove
+    void remove( final String pResourceName );
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/RuleBuildError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/RuleBuildError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/commons/jci/stores/RuleBuildError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.commons.jci.stores;
+
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Rule;
+
+public class RuleBuildError extends DescrBuildError {
+    private final Rule rule;
+    public RuleBuildError(final Rule rule,
+                           final BaseDescr descr,
+                           final Object object,
+                           final String message) {
+              super(descr, descr, object, message);
+              this.rule = rule;
+          }
+    
+    public Rule getRule() {
+        return this.rule;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ActionError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ActionError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ActionError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,117 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Rule;
+
+public class ActionError extends DroolsError {
+    private BaseDescr descr;
+    private Object    object;
+    private String    message;
+    private int[]     errorLines = new int[0];
+
+    public ActionError(final BaseDescr descr,
+                     final Object object,
+                     final String message) {
+        super();
+        this.descr = descr;
+        this.object = object;
+        this.message = message;
+    }
+
+    public BaseDescr getDescr() {
+        return this.descr;
+    }
+
+    public Object getObject() {
+        return this.object;
+    }
+    
+    public int[] getErrorLines() {
+        return this.errorLines;
+    }
+
+    /** 
+     * This will return the line number of the error, if possible
+     * Otherwise it will be -1
+     */
+    public int getLine() {
+        return this.descr != null ? this.descr.getLine() : -1;
+    }
+
+    public String getMessage() {
+        String summary = this.message;
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                if (i != 0) {
+                    summary = summary + "\n" + problem[i].getMessage();
+                } else {
+                    summary = summary + " " + problem[i].getMessage();
+                }
+            }
+
+        }
+        return summary;
+    }
+
+    public String toString() {
+        final StringBuffer buf = new StringBuffer();
+        buf.append( this.message );
+        buf.append( " : " );
+        buf.append( "\n" );
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                buf.append( "\t" );
+                buf.append( problem[i] );
+                buf.append( "\n" );
+            }
+        } else if ( this.object != null ) {
+            buf.append( this.object );
+        }
+        return buf.toString();
+    }
+
+//    private String createMessage( String message ) {
+//        StringBuffer detail = new StringBuffer();
+//        detail.append( this.message );
+//        detail.append( " : " );
+//        detail.append( this.rule );
+//        detail.append( "\n" );
+//        if( object instanceof CompilationProblem[] ) {
+//            CompilationProblem[] cp = (CompilationProblem[]) object;
+//            this.errorLines = new int[cp.length];
+//            for( int i = 0; i < cp.length ; i ++ ) {
+//               this.errorLines[i] = cp[i].getStartLine() - this.descr.getOffset() + this.descr.getLine() - 1; 
+//               detail.append( this.rule.getName() );
+//               detail.append( " (line:" );
+//               detail.append( this.errorLines[i] );
+//               detail.append( "): " );
+//               detail.append( cp[i].getMessage() );
+//               detail.append( "\n" );
+//            }
+//        } else {
+//            this.errorLines = new int[0];
+//        }
+//        return "[ "+this.rule.getName()+" : "+message + "\n"+detail.toString()+" ]";
+//    }
+    
+    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DescrBuildError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DescrBuildError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DescrBuildError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,125 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Rule;
+
+public class DescrBuildError extends DroolsError {
+    private BaseDescr      parentDescr;
+    private BaseDescr descr;
+    private Object    object;
+    private String    message;
+    private int[]     errorLines = new int[0];
+
+    public DescrBuildError(final BaseDescr parentDescr,
+                     final BaseDescr descr,
+                     final Object object,
+                     final String message) {
+        super();
+        this.parentDescr = parentDescr;
+        this.descr = descr;
+        this.object = object;
+        this.message = message;
+    }
+
+    public BaseDescr getParentDescr() {
+        return this.parentDescr;
+    }
+
+    public BaseDescr getDescr() {
+        return this.descr;
+    }
+
+    public Object getObject() {
+        return this.object;
+    }
+    
+    public int[] getErrorLines() {
+        return this.errorLines;
+    }
+
+    /** 
+     * This will return the line number of the error, if possible
+     * Otherwise it will be -1
+     */
+    public int getLine() {
+        return this.descr != null ? this.descr.getLine() : -1;
+    }
+
+    public String getMessage() {
+        String summary = this.message;
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                if (i != 0) {
+                    summary = summary + "\n" + problem[i].getMessage();
+                } else {
+                    summary = summary + " " + problem[i].getMessage();
+                }
+            }
+
+        }
+        return summary;
+    }
+
+    public String toString() {
+        final StringBuffer buf = new StringBuffer();
+        buf.append( this.message );
+        buf.append( " : " );
+        buf.append( this.parentDescr );
+        buf.append( "\n" );
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                buf.append( "\t" );
+                buf.append( problem[i] );
+                buf.append( "\n" );
+            }
+        } else if ( this.object != null ) {
+            buf.append( this.object );
+        }
+        return buf.toString();
+    }
+
+//    private String createMessage( String message ) {
+//        StringBuffer detail = new StringBuffer();
+//        detail.append( this.message );
+//        detail.append( " : " );
+//        detail.append( this.rule );
+//        detail.append( "\n" );
+//        if( object instanceof CompilationProblem[] ) {
+//            CompilationProblem[] cp = (CompilationProblem[]) object;
+//            this.errorLines = new int[cp.length];
+//            for( int i = 0; i < cp.length ; i ++ ) {
+//               this.errorLines[i] = cp[i].getStartLine() - this.descr.getOffset() + this.descr.getLine() - 1; 
+//               detail.append( this.rule.getName() );
+//               detail.append( " (line:" );
+//               detail.append( this.errorLines[i] );
+//               detail.append( "): " );
+//               detail.append( cp[i].getMessage() );
+//               detail.append( "\n" );
+//            }
+//        } else {
+//            this.errorLines = new int[0];
+//        }
+//        return "[ "+this.rule.getName()+" : "+message + "\n"+detail.toString()+" ]";
+//    }
+    
+    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/Dialect.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/Dialect.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/Dialect.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,152 @@
+package org.drools.compiler;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.TypeResolver;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.TimeWindowBuilder;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.EntryPointBuilder;
+import org.drools.rule.builder.FromBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.PatternBuilder;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ProcessClassBuilder;
+import org.drools.rule.builder.QueryBuilder;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleClassBuilder;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.SalienceBuilder;
+
+/**
+ * A Dialect implementation handles the building and execution of code expressions and blocks for a rule.
+ * This api is considered unstable, and subject to change. Those wishing to implement their own dialects
+ * should look ove the MVEL and Java dialect implementations.
+ *
+ */
+public interface Dialect {
+    String getId();
+    
+    void init(PackageBuilder builder);
+    
+    // this is needed because some dialects use other dialects
+    // to build complex expressions. Example: java dialect uses MVEL
+    // to execute complex expressions 
+    String getExpressionDialectName();
+
+    Map getBuilders();
+
+    TypeResolver getTypeResolver();
+
+    ClassFieldExtractorCache getClassFieldExtractorCache();
+
+    SalienceBuilder getSalienceBuilder();
+
+    PatternBuilder getPatternBuilder();
+
+    QueryBuilder getQueryBuilder();
+
+    RuleConditionBuilder getEvalBuilder();
+
+    AccumulateBuilder getAccumulateBuilder();
+    
+    TimeWindowBuilder getTimeWindowBuilder();
+
+    PredicateBuilder getPredicateBuilder();
+
+    ReturnValueBuilder getReturnValueBuilder();
+
+    ConsequenceBuilder getConsequenceBuilder();
+    
+    ActionBuilder getActionBuilder();
+    
+    ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder();
+
+    RuleClassBuilder getRuleClassBuilder();
+    
+    ProcessClassBuilder getProcessClassBuilder();
+
+    FromBuilder getFromBuilder();
+
+    EntryPointBuilder getEntryPointBuilder();
+
+    RuleConditionBuilder getBuilder(Class clazz);
+
+    AnalysisResult analyzeExpression(final PackageBuildContext context,
+                                     final BaseDescr descr,
+                                     final Object content,
+                                     final Set[] availableIdentifiers);
+
+    AnalysisResult analyzeBlock(final PackageBuildContext context,
+                                final BaseDescr descr,
+                                final String text,
+                                final Set[] availableIdentifiers);
+
+    void compileAll();
+
+    void addRule(final RuleBuildContext context);
+    
+    void addProcess(final ProcessBuildContext context);
+
+    void addFunction(final FunctionDescr functionDescr,
+                     TypeResolver typeResolver);
+
+    public void addImport(String importEntry);
+
+    public void addStaticImport(String importEntry);
+
+    List getResults();
+
+    void init(Package pkg);
+
+    void init(RuleDescr ruleDescr);
+    
+    void init(ProcessDescr processDescr);
+
+    /**
+     * An interface with the results from the expression/block analysis
+     * 
+     * @author etirelli
+     */
+    public static interface AnalysisResult {
+
+        /**
+         * Returns the list<String> of all used identifiers
+         * @return
+         */
+        public List getIdentifiers();
+
+        /**
+         * Returns the array of lists<String> of bound identifiers
+         * @return
+         */
+        public List[] getBoundIdentifiers();
+
+        /**
+         * Returns the list<String> of not bounded identifiers
+         * @return
+         */
+        public List getNotBoundedIdentifiers();
+
+        /**
+         * Returns the list<String> of declared local variables
+         * 
+         * @return
+         */
+        public List getLocalVariables();
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectConfiguration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectConfiguration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectConfiguration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.compiler;
+
+/**
+ * Each Dialect can have its own configuration. Implementations of this class are typically
+ * loaded via reflection in PackageBuilderConfiguration during the call to buildDialectRegistry().
+ * This Class api is subject to change.
+ *
+ */
+public interface DialectConfiguration {    
+    
+    public void init(PackageBuilderConfiguration  configuration);
+    
+    public Dialect getDialect();
+    
+    public PackageBuilderConfiguration getPackageBuilderConfiguration();
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectRegistry.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectRegistry.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DialectRegistry.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,113 @@
+package org.drools.compiler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A Registry of DialectConfigurations. It is also responsible for issueing actions to all registered
+ * dialects.
+ * This Class api is subject to change.
+ *
+ */
+public class DialectRegistry {
+    private Map map;
+
+    public DialectRegistry() {
+        this.map = new HashMap();
+    }
+
+    /**
+     * Add a DialectConfiguration to the registry
+     * @param name
+     * @param dialect
+     */
+    public void addDialect(final String name,
+                                        final Dialect dialect) {
+        this.map.put( name,
+                      dialect );
+    }
+
+    /**
+     * Get a DialectConfiguration for a named dialect
+     * @param name
+     * @return
+     */
+    public Dialect getDialect(final String name) {
+        return (Dialect) this.map.get( name );
+    }
+
+    /**
+     * Initialise all registered dialects for the given PackageBuilder.
+     * @param builder
+     */
+    public void initAll(PackageBuilder builder) {
+        for ( Iterator it = this.map.values().iterator(); it.hasNext(); ) {
+        	Dialect dialect = (Dialect) it.next();
+            dialect.init( builder );
+        }
+    }
+
+    /**
+     * Instruct all registered dialects to compile what ever they have attempted to build.
+     *
+     */
+    public void compileAll() {
+        for ( Iterator it = this.map.values().iterator(); it.hasNext(); ) {
+        	Dialect dialect = (Dialect) it.next();
+            dialect.compileAll();
+        }
+    }
+
+    /**
+     * Return an Iterator of DialectConfigurations
+     * @return
+     */
+    public Iterator iterator() {
+        return this.map.values().iterator();
+    }
+
+    /**
+     * Add all registered Dialect results to the provided List.
+     * @param list
+     * @return
+     */
+    public List addResults(List list) {
+        if ( list == null ) {
+            list = new ArrayList();
+        }
+        for ( Iterator it = this.map.values().iterator(); it.hasNext(); ) {
+        	Dialect dialect = (Dialect) it.next();
+            List results = dialect.getResults();
+            if ( results != null ) {
+                list.addAll( results );
+            }
+        }
+        return list;
+    }
+
+    /**
+     * Iterates all registered dialects, informing them of an import added to the PackageBuilder
+     * @param importEntry
+     */
+    public void addImport(String importEntry) {
+        for ( Iterator it = this.map.values().iterator(); it.hasNext(); ) {
+        	Dialect dialect = (Dialect) it.next();
+            dialect.addImport( importEntry );
+        }
+    }
+
+    /**
+     * Iterates all registered dialects, informing them of a static imports added to the PackageBuilder
+     * @param staticImportEntry
+     */    
+    public void addStaticImport(String staticImportEntry) {
+        for ( Iterator it = this.map.values().iterator(); it.hasNext(); ) {
+        	Dialect dialect = (Dialect) it.next();
+            dialect.addStaticImport( staticImportEntry );
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DrlParser.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DrlParser.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DrlParser.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,228 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.antlr.runtime.ANTLRReaderStream;
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.drools.lang.DRLLexer;
+import org.drools.lang.DRLParser;
+import org.drools.lang.Expander;
+import org.drools.lang.ExpanderException;
+import org.drools.lang.Location;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.dsl.DefaultExpanderResolver;
+
+/**
+ * This is a low level parser API. This will return textual AST representations
+ * of the DRL source, including with DSL expanders if appropriate.
+ */
+public class DrlParser {
+
+    private final List results = new ArrayList();
+    private Location location = null;
+
+    public DrlParser() {
+
+    }
+
+    /** Parse a rule from text */
+    public PackageDescr parse(final String text) throws DroolsParserException {
+        final DRLParser parser = getParser( text );
+        compile( parser );
+        this.location = parser.getLocation();
+        return parser.getPackageDescr();
+
+    }
+
+    public PackageDescr parse(final Reader reader) throws DroolsParserException {
+        final DRLParser parser = getParser( reader );
+        compile( parser );
+        this.location = parser.getLocation();
+        return parser.getPackageDescr();
+
+    }
+
+    //    /** Parse and build a rule package from a DRL source */
+    //    public PackageDescr parse(final Reader reader) throws IOException,
+    //                                            DroolsParserException {
+    //        DRLParser parser = 
+    //        
+    //        //final StringBuffer text = getDRLText( reader );
+    //        //return parse( text.toString() );
+    //    }
+
+	/** 
+     * Parse and build a rule package from a DRL source with a 
+     * domain specific language.
+     */
+    public PackageDescr parse(final Reader drl,
+                              final Reader dsl) throws DroolsParserException,
+                                               IOException {
+        final StringBuffer text = getDRLText( drl );
+        return parse( text.toString(),
+                      dsl );
+    }
+
+    /**
+     * Parse and build a rule package from a DRL source with a domain specific language.
+     * @param source As Text.
+     * @param dsl 
+     * @return
+     * @throws DroolsParserException
+     */
+    public PackageDescr parse(final String source,
+                              final Reader dsl) throws DroolsParserException {
+    	
+    	DefaultExpanderResolver resolver = getDefaultResolver(dsl);
+    	
+        final Expander expander = resolver.get( "*",
+                                          null );
+        final String expanded = expander.expand( source );
+        if ( expander.hasErrors() ) {
+            this.results.addAll( expander.getErrors() );
+        }
+        return this.parse( expanded );
+    }
+
+    /**
+     * This will expand the DRL.
+     * useful for debugging.
+     * @param source - the source which use a DSL
+     * @param dsl - the DSL itself.
+     * @throws DroolsParserException If unable to expand in any way.
+     */
+    public String getExpandedDRL(final String source, final Reader dsl) throws DroolsParserException {
+    	DefaultExpanderResolver resolver = getDefaultResolver(dsl);
+        return getExpandedDRL(source, resolver);
+    }
+    
+    /**
+     * This will expand the DRL using the given expander resolver.
+     * useful for debugging.
+     * @param source - the source which use a DSL
+     * @param resolver - the DSL expander resolver itself.
+     * @throws DroolsParserException If unable to expand in any way.
+     */
+    public String getExpandedDRL(final String source, final DefaultExpanderResolver resolver ) throws DroolsParserException {
+
+    	final Expander expander = resolver.get( "*",
+                                          null );
+        final String expanded = expander.expand( source );
+        
+        if ( expander.hasErrors() ) {
+            String err = "";
+            for ( Iterator iter = expander.getErrors().iterator(); iter.hasNext(); ) {
+                ExpanderException ex = (ExpanderException) iter.next();
+                err  = err + "\n Line:[" + ex.getLine() + "] " + ex.getMessage();
+                
+            }
+            throw new DroolsParserException(err);
+        }    
+        return expanded;
+    }
+    
+    
+    private StringBuffer getDRLText(final Reader reader) throws IOException {
+        final StringBuffer text = new StringBuffer();
+
+        final char[] buf = new char[1024];
+        int len = 0;
+
+        while ( (len = reader.read( buf )) >= 0 ) {
+            text.append( buf,
+                         0,
+                         len );
+        }
+        return text;
+    }
+
+    /**
+     * @return true if there were parser errors.
+     */
+    public boolean hasErrors() {
+        return this.results.size() > 0;
+    }
+
+    /**
+     * @return a list of ParserError's.
+     */
+    public List getErrors() {
+        return this.results;
+    }
+
+    private void compile(final DRLParser parser) throws DroolsParserException {
+        try {
+            parser.compilation_unit();
+
+            makeErrorList( parser );
+        } catch ( final RecognitionException e ) {
+            throw new DroolsParserException( e );
+        } catch ( Exception e ) {
+            throw new DroolsParserException( "Unknown error while parsing. This is a bug. Please contact the Development team.", e);
+        }
+    }
+
+    /** Convert the antlr exceptions to drools parser exceptions */
+    private void makeErrorList(final DRLParser parser) {
+        for ( final Iterator iter = parser.getErrors().iterator(); iter.hasNext(); ) {
+            final RecognitionException recogErr = (RecognitionException) iter.next();
+            final ParserError err = new ParserError( parser.createErrorMessage( recogErr ),
+                                                     recogErr.line,
+                                                     recogErr.charPositionInLine );
+            this.results.add( err );
+        }
+    }
+
+    /**
+     * @return An instance of a RuleParser should you need one (most folks will not).
+     */
+    private DRLParser getParser(final String text) {
+        return new DRLParser( new CommonTokenStream( new DRLLexer( new ANTLRStringStream( text ) ) ) );
+    }
+
+    private DRLParser getParser(final Reader reader) {
+        try {
+            return new DRLParser( new CommonTokenStream( new DRLLexer( new ANTLRReaderStream( reader ) ) ) );
+        } catch ( final Exception e ) {
+            throw new RuntimeException( "Unable to parser Reader",
+                                        e );
+        }
+    }
+    
+    public Location getLocation() {
+        return this.location; 
+    }
+    
+    public DefaultExpanderResolver getDefaultResolver(final Reader dsl) throws DroolsParserException {
+        DefaultExpanderResolver resolver;
+        try {
+        		resolver = new DefaultExpanderResolver( dsl );
+        } catch ( final IOException e ) {
+            throw new DroolsParserException( "Error parsing the DSL.",
+                                             e );
+        }
+        return resolver;
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public abstract class DroolsError {
+
+    /**
+     * Classes that extend this must provide a printable message,
+     * which summarises the error.
+     */
+    public abstract String getMessage();
+    
+    /**
+     * Returns the lines of the error in the source file
+     * @return
+     */
+    public abstract int[] getErrorLines();
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsParserException.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsParserException.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/DroolsParserException.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,56 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.CheckedDroolsException;
+
+public class DroolsParserException extends CheckedDroolsException {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+
+    /**
+     * @see java.lang.Exception#Exception()
+     */
+    public DroolsParserException() {
+        super();
+    }
+
+    /**
+     * @see java.lang.Exception#Exception(String message)
+     */
+    public DroolsParserException(final String message) {
+        super( message );
+    }
+
+    /**
+     * @see java.lang.Exception#Exception(String message, Throwable cause)
+     */
+    public DroolsParserException(final String message,
+                                 final Throwable cause) {
+        super( message );
+    }
+
+    /**
+     * @see java.lang.Exception#Exception(Throwable cause)
+     */
+    public DroolsParserException(final Throwable cause) {
+        super( cause );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FactTemplateError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FactTemplateError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FactTemplateError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Package;
+
+public class FactTemplateError extends DroolsError {
+    private Package   pkg;
+    private BaseDescr descr;
+    private Object    object;
+    private String    message;
+    private int[]     line;
+
+    public FactTemplateError(final Package pkg,
+                             final BaseDescr descr,
+                             final Object object,
+                             final String message) {
+        super();
+        this.pkg = pkg;
+        this.descr = descr;
+        this.object = object;
+        this.message = message;
+        this.line = new int[] { ( this.descr != null ) ? this.descr.getLine() : -1 };
+    }
+
+    public Package getPackage() {
+        return this.pkg;
+    }
+
+    public BaseDescr getDescr() {
+        return this.descr;
+    }
+
+    public Object getObject() {
+        return this.object;
+    }
+    
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    /** 
+     * This will return the line number of the error, if possible
+     * Otherwise it will be -1
+     */
+    public int getLine() {
+        return this.line[0];
+    }
+
+    public String getMessage() {
+        String summary = this.message;
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                summary = summary + " " + problem[i].getMessage();
+            }
+
+        }
+        return summary;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FieldTemplateError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FieldTemplateError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FieldTemplateError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,77 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Package;
+
+public class FieldTemplateError extends DroolsError {
+    private Package   pkg;
+    private BaseDescr descr;
+    private Object    object;
+    private String    message;
+    private int[]     line;
+
+    public FieldTemplateError(final Package pkg,
+                              final BaseDescr descr,
+                              final Object object,
+                              final String message) {
+        this.pkg = pkg;
+        this.descr = descr;
+        this.object = object;
+        this.message = message;
+        this.line = new int[] { ( this.descr != null ) ? this.descr.getLine() : -1 };
+    }
+
+    public Package getPackage() {
+        return this.pkg;
+    }
+
+    public BaseDescr getDescr() {
+        return this.descr;
+    }
+
+    public Object getObject() {
+        return this.object;
+    }
+    
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    /** 
+     * This will return the line number of the error, if possible
+     * Otherwise it will be -1
+     */
+    public int getLine() {
+        return this.line[0];
+    }
+
+    public String getMessage() {
+        String summary = this.message;
+        if ( this.object instanceof CompilationProblem[] ) {
+            final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+            for ( int i = 0; i < problem.length; i++ ) {
+                summary = summary + " " + problem[i].getMessage();
+            }
+
+        }
+        return summary;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FunctionError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FunctionError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/FunctionError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,77 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.FunctionDescr;
+
+public class FunctionError extends DroolsError {
+    final private FunctionDescr functionDescr;
+    final private Object        object;
+    final private String        message;
+    private int[]         errorLines;
+
+    public FunctionError(final FunctionDescr functionDescr,
+                         final Object object,
+                         final String message) {
+        super();
+        this.functionDescr = functionDescr;
+        this.object = object;
+        this.message = createMessage( message );
+    }
+
+    public FunctionDescr getFunctionDescr() {
+        return this.functionDescr;
+    }
+
+    public Object getObject() {
+        return this.object;
+    }
+    
+    public int[] getErrorLines() {
+        return errorLines;        
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+    
+    public String toString() {
+        return this.message;
+    }
+    
+    private String createMessage( String message ) {
+        StringBuffer detail = new StringBuffer();
+        if( object instanceof CompilationProblem[] ) {
+            CompilationProblem[] cp = (CompilationProblem[]) object;
+            this.errorLines = new int[cp.length];
+            for( int i = 0; i < cp.length ; i ++ ) {
+               this.errorLines[i] = cp[i].getStartLine() - this.functionDescr.getOffset() + this.getFunctionDescr().getLine() - 1; 
+               detail.append( this.functionDescr.getName() );
+               detail.append( " (line:" );
+               detail.append( this.errorLines[i] );
+               detail.append( "): " );
+               detail.append( cp[i].getMessage() );
+               detail.append( "\n" );
+            }
+        } else {
+            this.errorLines = new int[0];
+        }
+        return "[ "+functionDescr.getName()+" : "+message + "\n"+detail.toString()+" ]";
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/GlobalError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/GlobalError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/GlobalError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,44 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class GlobalError extends DroolsError {
+    private String global;
+    private int[]  line;
+
+    public GlobalError(final String global, final int line) {
+        this.global = global;
+        this.line = new int[] { line };
+    }
+
+    public String getGlobal() {
+        return this.global;
+    }
+    
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    public String getMessage() {
+        return this.global;
+    }
+    
+    public String toString() {
+    	return "GlobalError: " + this.global;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ImportError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ImportError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ImportError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,44 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ImportError extends DroolsError {
+    private String importName;
+    private int[]  line;
+
+    public ImportError(final String importName, final int line) {
+        this.importName = importName;
+        this.line = new int[] { line };
+    }
+
+    public String getGlobal() {
+        return this.importName;
+    }
+
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    public String getMessage() {
+        return this.importName;
+    }
+    
+    public String toString() {
+        return this.getMessage();
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,747 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ClassTypeResolver;
+import org.drools.base.TypeResolver;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.facttemplates.FactTemplate;
+import org.drools.facttemplates.FactTemplateImpl;
+import org.drools.facttemplates.FieldTemplate;
+import org.drools.facttemplates.FieldTemplateImpl;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FieldTemplateDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.TypeDeclarationDescr;
+import org.drools.process.core.Process;
+import org.drools.rule.ImportDeclaration;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+import org.drools.rule.TypeDeclaration;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.xml.XmlPackageReader;
+import org.drools.xml.XmlProcessReader;
+import org.xml.sax.SAXException;
+
+/**
+ * This is the main compiler class for parsing and compiling rules and
+ * assembling or merging them into a binary Package instance. This can be done
+ * by merging into existing binary packages, or totally from source.
+ * 
+ * If you are using the Java dialect the JavaDialectConfiguration will attempt to 
+ * validate that the specified compiler is in the classpath, using ClassLoader.loasClass(String). 
+ * If you intented to just Janino sa the compiler you must either overload the compiler 
+ * property before instantiating this class or the PackageBuilder, or make sure Eclipse is in the 
+ * classpath, as Eclipse is the default.
+ */
+public class PackageBuilder {
+
+    private Package                     pkg;
+
+    private List                        results;
+
+    private PackageBuilderConfiguration configuration;
+
+    private TypeResolver                typeResolver;
+
+    private ClassFieldExtractorCache    classFieldExtractorCache;
+
+    private RuleBuilder                 ruleBuilder;
+
+    private Dialect                     dialect;
+
+    private DialectRegistry             dialectRegistry;
+
+    /**
+     * Use this when package is starting from scratch.
+     */
+    public PackageBuilder() {
+        this( null,
+              null );
+    }
+
+    /**
+     * This will allow you to merge rules into this pre existing package.
+     */
+
+    public PackageBuilder(final Package pkg) {
+        this( pkg,
+              null );
+    }
+
+    /**
+     * Pass a specific configuration for the PackageBuilder
+     * 
+     * PackageBuilderConfiguration is not thread safe and it also contains state. Once it is created and used 
+     * in one or more PackageBuilders it should be considered immutable. Do not modify its 
+     * properties while it is being used by a PackageBuilder.
+     * 
+     * @param configuration
+     */
+    public PackageBuilder(final PackageBuilderConfiguration configuration) {
+        this( null,
+              configuration );
+    }
+
+    /**
+     * This allows you to pass in a pre existing package, and a configuration
+     * (for instance to set the classloader).
+     * 
+     * @param pkg
+     *            A pre existing package (can be null if none exists)
+     * @param configuration
+     *            Optional configuration for this builder.
+     */
+    public PackageBuilder(final Package pkg,
+                          PackageBuilderConfiguration configuration) {
+        if ( configuration == null ) {
+            configuration = new PackageBuilderConfiguration();
+        }
+
+        this.configuration = configuration;
+        this.results = new ArrayList();
+        this.pkg = pkg;
+        this.classFieldExtractorCache = ClassFieldExtractorCache.getInstance();
+
+        if ( this.pkg != null ) {
+            this.typeResolver = new ClassTypeResolver( new HashSet<String>( this.pkg.getImports().keySet() ),
+                                                       this.configuration.getClassLoader() );
+            // make an automatic import for the current package
+            this.typeResolver.addImport( this.pkg.getName() + ".*" );
+        } else {
+            this.typeResolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       this.configuration.getClassLoader() );
+        }
+
+        this.dialectRegistry = this.configuration.buildDialectRegistry();
+
+        this.dialect = this.dialectRegistry.getDialect( this.configuration.getDefaultDialect() );
+
+        if ( this.pkg != null ) {
+            this.dialectRegistry.initAll( this );
+        }
+
+    }
+
+    /**
+     * Load a rule package from DRL source.
+     * 
+     * @param reader
+     * @throws DroolsParserException
+     * @throws IOException
+     */
+    public void addPackageFromDrl(final Reader reader) throws DroolsParserException,
+                                                      IOException {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( reader );
+        this.results.addAll( parser.getErrors() );
+        addPackage( pkg );
+    }
+
+    /**
+     * Load a rule package from XML source.
+     * 
+     * @param reader
+     * @throws DroolsParserException
+     * @throws IOException
+     */
+    public void addPackageFromXml(final Reader reader) throws DroolsParserException,
+                                                      IOException {
+        final XmlPackageReader xmlReader = new XmlPackageReader( this.configuration.getSemanticModules() );
+
+        try {
+            xmlReader.read( reader );
+        } catch ( final SAXException e ) {
+            throw new DroolsParserException( e.toString(),
+                                             e.getCause() );
+        }
+
+        addPackage( xmlReader.getPackageDescr() );
+    }
+
+    /**
+     * Load a rule package from DRL source using the supplied DSL configuration.
+     * 
+     * @param source
+     *            The source of the rules.
+     * @param dsl
+     *            The source of the domain specific language configuration.
+     * @throws DroolsParserException
+     * @throws IOException
+     */
+    public void addPackageFromDrl(final Reader source,
+                                  final Reader dsl) throws DroolsParserException,
+                                                   IOException {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( source,
+                                               dsl );
+        this.results.addAll( parser.getErrors() );
+        addPackage( pkg );
+    }
+
+    /**
+     * Add a ruleflow (.rt) asset to this package.
+     */
+    public void addRuleFlow(Reader processSource) {
+        ProcessBuilder processBuilder = new ProcessBuilder( this );
+
+        try {
+            processBuilder.addProcessFromFile( processSource );
+            this.results.addAll( processBuilder.getErrors() );
+        } catch ( Exception e ) {
+            if ( e instanceof RuntimeException ) {
+                throw (RuntimeException) e;
+            }
+            this.results.add( new RuleFlowLoadError( "Unable to load the rule flow.",
+                                                     e ) );
+        }
+
+        this.results = this.dialectRegistry.addResults( this.results );
+    }
+
+    public void addProcessFromXml(Reader reader) {
+        ProcessBuilder processBuilder = new ProcessBuilder( this );
+        XmlProcessReader xmlReader = new XmlProcessReader( this.configuration.getSemanticModules() );
+        try {
+            Process process = xmlReader.read( reader );
+            processBuilder.buildProcess( process );
+            this.results.addAll( processBuilder.getErrors() );
+        } catch ( Exception e ) {
+            if ( e instanceof RuntimeException ) {
+                throw (RuntimeException) e;
+            }
+            this.results.add( new RuleFlowLoadError( "Unable to load the rule flow.",
+                                                     e ) );
+        }
+
+        this.results = this.dialectRegistry.addResults( this.results );
+    }
+
+    private void addSemanticModules() {
+        //this.configuration.getSemanticModules();
+    }
+
+    /**
+     * This adds a package from a Descr/AST This will also trigger a compile, if
+     * there are any generated classes to compile of course.
+     */
+    public void addPackage(final PackageDescr packageDescr) {
+        validatePackageName( packageDescr );
+        validateUniqueRuleNames( packageDescr );
+
+        String dialectName = null;
+
+        // The Package does not have a default dialect, so set it
+        if ( this.dialect == null ) {
+            this.dialect = this.dialectRegistry.getDialect( this.configuration.getDefaultDialect() );
+        }
+
+        if ( dialectName != null ) {
+            this.dialect = this.dialectRegistry.getDialect( dialectName );
+        } else if ( this.dialect == null ) {
+            this.dialect = this.dialectRegistry.getDialect( this.configuration.getDefaultDialect() );
+        }
+
+        if ( this.pkg != null ) {
+            mergePackage( packageDescr );
+        } else {
+            newPackage( packageDescr );
+        }
+
+        this.ruleBuilder = new RuleBuilder();
+
+        // only try to compile if there are no parse errors
+        if ( !hasErrors() ) {
+            for ( final Iterator it = packageDescr.getFactTemplates().iterator(); it.hasNext(); ) {
+                addFactTemplate( (FactTemplateDescr) it.next() );
+            }
+
+            if ( !packageDescr.getFunctions().isEmpty() ) {
+                // add static imports for all functions
+                for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
+                    FunctionDescr functionDescr = (FunctionDescr) it.next();
+                    final String functionClassName = this.pkg.getName() + "." + ucFirst( functionDescr.getName() );
+                    functionDescr.setClassName( functionClassName );
+                    this.pkg.addStaticImport( functionClassName + "." + functionDescr.getName() );
+                }
+
+                // iterate and compile
+                for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
+                    addFunction( (FunctionDescr) it.next() );
+                }
+
+                // We need to compile all the functions, so scripting languages like mvel can find them
+                this.dialectRegistry.compileAll();
+
+                for ( final Iterator it = packageDescr.getFunctions().iterator(); it.hasNext(); ) {
+                    FunctionDescr functionDescr = (FunctionDescr) it.next();
+                    final String functionClassName = this.pkg.getName() + "." + ucFirst( functionDescr.getName() );
+                    this.dialectRegistry.addStaticImport( functionClassName + "." + functionDescr.getName() );
+                }
+            }
+
+            // iterate and compile
+            for ( final Iterator it = packageDescr.getRules().iterator(); it.hasNext(); ) {
+                addRule( (RuleDescr) it.next() );
+            }
+        }
+
+        this.dialectRegistry.compileAll();
+
+        // some of the rules and functions may have been redefined
+        if ( this.pkg.getPackageCompilationData().isDirty() ) {
+            this.pkg.getPackageCompilationData().reload();
+        }
+        this.results = this.dialectRegistry.addResults( this.results );
+    }
+
+    private void validatePackageName(final PackageDescr packageDescr) {
+        if ( (this.pkg == null || this.pkg.getName() == null || this.pkg.getName().equals( "" )) && (packageDescr.getName() == null || "".equals( packageDescr.getName() )) ) {
+            throw new MissingPackageNameException( "Missing package name for rule package." );
+        }
+        if ( this.pkg != null && packageDescr.getName() != null && !"".equals( packageDescr.getName() ) && !this.pkg.getName().equals( packageDescr.getName() ) ) {
+            throw new PackageMergeException( "Can't merge packages with different names. This package: " + this.pkg.getName() + " - New package: " + packageDescr.getName() );
+        }
+        return;
+    }
+
+    private void validateUniqueRuleNames(final PackageDescr packageDescr) {
+        final Set names = new HashSet();
+        for ( final Iterator iter = packageDescr.getRules().iterator(); iter.hasNext(); ) {
+            final RuleDescr rule = (RuleDescr) iter.next();
+            final String name = rule.getName();
+            if ( names.contains( name ) ) {
+                this.results.add( new ParserError( "Duplicate rule name: " + name,
+                                                   rule.getLine(),
+                                                   rule.getColumn() ) );
+            }
+            names.add( name );
+        }
+    }
+
+    private void newPackage(final PackageDescr packageDescr) {
+        this.pkg = new Package( packageDescr.getName(),
+                                this.configuration.getClassLoader() );
+
+        this.typeResolver.addImport( this.pkg.getName() + ".*" );
+
+        this.dialectRegistry.initAll( this );
+
+        mergePackage( packageDescr );
+    }
+
+    private void mergePackage(final PackageDescr packageDescr) {
+        final List imports = packageDescr.getImports();
+        for ( final Iterator it = imports.iterator(); it.hasNext(); ) {
+            ImportDescr importEntry = (ImportDescr) it.next();
+            ImportDeclaration importDecl = new ImportDeclaration( importEntry.getTarget() );
+            pkg.addImport( importDecl );
+            this.typeResolver.addImport( importDecl.getTarget() );
+            this.dialectRegistry.addImport( importDecl.getTarget() );
+        }
+
+        processTypeDeclarations( packageDescr );
+
+        for ( final Iterator it = packageDescr.getFunctionImports().iterator(); it.hasNext(); ) {
+            String importEntry = ((FunctionImportDescr) it.next()).getTarget();
+            this.dialectRegistry.addStaticImport( importEntry );
+            this.pkg.addStaticImport( importEntry );
+        }
+
+        final List globals = packageDescr.getGlobals();
+        for ( final Iterator it = globals.iterator(); it.hasNext(); ) {
+            final GlobalDescr global = (GlobalDescr) it.next();
+            final String identifier = global.getIdentifier();
+            final String className = global.getType();
+
+            Class clazz;
+            try {
+                clazz = typeResolver.resolveType( className );
+                this.pkg.addGlobal( identifier,
+                                    clazz );
+            } catch ( final ClassNotFoundException e ) {
+                this.results.add( new GlobalError( identifier,
+                                                   global.getLine() ) );
+            }
+        }
+
+    }
+
+    /**
+     * @param packageDescr
+     */
+    private void processTypeDeclarations(final PackageDescr packageDescr) {
+        for ( TypeDeclarationDescr typeDescr : packageDescr.getTypeDeclarations() ) {
+            TypeDeclaration type = new TypeDeclaration( typeDescr.getTypeName() );
+
+            // is it a regular fact or an event?
+            String role = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_ROLE );
+            if ( role != null ) {
+                type.setRole( TypeDeclaration.Role.parseRole( role ) );
+            }
+
+            // is it a POJO or a template?
+            String templateName = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_TEMPLATE );
+            if( templateName != null ) {
+                type.setFormat( TypeDeclaration.Format.TEMPLATE );
+                FactTemplate template = this.pkg.getFactTemplate( templateName );
+                if( template != null ) {
+                    type.setTypeTemplate( template );
+                } else {
+                    this.results.add( new TypeDeclarationError( "Template not found '" + template + "' for type '" + type.getTypeName() + "'",
+                                                                typeDescr.getLine() ) );
+                }
+            } else {
+                String className = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_CLASS );
+                if ( className == null ) {
+                    className = type.getTypeName();
+                }
+                type.setFormat( TypeDeclaration.Format.POJO );
+                Class clazz;
+                try {
+                    clazz = typeResolver.resolveType( className );
+                    type.setTypeClass( clazz );
+                } catch ( final ClassNotFoundException e ) {
+                    this.results.add( new TypeDeclarationError( "Class not found '" + className + "' for type '" + type.getTypeName() + "'",
+                                                                typeDescr.getLine() ) );
+                }
+            }
+
+            String clockStrategy = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_CLOCK_STRATEGY );
+            if ( clockStrategy != null ) {
+                type.setClockStrategy( TypeDeclaration.ClockStrategy.parseClockStrategy( clockStrategy ) );
+            }
+            String timestamp = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_TIMESTAMP );
+            if ( timestamp != null ) {
+                type.setTimestampAttribute( timestamp );
+            }
+            String duration = typeDescr.getAttribute( TypeDeclarationDescr.ATTR_DURATION );
+            if ( duration != null ) {
+                type.setDurationAttribute( duration );
+            }
+            
+            this.pkg.addTypeDeclaration( type );
+        }
+    }
+
+    private void addFunction(final FunctionDescr functionDescr) {
+        this.dialect.addFunction( functionDescr,
+                                  getTypeResolver() );
+    }
+
+    private void addFactTemplate(final FactTemplateDescr factTemplateDescr) {
+        final List fields = new ArrayList();
+        int index = 0;
+        for ( final Iterator it = factTemplateDescr.getFields().iterator(); it.hasNext(); ) {
+            final FieldTemplateDescr fieldTemplateDescr = (FieldTemplateDescr) it.next();
+            FieldTemplate fieldTemplate = null;
+            try {
+                fieldTemplate = new FieldTemplateImpl( fieldTemplateDescr.getName(),
+                                                       index++,
+                                                       getTypeResolver().resolveType( fieldTemplateDescr.getClassType() ) );
+            } catch ( final ClassNotFoundException e ) {
+                this.results.add( new FieldTemplateError( this.pkg,
+                                                          fieldTemplateDescr,
+                                                          null,
+                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'" ) );
+            }
+            fields.add( fieldTemplate );
+        }
+
+        final FactTemplate factTemplate = new FactTemplateImpl( this.pkg,
+                                                                factTemplateDescr.getName(),
+                                                                (FieldTemplate[]) fields.toArray( new FieldTemplate[fields.size()] ) );
+    }
+
+    private void addRule(final RuleDescr ruleDescr) {
+        //this.dialect.init( ruleDescr );
+
+        if ( ruleDescr instanceof QueryDescr ) {
+            //ruleDescr.getLhs().insertDescr( 0, baseDescr );
+        }
+
+        RuleBuildContext context = new RuleBuildContext( this.configuration,
+                                                         pkg,
+                                                         ruleDescr,
+                                                         this.dialectRegistry,
+                                                         this.dialect );
+        this.ruleBuilder.build( context );
+
+        this.results.addAll( context.getErrors() );
+
+        context.getDialect().addRule( context );
+
+        this.pkg.addRule( context.getRule() );
+    }
+
+    /**
+     * @return a Type resolver, lazily. If one does not exist yet, it will be
+     *         initialised.
+     */
+    public TypeResolver getTypeResolver() {
+        return this.typeResolver;
+    }
+
+    /**
+     * @return The compiled package. The package may contain errors, which you
+     *         can report on by calling getErrors or printErrors. If you try to
+     *         add an invalid package (or rule) to a RuleBase, you will get a
+     *         runtime exception.
+     * 
+     * Compiled packages are serializable.
+     */
+    public Package getPackage() {
+        if ( this.pkg != null && this.pkg.getPackageCompilationData() != null && this.pkg.getPackageCompilationData().isDirty() ) {
+            this.pkg.getPackageCompilationData().reload();
+        }
+        if ( hasErrors() && this.pkg != null ) {
+            this.pkg.setError( getErrors().toString() );
+        }
+        return this.pkg;
+    }
+
+    /**
+     * Return the PackageBuilderConfiguration for this PackageBuilder session
+     * @return
+     *      The PackageBuilderConfiguration
+     */
+    public PackageBuilderConfiguration getPackageBuilderConfiguration() {
+        return this.configuration;
+    }
+
+    public DialectRegistry getDialectRegistry() {
+        return this.dialectRegistry;
+    }
+
+    public Dialect getDefaultDialect() {
+        return this.dialect;
+    }
+
+    /**
+     * Return the ClassFieldExtractorCache, this should only be used internally, and is subject to change
+     * @return
+     *      the ClsasFieldExtractorCache
+     */
+    public ClassFieldExtractorCache getClassFieldExtractorCache() {
+        return this.classFieldExtractorCache;
+    }
+
+    /**
+     * This will return true if there were errors in the package building and
+     * compiling phase
+     */
+    public boolean hasErrors() {
+        return this.results.size() > 0;
+    }
+
+    /**
+     * @return A list of Error objects that resulted from building and compiling
+     *         the package.
+     */
+    public PackageBuilderErrors getErrors() {
+        return new PackageBuilderErrors( (DroolsError[]) this.results.toArray( new DroolsError[this.results.size()] ) );
+    }
+
+    /**
+     * Reset the error list. This is useful when incrementally building
+     * packages. Care should be used when building this, if you clear this when
+     * there were errors on items that a rule depends on (eg functions), then
+     * you will get spurious errors which will not be that helpful.
+     */
+    protected void resetErrors() {
+        this.results.clear();
+    }
+
+    public static class MissingPackageNameException extends IllegalArgumentException {
+        private static final long serialVersionUID = 400L;
+
+        public MissingPackageNameException(final String message) {
+            super( message );
+        }
+
+    }
+
+    public static class PackageMergeException extends IllegalArgumentException {
+        private static final long serialVersionUID = 400L;
+
+        public PackageMergeException(final String message) {
+            super( message );
+        }
+
+    }
+
+    /**
+     * This is the super of the error handlers. Each error handler knows how to
+     * report a compile error of its type, should it happen. This is needed, as
+     * the compiling is done as one hit at the end, and we need to be able to
+     * work out what rule/ast element caused the error.
+     * 
+     * An error handler it created for each class task that is queued to be
+     * compiled. This doesn't mean an error has occurred, it just means it *may*
+     * occur in the future and we need to be able to map it back to the AST
+     * element that originally spawned the code to be compiled.
+     */
+    public abstract static class ErrorHandler {
+        private final List errors  = new ArrayList();
+
+        protected String   message;
+
+        private boolean    inError = false;
+
+        /** This needes to be checked if there is infact an error */
+        public boolean isInError() {
+            return this.inError;
+        }
+
+        public void addError(final CompilationProblem err) {
+            this.errors.add( err );
+            this.inError = true;
+        }
+
+        /**
+         * 
+         * @return A DroolsError object populated as appropriate, should the
+         *         unthinkable happen and this need to be reported.
+         */
+        public abstract DroolsError getError();
+
+        /**
+         * We must use an error of JCI problem objects. If there are no
+         * problems, null is returned. These errors are placed in the
+         * DroolsError instances. Its not 1 to 1 with reported errors.
+         */
+        protected CompilationProblem[] collectCompilerProblems() {
+            if ( this.errors.size() == 0 ) {
+                return null;
+            } else {
+                final CompilationProblem[] list = new CompilationProblem[this.errors.size()];
+                this.errors.toArray( list );
+                return list;
+            }
+        }
+    }
+
+    public static class RuleErrorHandler extends ErrorHandler {
+
+        private BaseDescr descr;
+
+        private Rule      rule;
+
+        public RuleErrorHandler(final BaseDescr ruleDescr,
+                                final Rule rule,
+                                final String message) {
+            this.descr = ruleDescr;
+            this.rule = rule;
+            this.message = message;
+        }
+
+        public DroolsError getError() {
+            return new RuleBuildError( this.rule,
+                                       this.descr,
+                                       collectCompilerProblems(),
+                                       this.message );
+        }
+
+    }
+
+    public static class ProcessErrorHandler extends ErrorHandler {
+
+        private BaseDescr descr;
+
+        private Process   process;
+
+        public ProcessErrorHandler(final BaseDescr ruleDescr,
+                                   final Process process,
+                                   final String message) {
+            this.descr = ruleDescr;
+            this.process = process;
+            this.message = message;
+        }
+
+        public DroolsError getError() {
+            return new ProcessBuildError( this.process,
+                                          this.descr,
+                                          collectCompilerProblems(),
+                                          this.message );
+        }
+
+    }
+
+    /**
+     * There isn't much point in reporting invoker errors, as they are no help.
+     */
+    public static class RuleInvokerErrorHandler extends RuleErrorHandler {
+
+        public RuleInvokerErrorHandler(final BaseDescr ruleDescr,
+                                       final Rule rule,
+                                       final String message) {
+            super( ruleDescr,
+                   rule,
+                   message );
+        }
+    }
+
+    public static class ProcessInvokerErrorHandler extends ProcessErrorHandler {
+
+        public ProcessInvokerErrorHandler(final BaseDescr processDescr,
+                                          final Process process,
+                                          final String message) {
+            super( processDescr,
+                   process,
+                   message );
+        }
+    }
+
+    public static class FunctionErrorHandler extends ErrorHandler {
+
+        private FunctionDescr descr;
+
+        public FunctionErrorHandler(final FunctionDescr functionDescr,
+                                    final String message) {
+            this.descr = functionDescr;
+            this.message = message;
+        }
+
+        public DroolsError getError() {
+            return new FunctionError( this.descr,
+                                      collectCompilerProblems(),
+                                      this.message );
+        }
+
+    }
+
+    private String ucFirst(final String name) {
+        return name.toUpperCase().charAt( 0 ) + name.substring( 1 );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,474 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Map.Entry;
+
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuntimeDroolsException;
+import org.drools.base.accumulators.AccumulateFunction;
+import org.drools.base.evaluators.EvaluatorDefinition;
+import org.drools.base.evaluators.EvaluatorRegistry;
+import org.drools.process.builder.ProcessNodeBuilder;
+import org.drools.process.builder.ProcessNodeBuilderRegistry;
+import org.drools.util.ChainedProperties;
+import org.drools.util.ClassUtils;
+import org.drools.util.ConfFileUtils;
+import org.drools.workflow.core.Node;
+import org.drools.xml.DefaultSemanticModule;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessSemanticModule;
+import org.drools.xml.RulesSemanticModule;
+import org.drools.xml.SemanticModule;
+import org.drools.xml.SemanticModules;
+import org.mvel.MVEL;
+
+/**
+ * This class configures the package compiler. 
+ * Dialects and their DialectConfigurations  are handled by the DialectRegistry
+ * Normally you will not need to look at this class, unless you want to override the defaults.
+ * 
+ * This class is not thread safe and it also contains state. Once it is created and used 
+ * in one or more PackageBuilders it should be considered immutable. Do not modify its 
+ * properties while it is being used by a PackageBuilder.
+ * 
+ * drools.dialect.default = <String>
+ * drools.accumulate.function.<function name> = <qualified class>
+ * drools.evaluator.<ident> = <qualified class>
+ * 
+ * default dialect is java.
+ * Available preconfigured Accumulate functions are:
+ * drools.accumulate.function.average = org.drools.base.accumulators.AverageAccumulateFunction
+ * drools.accumulate.function.max = org.drools.base.accumulators.MaxAccumulateFunction
+ * drools.accumulate.function.min = org.drools.base.accumulators.MinAccumulateFunction
+ * drools.accumulate.function.count = org.drools.base.accumulators.CountAccumulateFunction
+ * drools.accumulate.function.sum = org.drools.base.accumulators.SumAccumulateFunction 
+ */
+public class PackageBuilderConfiguration {
+
+    private static final String        ACCUMULATE_FUNCTION_PREFIX  = "drools.accumulate.function.";
+
+    private static final String        EVALUATOR_DEFINITION_PREFIX = "drools.evaluator.";
+
+    private Map                        dialectConfigurations;
+
+    private String                     defaultDialect;
+
+    private ClassLoader                classLoader;
+
+    private ChainedProperties          chainedProperties;
+
+    private Map<String, String>        accumulateFunctions;
+
+    private EvaluatorRegistry          evaluatorRegistry;
+
+    private SemanticModules            semanticModules;
+
+    private ProcessNodeBuilderRegistry nodeBuilderRegistry;
+
+    /**
+     * Constructor that sets the parent class loader for the package being built/compiled
+     * @param classLoader
+     */
+    public PackageBuilderConfiguration(ClassLoader classLoader) {
+        init( classLoader,
+              null );
+    }
+
+    /**
+     * Programmatic properties file, added with lease precedence
+     * @param properties
+     */
+    public PackageBuilderConfiguration(Properties properties) {
+        init( null,
+              properties );
+    }
+
+    /**
+     * Programmatic properties file, added with lease precedence
+     * @param classLoader
+     * @param properties
+     */
+    public PackageBuilderConfiguration(ClassLoader classLoader,
+                                       Properties properties) {
+        init( classLoader,
+              properties );
+    }
+
+    public PackageBuilderConfiguration() {
+        init( null,
+              null );
+    }
+
+    private void init(ClassLoader classLoader,
+                      Properties properties) {
+        if ( classLoader == null ) {
+            classLoader = Thread.currentThread().getContextClassLoader();
+            if ( classLoader == null ) {
+                classLoader = this.getClass().getClassLoader();
+            }
+        }
+        setClassLoader( classLoader );
+
+        this.chainedProperties = new ChainedProperties( this.classLoader,
+                                                        "packagebuilder.conf" );
+
+        if ( properties != null ) {
+            this.chainedProperties.addProperties( properties );
+        }
+
+        this.dialectConfigurations = new HashMap();
+
+        buildDialectConfigurationMap();
+
+        buildAccumulateFunctionsMap();
+
+        buildEvaluatorRegistry();
+    }
+
+    public ChainedProperties getChainedProperties() {
+        return this.chainedProperties;
+    }
+
+    private void buildDialectConfigurationMap() {
+        //DialectRegistry registry = new DialectRegistry();
+        Map dialectProperties = new HashMap();
+        this.chainedProperties.mapStartsWith( dialectProperties,
+                                              "drools.dialect",
+                                              false );
+        setDefaultDialect( (String) dialectProperties.remove( "drools.dialect.default" ) );
+
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        for ( Iterator it = dialectProperties.entrySet().iterator(); it.hasNext(); ) {
+            Entry entry = (Entry) it.next();
+            String str = (String) entry.getKey();
+            String dialectName = str.substring( str.lastIndexOf( "." ) + 1 );
+            String dialectClass = (String) entry.getValue();
+            addDialect( dialectName,
+                        dialectClass );
+        }
+    }
+
+    public void addDialect(String dialectName,
+                           String dialectClass) {
+        try {
+            Class cls = classLoader.loadClass( dialectClass );
+            DialectConfiguration dialectConf = (DialectConfiguration) cls.newInstance();
+            dialectConf.init( this );
+            addDialect( dialectName,
+                        dialectConf );
+        } catch ( Exception e ) {
+            throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + "'",
+                                              e );
+        }
+    }
+
+    public void addDialect(String dialectName,
+                           DialectConfiguration dialectConf) {
+        dialectConfigurations.put( dialectName,
+                                   dialectConf );
+    }
+
+    public DialectRegistry buildDialectRegistry() {
+        DialectRegistry registry = new DialectRegistry();
+        for ( Iterator it = this.dialectConfigurations.values().iterator(); it.hasNext(); ) {
+            DialectConfiguration conf = (DialectConfiguration) it.next();
+            Dialect dialect = conf.getDialect();
+            registry.addDialect( conf.getDialect().getId(),
+                                 dialect );
+        }
+        return registry;
+    }
+
+    public String getDefaultDialect() {
+        return this.defaultDialect;
+    }
+
+    public void setDefaultDialect(String defaultDialect) {
+        this.defaultDialect = defaultDialect;
+    }
+
+    public DialectConfiguration getDialectConfiguration(String name) {
+        return (DialectConfiguration) this.dialectConfigurations.get( name );
+    }
+
+    public void setDialectConfiguration(String name,
+                                        DialectConfiguration configuration) {
+        this.dialectConfigurations.put( name,
+                                        configuration );
+    }
+
+    public ClassLoader getClassLoader() {
+        return this.classLoader;
+    }
+
+    /** Use this to override the classloader that will be used for the rules. */
+    public void setClassLoader(final ClassLoader classLoader) {
+        if ( classLoader != null ) {
+            this.classLoader = classLoader;
+        }
+    }
+
+    public void addSemanticModule(SemanticModule module) {
+        if ( this.semanticModules == null ) {
+            initSemanticModules();
+        }
+        this.semanticModules.addSemanticModule( module );
+    }
+
+    public SemanticModules getSemanticModules() {
+        if ( this.semanticModules == null ) {
+            initSemanticModules();
+        }
+        return this.semanticModules;
+    }
+
+    public void initSemanticModules() {
+        this.semanticModules = new SemanticModules();
+
+        this.semanticModules.addSemanticModule( new ProcessSemanticModule() );
+        this.semanticModules.addSemanticModule( new RulesSemanticModule() );
+
+        // split on each space
+        String locations[] = this.chainedProperties.getProperty( "semanticModules",
+                                                                 "" ).split( "\\s" );
+
+        int i = 0;
+        // load each SemanticModule
+        for ( String moduleLocation : locations ) {
+            // trim leading/trailing spaces and quotes
+            moduleLocation = moduleLocation.trim();
+            if ( moduleLocation.startsWith( "\"" ) ) {
+                moduleLocation = moduleLocation.substring( 1 );
+            }
+            if ( moduleLocation.endsWith( "\"" ) ) {
+                moduleLocation = moduleLocation.substring( 0,
+                                                           moduleLocation.length() - 1 );
+            }
+            if ( !moduleLocation.equals( "" ) ) {
+                loadSemanticModule( moduleLocation );
+            }
+        }
+    }
+
+    public void loadSemanticModule(String moduleLocation) {
+        URL url = ConfFileUtils.getURL( moduleLocation,
+                                        this.classLoader,
+                                        getClass() );
+        if ( url == null ) {
+            throw new IllegalArgumentException( moduleLocation + " is specified but cannot be found.'" );
+        }
+
+        Properties properties = ConfFileUtils.getProperties( url );
+        if ( properties == null ) {
+            throw new IllegalArgumentException( moduleLocation + " is specified but cannot be found.'" );
+        }
+
+        loadSemanticModule( properties );
+    }
+
+    public void loadSemanticModule(Properties properties) {
+        String uri = properties.getProperty( "uri",
+                                             null );
+        if ( uri == null || uri.trim().equals( "" ) ) {
+            throw new RuntimeException( "Semantic Module URI property must not be empty" );
+        }
+
+        DefaultSemanticModule module = new DefaultSemanticModule( uri );
+
+        for ( Entry<Object, Object> entry : properties.entrySet() ) {
+            String elementName = (String) entry.getKey();
+
+            //uri is processed above, so skip
+            if ( "uri".equals( elementName ) ) {
+                continue;
+            }
+
+            if ( elementName == null || elementName.trim().equals( "" ) ) {
+                throw new RuntimeException( "Element name must be specified for Semantic Module handler" );
+            }
+            String handlerName = (String) entry.getValue();
+            if ( handlerName == null || handlerName.trim().equals( "" ) ) {
+                throw new RuntimeException( "Handler name must be specified for Semantic Module" );
+            }
+
+            Handler handler = (Handler) ClassUtils.instantiateObject( handlerName,
+                                                                      this.classLoader );
+
+            if ( handler == null ) {
+                throw new RuntimeException( "Unable to load Semantic Module handler '" + elementName + ":" + handlerName + "'" );
+            } else {
+                module.addHandler( elementName,
+                                   handler );
+            }
+        }
+        this.semanticModules.addSemanticModule( module );
+    }
+
+    public ProcessNodeBuilderRegistry getProcessNodeBuilderRegistry() {
+        if ( this.nodeBuilderRegistry == null ) {
+            initProcessNodeBuilderRegistry();
+        }
+        return this.nodeBuilderRegistry;
+
+    }
+
+    private void initProcessNodeBuilderRegistry() {
+        this.nodeBuilderRegistry = new ProcessNodeBuilderRegistry();
+
+        // split on each space
+        String locations[] = this.chainedProperties.getProperty( "processNodeBuilderRegistry",
+                                                                 "" ).split( "\\s" );
+
+        int i = 0;
+        // load each SemanticModule
+        for ( String builderLocation : locations ) {
+            // trim leading/trailing spaces and quotes
+            builderLocation = builderLocation.trim();
+            if ( builderLocation.startsWith( "\"" ) ) {
+                builderLocation = builderLocation.substring( 1 );
+            }
+            if ( builderLocation.endsWith( "\"" ) ) {
+                builderLocation = builderLocation.substring( 0,
+                                                             builderLocation.length() - 1 );
+            }
+            if ( !builderLocation.equals( "" ) ) {
+                loadProcessNodeBuilderRegistry( builderLocation );
+            }
+        }
+    }
+
+    private void loadProcessNodeBuilderRegistry(String factoryLocation) {
+        String content = ConfFileUtils.URLContentsToString( ConfFileUtils.getURL( factoryLocation,
+                                                                                  null,
+                                                                                  RuleBaseConfiguration.class ) );
+
+        Map<Class< ? extends Node>, ProcessNodeBuilder> map = (Map<Class< ? extends Node>, ProcessNodeBuilder>) MVEL.eval( content,
+                                                                                                                           new HashMap() );
+
+        if ( map != null ) {
+            for ( Entry<Class< ? extends Node>, ProcessNodeBuilder> entry : map.entrySet() ) {
+                this.nodeBuilderRegistry.register( entry.getKey(),
+                                                   entry.getValue() );
+            }
+        }
+    }
+
+    private void buildAccumulateFunctionsMap() {
+        this.accumulateFunctions = new HashMap<String, String>();
+        Map temp = new HashMap();
+        this.chainedProperties.mapStartsWith( temp,
+                                              ACCUMULATE_FUNCTION_PREFIX,
+                                              true );
+        for ( Iterator it = temp.entrySet().iterator(); it.hasNext(); ) {
+            Map.Entry entry = (Map.Entry) it.next();
+            String identifier = ((String) entry.getKey()).trim().substring( ACCUMULATE_FUNCTION_PREFIX.length() );
+            this.accumulateFunctions.put( identifier,
+                                          (String) entry.getValue() );
+        }
+    }
+
+    public Map<String, String> getAccumulateFunctionsMap() {
+        return Collections.unmodifiableMap( this.accumulateFunctions );
+    }
+
+    public void addAccumulateFunction(String identifier,
+                                      String className) {
+        this.accumulateFunctions.put( identifier,
+                                      className );
+    }
+
+    public void addAccumulateFunction(String identifier,
+                                      Class clazz) {
+        this.accumulateFunctions.put( identifier,
+                                      clazz.getName() );
+    }
+
+    public AccumulateFunction getAccumulateFunction(String identifier) {
+        String className = this.accumulateFunctions.get( identifier );
+        if ( className == null ) {
+            throw new RuntimeDroolsException( "No accumulator function found for identifier: " + identifier );
+        }
+        try {
+            Class clazz = this.classLoader.loadClass( className );
+            return (AccumulateFunction) clazz.newInstance();
+        } catch ( ClassNotFoundException e ) {
+            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Class " + className + " not found",
+                                              e );
+        } catch ( InstantiationException e ) {
+            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Instantiation failed for class " + className,
+                                              e );
+        } catch ( IllegalAccessException e ) {
+            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Illegal access to class " + className,
+                                              e );
+        }
+    }
+
+    private void buildEvaluatorRegistry() {
+        this.evaluatorRegistry = new EvaluatorRegistry( this.classLoader );
+        Map temp = new HashMap();
+        this.chainedProperties.mapStartsWith( temp,
+                                              EVALUATOR_DEFINITION_PREFIX,
+                                              true );
+        for ( Iterator it = temp.values().iterator(); it.hasNext(); ) {
+            String className = (String) it.next();
+            this.evaluatorRegistry.addEvaluatorDefinition( className );
+        }
+    }
+
+    /**
+     * Returns the evaluator registry for this package builder configuration
+     * @return
+     */
+    public EvaluatorRegistry getEvaluatorRegistry() {
+        return this.evaluatorRegistry;
+    }
+
+    /**
+     * Adds an evaluator definition class to the registry using the
+     * evaluator class name. The class will be loaded and the corresponting
+     * evaluator ID will be added to the registry. In case there exists
+     * an implementation for that ID already, the new implementation will
+     * replace the previous one.
+     * 
+     * @param className the name of the class for the implementation definition.
+     *                  The class must implement the EvaluatorDefinition interface.
+     * 
+     */
+    public void addEvaluatorDefinition(String className) {
+        this.evaluatorRegistry.addEvaluatorDefinition( className );
+    }
+
+    /**
+     * Adds an evaluator definition class to the registry. In case there exists
+     * an implementation for that evaluator ID already, the new implementation will
+     * replace the previous one.
+     * 
+     * @param def the evaluator definition to be added.
+     * 
+     */
+    public void addEvaluatorDefinition(EvaluatorDefinition def) {
+        this.evaluatorRegistry.addEvaluatorDefinition( def );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderErrors.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderErrors.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/PackageBuilderErrors.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.compiler;
+
+
+public class PackageBuilderErrors {
+    private DroolsError[] errors;
+
+    public PackageBuilderErrors(DroolsError[] errors) {
+        this.errors = errors;
+    }
+
+    public DroolsError[]  getErrors() {
+        return errors;
+    }
+    
+    public String toString() {
+        final StringBuffer buf = new StringBuffer();
+        for ( int i = 0, length = this.errors.length; i < length; i++) {
+            buf.append( errors[i] );
+        }
+        return buf.toString();        
+    }
+    
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ParserError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ParserError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ParserError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ParserError extends DroolsError {
+    private int    row;
+    private int    col;
+    private String message;
+
+    public ParserError(final String message,
+                       final int row,
+                       final int col) {
+        super();
+        this.message = message;
+        this.row = row;
+        this.col = col;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+    
+    public int[] getErrorLines() {
+        return new int[] { this.row };
+    }
+
+    public int getCol() {
+        return this.col;
+    }
+
+    public int getRow() {
+        return this.row;
+    }
+
+    public String toString() {
+        return "[" + this.row + "," + this.col + "]: " + this.message;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuildError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuildError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuildError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.compiler;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.process.core.Process;
+
+public class ProcessBuildError extends DescrBuildError {
+    private final Process process;
+    public ProcessBuildError(final Process process,
+                           final BaseDescr descr,
+                           final Object object,
+                           final String message) {
+              super(descr, descr, object, message);
+              this.process = process;
+          }
+    
+    public Process getProcess() {
+        return this.process;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ProcessBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,238 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.process.builder.ProcessNodeBuilder;
+import org.drools.process.builder.ProcessNodeBuilderRegistry;
+import org.drools.process.core.Process;
+import org.drools.process.core.validation.ProcessValidationError;
+import org.drools.process.core.validation.ProcessValidator;
+import org.drools.rule.Package;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.validation.RuleFlowProcessValidator;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Constraint;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.NodeContainer;
+import org.drools.workflow.core.WorkflowProcess;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.MilestoneNode;
+import org.drools.workflow.core.node.Split;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * A ProcessBuilder can be used to build processes based on XML files
+ * containing a process definition.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ProcessBuilder {
+
+    private PackageBuilder packageBuilder;
+    private final List     errors = new ArrayList();
+    private Map<String, ProcessValidator> processValidators = new HashMap<String, ProcessValidator>();;
+
+    public ProcessBuilder(PackageBuilder packageBuilder) {
+        this.packageBuilder = packageBuilder;
+        this.processValidators.put(RuleFlowProcess.RULEFLOW_TYPE, RuleFlowProcessValidator.getInstance());
+    }
+
+    public List getErrors() {
+        return errors;
+    }
+
+    public void buildProcess(final Process process) {
+        boolean hasErrors = false;
+        ProcessValidator validator = processValidators.get(process.getType());
+        if (validator == null) {
+            System.out.println("Could not find validator for process " + process.getType() + ".");
+            System.out.println("Continuing without validation of the process " + process.getName() + "[" + process.getId() + "]");
+        } else {
+            ProcessValidationError[] errors = validator.validateProcess( (WorkflowProcess) process );
+            if ( errors.length != 0 ) {
+                hasErrors = true;
+                for ( int i = 0; i < errors.length; i++ ) {
+                    this.errors.add( new ParserError( errors[i].toString(),
+                                                      -1,
+                                                      -1 ) );
+                }
+            }
+        }
+        if ( !hasErrors ) {
+            // generate and add rule for process
+            String rules = generateRules( process );
+            try {
+                packageBuilder.addPackageFromDrl( new StringReader( rules ) );
+            } catch ( IOException e ) {
+                // should never occur
+                e.printStackTrace( System.err );
+            } catch ( DroolsParserException e ) {
+                // should never occur
+                e.printStackTrace( System.err );
+            }
+            buildNodes( process );
+            this.packageBuilder.getPackage().addRuleFlow( process );
+
+            Package pkg = this.packageBuilder.getPackage();
+            if ( pkg != null ) {
+                // we can only do this is this.pkg != null, as otherwise the dialects won't be properly initialised
+                // as the dialects are initialised when the pkg is  first created
+                this.packageBuilder.getDialectRegistry().compileAll();
+
+                // some of the rules and functions may have been redefined
+                if ( pkg.getPackageCompilationData().isDirty() ) {
+                    pkg.getPackageCompilationData().reload();
+                }
+            }
+        }
+    }
+
+    
+
+    public void buildNodes(Process process) {
+        ProcessNodeBuilderRegistry nodeBuilderRegistry = packageBuilder.getPackageBuilderConfiguration().getProcessNodeBuilderRegistry();
+
+        WorkflowProcess rfp = (WorkflowProcess) process;
+
+        ProcessDescr processDescr = new ProcessDescr();
+        processDescr.setName( rfp.getPackageName() );
+
+        Dialect dialect = this.packageBuilder.getDialectRegistry().getDialect( "java" );
+        dialect.init( processDescr );
+
+        ProcessBuildContext context = new ProcessBuildContext( this.packageBuilder.getPackageBuilderConfiguration(),
+                                                               this.packageBuilder.getPackage(),
+                                                               process,
+                                                               processDescr,
+                                                               this.packageBuilder.getDialectRegistry(),
+                                                               dialect );
+
+        processNodes(rfp.getNodes(), process, processDescr, context, nodeBuilderRegistry);
+
+        if ( !context.getErrors().isEmpty() ) {
+            this.errors.addAll( context.getErrors() );
+        }
+
+        for ( Iterator it = this.packageBuilder.getDialectRegistry().iterator(); it.hasNext(); ) {
+            dialect = (Dialect) it.next();
+            dialect.addProcess( context );
+        }
+
+    }
+    
+    private void processNodes(
+            Node[] nodes, Process process, ProcessDescr processDescr, 
+            ProcessBuildContext context, ProcessNodeBuilderRegistry nodeBuilderRegistry) {
+        for ( Node node : nodes ) {
+            ProcessNodeBuilder builder = nodeBuilderRegistry.getNodeBuilder( node );
+            if ( builder != null ) {
+                // only build if there is a registered builder for this node type
+                builder.build( process,
+                               processDescr,
+                               context,
+                               node );
+            }
+            if (node instanceof NodeContainer) {
+                processNodes(((NodeContainer) node).getNodes(), process, processDescr, context, nodeBuilderRegistry);
+            }
+        }
+    }
+
+    public void addProcessFromFile(final Reader reader) throws Exception {
+        final XStream stream = new XStream();
+        stream.setMode( XStream.ID_REFERENCES );
+        final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+        final ClassLoader newLoader = this.getClass().getClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader( newLoader );
+            final WorkflowProcess process = (WorkflowProcess) stream.fromXML( reader );
+            buildProcess( process );
+        } finally {
+            Thread.currentThread().setContextClassLoader( oldLoader );
+        }
+        reader.close();
+    }
+
+    private String generateRules(final Process process) {
+        StringBuilder builder = new StringBuilder();
+
+        if ( process instanceof WorkflowProcessImpl ) {
+            WorkflowProcessImpl ruleFlow = (WorkflowProcessImpl) process;
+            builder.append( "package " + ruleFlow.getPackageName() + "\n" );
+            List imports = ruleFlow.getImports();
+            if ( imports != null ) {
+                for ( Iterator iterator = imports.iterator(); iterator.hasNext(); ) {
+                    builder.append( "import " + iterator.next() + ";\n" );
+                }
+            }
+            Map globals = ruleFlow.getGlobals();
+            if ( globals != null ) {
+                for ( Iterator iterator = globals.entrySet().iterator(); iterator.hasNext(); ) {
+                    Map.Entry entry = (Map.Entry) iterator.next();
+                    builder.append( "global " + entry.getValue() + " " + entry.getKey() + ";\n" );
+                }
+            }
+
+            Node[] nodes = ruleFlow.getNodes();
+            for ( int i = 0; i < nodes.length; i++ ) {
+                if ( nodes[i] instanceof Split ) {
+                    Split split = (Split) nodes[i];
+                    if ( split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR ) {
+                        for ( Iterator iterator = split.getDefaultOutgoingConnections().iterator(); iterator.hasNext(); ) {
+                            Connection connection = (Connection) iterator.next();
+                            Constraint constraint = split.getConstraint( connection );
+                            if ( "rule".equals( constraint.getType() ) ) {
+                                builder.append( createSplitRule( process,
+                                                                 connection,
+                                                                 split.getConstraint( connection ).getConstraint() ) );
+                            }
+                        }
+                    }
+                } else if ( nodes[i] instanceof MilestoneNode ) {
+                    MilestoneNode milestone = (MilestoneNode) nodes[i];
+                    builder.append( createMilestoneRule( process,
+                                                         milestone ) );
+                }
+            }
+        }
+        return builder.toString();
+    }
+
+    private String createSplitRule(Process process,
+                                   Connection connection,
+                                   String constraint) {
+        return "rule \"RuleFlow-Split-" + process.getId() + "-" + connection.getFrom().getId() + "-" + connection.getTo().getId() + "\" \n" + "      ruleflow-group \"DROOLS_SYSTEM\" \n" + "    when \n" + "      " + constraint + "\n" + "    then \n"
+               + "end \n\n";
+    }
+
+    private String createMilestoneRule(Process process,
+                                       MilestoneNode milestone) {
+        return "rule \"RuleFlow-Milestone-" + process.getId() + "-" + milestone.getId() + "\" \n" + "      ruleflow-group \"DROOLS_SYSTEM\" \n" + "    when \n" + "      " + milestone.getConstraint() + "\n" + "    then \n" + "end \n\n";
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ReturnValueDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ReturnValueDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/ReturnValueDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.compiler;
+
+import org.drools.lang.descr.BaseDescr;
+
+public class ReturnValueDescr extends BaseDescr {
+    private String text;
+    
+    public ReturnValueDescr() {
+        
+    }
+    
+    public ReturnValueDescr(String text) {
+        super();
+        this.text = text;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBaseLoader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBaseLoader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBaseLoader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,75 @@
+package org.drools.compiler;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.drools.CheckedDroolsException;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.rule.Package;
+
+/**
+ * A high level helper class for creating rulebases from source.
+ * For additional control, refer to the DrlParser and PackageBuilder classes.
+ * You can have much more detailed control with the lower level classes.
+ * 
+ * @author Michael Neale
+ */
+public class RuleBaseLoader {
+
+    private static final RuleBaseLoader INSTANCE   = new RuleBaseLoader();
+    private static int                  engineType = RuleBase.RETEOO;
+
+    private RuleBaseLoader() {
+    }
+
+    /** Get an instance of the loader */
+    public static RuleBaseLoader getInstance() {
+        return RuleBaseLoader.INSTANCE;
+    }
+
+    /**
+     * Create a new RuleBase from the drl source. 
+     * Uses the current default engine type.
+     */
+    public RuleBase loadFromReader(final Reader drl) throws CheckedDroolsException,
+                                                    IOException {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( drl );
+        return makeRuleBase( builder );
+    }
+
+    /**
+     * Create a new RuleBase from the drl and dsl source.
+     * Uses the current default engine type.
+     */
+    public RuleBase loadFromReader(final Reader drl,
+                                   final Reader dsl) throws CheckedDroolsException,
+                                                    IOException {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( drl,
+                                   dsl );
+        return makeRuleBase( builder );
+    }
+
+    /** Replace the default engine type that will be used (default is RETEOO) */
+    public void setDefaultEngineType(final int type) {
+        RuleBaseLoader.engineType = type;
+    }
+
+    private RuleBase makeRuleBase(final PackageBuilder builder) throws CheckedDroolsException {
+        if ( builder.hasErrors() ) {
+            throw new CheckedDroolsException( "There were errors in the rule source: " + builder.getErrors().toString() );
+        }
+        final Package binaryPackage = builder.getPackage();
+
+        final RuleBase rb = RuleBaseFactory.newRuleBase( RuleBaseLoader.engineType );
+        try {
+            rb.addPackage( binaryPackage );
+        } catch ( final Exception e ) {
+            throw new CheckedDroolsException( "Unable to add compiled package to rulebase. Nested error is: " + e.getMessage() );
+        }
+        return rb;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBuildError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBuildError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleBuildError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.compiler;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Rule;
+
+public class RuleBuildError extends DescrBuildError {
+    private final Rule rule;
+    public RuleBuildError(final Rule rule,
+                           final BaseDescr descr,
+                           final Object object,
+                           final String message) {
+              super(descr, descr, object, message);
+              this.rule = rule;
+          }
+    
+    public Rule getRule() {
+        return this.rule;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleFlowLoadError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleFlowLoadError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/RuleFlowLoadError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.compiler;
+
+import java.io.PrintStream;
+import java.io.StringWriter;
+
+/**
+ * This is used for reporting errors with loading a ruleflow.
+ * @author Michael Neale
+ *
+ */
+public class RuleFlowLoadError extends DroolsError {
+
+    private String message;
+    private Exception exception;
+    private static final int[] lines = new int[0];
+
+    public RuleFlowLoadError(String message, Exception nested) {
+        
+        this.message = message;
+        this.exception = nested;
+    }
+    
+    public int[] getErrorLines() {
+        return this.lines;
+    }
+    
+    public String getMessage() {
+        if (exception != null) {
+            return message + " : Exception " + exception.getClass() + " : "+ exception.getMessage();
+        } else {
+            return message;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/SourcePackageProvider.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/SourcePackageProvider.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/SourcePackageProvider.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,40 @@
+package org.drools.compiler;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.agent.FileLoader;
+import org.drools.rule.Package;
+
+/**
+ * This is used by the agent when a source file is encountered.
+ * @author michaelneale
+ *
+ */
+public class SourcePackageProvider implements FileLoader {
+
+	public Package loadPackage(File drl) throws IOException {
+		FileInputStream fin = new FileInputStream(drl);
+
+		PackageBuilder b = new PackageBuilder();
+		try {
+			b.addPackageFromDrl(new InputStreamReader(fin));
+			if (b.hasErrors()) {
+				throw new RuntimeDroolsException("Error building rules from source: " + b.getErrors());
+			} else {
+				return b.getPackage();
+			}
+		} catch (DroolsParserException e) {
+			throw new RuntimeException(e);
+		}
+
+
+
+	}
+
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/TypeDeclarationError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/TypeDeclarationError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/compiler/TypeDeclarationError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,40 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TypeDeclarationError extends DroolsError {
+    private String errorMessage;
+    private int[]  line;
+
+    public TypeDeclarationError(final String errorMessage, final int line) {
+        this.errorMessage = errorMessage;
+        this.line = new int[] { line };
+    }
+
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    public String getMessage() {
+        return this.errorMessage;
+    }
+    
+    public String toString() {
+        return this.getMessage();
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLLexer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLLexer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLLexer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3549 @@
+// $ANTLR 3.0.1 C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g 2008-03-12 13:23:57
+
+	package org.drools.lang;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+public class DRLLexer extends Lexer {
+    public static final int ACCUMULATE=46;
+    public static final int PACKAGE=4;
+    public static final int FUNCTION=6;
+    public static final int RIGHT_SQUARE=64;
+    public static final int T79=79;
+    public static final int ACTIVATION_GROUP=31;
+    public static final int T77=77;
+    public static final int ATTRIBUTES=22;
+    public static final int RIGHT_CURLY=15;
+    public static final int T78=78;
+    public static final int DIALECT=35;
+    public static final int CONTAINS=54;
+    public static final int NO_LOOP=29;
+    public static final int LOCK_ON_ACTIVE=36;
+    public static final int MEMBEROF=58;
+    public static final int AGENDA_GROUP=33;
+    public static final int FLOAT=61;
+    public static final int NOT=43;
+    public static final int SH_STYLE_SINGLE_LINE_COMMENT=73;
+    public static final int ID=7;
+    public static final int AND=39;
+    public static final int EOF=-1;
+    public static final int HexDigit=70;
+    public static final int DATE_EFFECTIVE=23;
+    public static final int ACTION=48;
+    public static final int DOUBLE_PIPE=38;
+    public static final int RIGHT_PAREN=12;
+    public static final int IMPORT=5;
+    public static final int EOL=67;
+    public static final int DOUBLE_AMPER=40;
+    public static final int THEN=65;
+    public static final int IN=60;
+    public static final int MATCHES=56;
+    public static final int COMMA=11;
+    public static final int TILDE=59;
+    public static final int ENABLED=25;
+    public static final int EXISTS=42;
+    public static final int DOT=8;
+    public static final int RULE=20;
+    public static final int TIMEWINDOW=51;
+    public static final int EXCLUDES=55;
+    public static final int AUTO_FOCUS=30;
+    public static final int NULL=62;
+    public static final int SOUNDSLIKE=57;
+    public static final int BOOL=26;
+    public static final int FORALL=45;
+    public static final int RULEFLOW_GROUP=32;
+    public static final int SALIENCE=27;
+    public static final int RESULT=50;
+    public static final int INT=28;
+    public static final int EVENT=66;
+    public static final int Tokens=87;
+    public static final int MULTI_LINE_COMMENT=75;
+    public static final int DURATION=34;
+    public static final int T84=84;
+    public static final int WS=68;
+    public static final int T85=85;
+    public static final int T86=86;
+    public static final int TEMPLATE=19;
+    public static final int EVAL=44;
+    public static final int WHEN=21;
+    public static final int ENTRY_POINT=53;
+    public static final int UnicodeEscape=71;
+    public static final int LEFT_CURLY=14;
+    public static final int OR=37;
+    public static final int LEFT_PAREN=10;
+    public static final int DECLARE=13;
+    public static final int QUERY=17;
+    public static final int T81=81;
+    public static final int FROM=41;
+    public static final int GLOBAL=9;
+    public static final int END=18;
+    public static final int REVERSE=49;
+    public static final int MISC=76;
+    public static final int T80=80;
+    public static final int COLLECT=52;
+    public static final int T83=83;
+    public static final int INIT=47;
+    public static final int LEFT_SQUARE=63;
+    public static final int T82=82;
+    public static final int EscapeSequence=69;
+    public static final int OctalEscape=72;
+    public static final int C_STYLE_SINGLE_LINE_COMMENT=74;
+    public static final int DATE_EXPIRES=24;
+    public static final int STRING=16;
+    public DRLLexer() {;} 
+    public DRLLexer(CharStream input) {
+        super(input);
+        ruleMemo = new HashMap[85+1];
+     }
+    public String getGrammarFileName() { return "C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g"; }
+
+    // $ANTLR start T77
+    public final void mT77() throws RecognitionException {
+        try {
+            int _type = T77;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:6:5: ( ';' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:6:7: ';'
+            {
+            match(';'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T77
+
+    // $ANTLR start T78
+    public final void mT78() throws RecognitionException {
+        try {
+            int _type = T78;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:7:5: ( '.*' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:7:7: '.*'
+            {
+            match(".*"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T78
+
+    // $ANTLR start T79
+    public final void mT79() throws RecognitionException {
+        try {
+            int _type = T79;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:8:5: ( ':' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:8:7: ':'
+            {
+            match(':'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T79
+
+    // $ANTLR start T80
+    public final void mT80() throws RecognitionException {
+        try {
+            int _type = T80;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:9:5: ( '->' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:9:7: '->'
+            {
+            match("->"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T80
+
+    // $ANTLR start T81
+    public final void mT81() throws RecognitionException {
+        try {
+            int _type = T81;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:10:5: ( '==' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:10:7: '=='
+            {
+            match("=="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T81
+
+    // $ANTLR start T82
+    public final void mT82() throws RecognitionException {
+        try {
+            int _type = T82;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:11:5: ( '>' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:11:7: '>'
+            {
+            match('>'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T82
+
+    // $ANTLR start T83
+    public final void mT83() throws RecognitionException {
+        try {
+            int _type = T83;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:12:5: ( '>=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:12:7: '>='
+            {
+            match(">="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T83
+
+    // $ANTLR start T84
+    public final void mT84() throws RecognitionException {
+        try {
+            int _type = T84;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:13:5: ( '<' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:13:7: '<'
+            {
+            match('<'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T84
+
+    // $ANTLR start T85
+    public final void mT85() throws RecognitionException {
+        try {
+            int _type = T85;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:14:5: ( '<=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:14:7: '<='
+            {
+            match("<="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T85
+
+    // $ANTLR start T86
+    public final void mT86() throws RecognitionException {
+        try {
+            int _type = T86;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:15:5: ( '!=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:15:7: '!='
+            {
+            match("!="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T86
+
+    // $ANTLR start WS
+    public final void mWS() throws RecognitionException {
+        try {
+            int _type = WS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:9: ( ( ' ' | '\\t' | '\\f' | EOL )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:17: ( ' ' | '\\t' | '\\f' | EOL )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:17: ( ' ' | '\\t' | '\\f' | EOL )+
+            int cnt1=0;
+            loop1:
+            do {
+                int alt1=5;
+                switch ( input.LA(1) ) {
+                case ' ':
+                    {
+                    alt1=1;
+                    }
+                    break;
+                case '\t':
+                    {
+                    alt1=2;
+                    }
+                    break;
+                case '\f':
+                    {
+                    alt1=3;
+                    }
+                    break;
+                case '\n':
+                case '\r':
+                    {
+                    alt1=4;
+                    }
+                    break;
+
+                }
+
+                switch (alt1) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:19: ' '
+            	    {
+            	    match(' '); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1822:19: '\\t'
+            	    {
+            	    match('\t'); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 3 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1823:19: '\\f'
+            	    {
+            	    match('\f'); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 4 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1824:19: EOL
+            	    {
+            	    mEOL(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt1 >= 1 ) break loop1;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(1, input);
+                        throw eee;
+                }
+                cnt1++;
+            } while (true);
+
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end WS
+
+    // $ANTLR start EOL
+    public final void mEOL() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1830:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            int alt2=3;
+            int LA2_0 = input.LA(1);
+
+            if ( (LA2_0=='\r') ) {
+                int LA2_1 = input.LA(2);
+
+                if ( (LA2_1=='\n') && (synpred1())) {
+                    alt2=1;
+                }
+                else {
+                    alt2=2;}
+            }
+            else if ( (LA2_0=='\n') ) {
+                alt2=3;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+
+                throw nvae;
+            }
+            switch (alt2) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:14: ( '\\r\\n' )=> '\\r\\n'
+                    {
+                    match("\r\n"); if (failed) return ;
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1832:25: '\\r'
+                    {
+                    match('\r'); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1833:25: '\\n'
+                    {
+                    match('\n'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EOL
+
+    // $ANTLR start INT
+    public final void mINT() throws RecognitionException {
+        try {
+            int _type = INT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:2: ( ( '-' )? ( '0' .. '9' )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:4: ( '-' )? ( '0' .. '9' )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:4: ( '-' )?
+            int alt3=2;
+            int LA3_0 = input.LA(1);
+
+            if ( (LA3_0=='-') ) {
+                alt3=1;
+            }
+            switch (alt3) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:5: '-'
+                    {
+                    match('-'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:10: ( '0' .. '9' )+
+            int cnt4=0;
+            loop4:
+            do {
+                int alt4=2;
+                int LA4_0 = input.LA(1);
+
+                if ( ((LA4_0>='0' && LA4_0<='9')) ) {
+                    alt4=1;
+                }
+
+
+                switch (alt4) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:11: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt4 >= 1 ) break loop4;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(4, input);
+                        throw eee;
+                }
+                cnt4++;
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end INT
+
+    // $ANTLR start FLOAT
+    public final void mFLOAT() throws RecognitionException {
+        try {
+            int _type = FLOAT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:4: ( '-' )?
+            int alt5=2;
+            int LA5_0 = input.LA(1);
+
+            if ( (LA5_0=='-') ) {
+                alt5=1;
+            }
+            switch (alt5) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:5: '-'
+                    {
+                    match('-'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:10: ( '0' .. '9' )+
+            int cnt6=0;
+            loop6:
+            do {
+                int alt6=2;
+                int LA6_0 = input.LA(1);
+
+                if ( ((LA6_0>='0' && LA6_0<='9')) ) {
+                    alt6=1;
+                }
+
+
+                switch (alt6) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:11: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt6 >= 1 ) break loop6;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(6, input);
+                        throw eee;
+                }
+                cnt6++;
+            } while (true);
+
+            match('.'); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:26: ( '0' .. '9' )+
+            int cnt7=0;
+            loop7:
+            do {
+                int alt7=2;
+                int LA7_0 = input.LA(1);
+
+                if ( ((LA7_0>='0' && LA7_0<='9')) ) {
+                    alt7=1;
+                }
+
+
+                switch (alt7) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:27: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt7 >= 1 ) break loop7;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(7, input);
+                        throw eee;
+                }
+                cnt7++;
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FLOAT
+
+    // $ANTLR start STRING
+    public final void mSTRING() throws RecognitionException {
+        try {
+            int _type = STRING;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
+            int alt10=2;
+            int LA10_0 = input.LA(1);
+
+            if ( (LA10_0=='\"') ) {
+                alt10=1;
+            }
+            else if ( (LA10_0=='\'') ) {
+                alt10=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1845:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
+
+                throw nvae;
+            }
+            switch (alt10) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+                    {
+                    match('\"'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+                    loop8:
+                    do {
+                        int alt8=3;
+                        int LA8_0 = input.LA(1);
+
+                        if ( (LA8_0=='\\') ) {
+                            alt8=1;
+                        }
+                        else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFE')) ) {
+                            alt8=2;
+                        }
+
+
+                        switch (alt8) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:15: EscapeSequence
+                    	    {
+                    	    mEscapeSequence(); if (failed) return ;
+
+                    	    }
+                    	    break;
+                    	case 2 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:32: ~ ( '\\\\' | '\"' )
+                    	    {
+                    	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+                    	        input.consume();
+                    	    failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return ;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recover(mse);    throw mse;
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop8;
+                        }
+                    } while (true);
+
+                    match('\"'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
+                    {
+                    match('\''); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
+                    loop9:
+                    do {
+                        int alt9=3;
+                        int LA9_0 = input.LA(1);
+
+                        if ( (LA9_0=='\\') ) {
+                            alt9=1;
+                        }
+                        else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFE')) ) {
+                            alt9=2;
+                        }
+
+
+                        switch (alt9) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:16: EscapeSequence
+                    	    {
+                    	    mEscapeSequence(); if (failed) return ;
+
+                    	    }
+                    	    break;
+                    	case 2 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:33: ~ ( '\\\\' | '\\'' )
+                    	    {
+                    	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+                    	        input.consume();
+                    	    failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return ;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recover(mse);    throw mse;
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop9;
+                        }
+                    } while (true);
+
+                    match('\''); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end STRING
+
+    // $ANTLR start HexDigit
+    public final void mHexDigit() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1851:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1851:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+            {
+            if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end HexDigit
+
+    // $ANTLR start EscapeSequence
+    public final void mEscapeSequence() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1855:5: ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape )
+            int alt11=3;
+            int LA11_0 = input.LA(1);
+
+            if ( (LA11_0=='\\') ) {
+                switch ( input.LA(2) ) {
+                case '\"':
+                case '$':
+                case '&':
+                case '\'':
+                case '(':
+                case ')':
+                case '*':
+                case '+':
+                case '-':
+                case '.':
+                case '?':
+                case 'A':
+                case 'B':
+                case 'D':
+                case 'E':
+                case 'G':
+                case 'Q':
+                case 'S':
+                case 'W':
+                case 'Z':
+                case '[':
+                case '\\':
+                case ']':
+                case '^':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                case 'n':
+                case 'o':
+                case 'p':
+                case 'r':
+                case 's':
+                case 't':
+                case 'w':
+                case 'x':
+                case 'z':
+                case '{':
+                case '|':
+                case '}':
+                    {
+                    alt11=1;
+                    }
+                    break;
+                case 'u':
+                    {
+                    alt11=2;
+                    }
+                    break;
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                    {
+                    alt11=3;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1853:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
+
+                    throw nvae;
+                }
+
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1853:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
+
+                throw nvae;
+            }
+            switch (alt11) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1855:9: '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' )
+                    {
+                    match('\\'); if (failed) return ;
+                    if ( input.LA(1)=='\"'||input.LA(1)=='$'||(input.LA(1)>='&' && input.LA(1)<='+')||(input.LA(1)>='-' && input.LA(1)<='.')||input.LA(1)=='?'||(input.LA(1)>='A' && input.LA(1)<='B')||(input.LA(1)>='D' && input.LA(1)<='E')||input.LA(1)=='G'||input.LA(1)=='Q'||input.LA(1)=='S'||input.LA(1)=='W'||(input.LA(1)>='Z' && input.LA(1)<='^')||(input.LA(1)>='a' && input.LA(1)<='f')||(input.LA(1)>='n' && input.LA(1)<='p')||(input.LA(1)>='r' && input.LA(1)<='t')||(input.LA(1)>='w' && input.LA(1)<='x')||(input.LA(1)>='z' && input.LA(1)<='}') ) {
+                        input.consume();
+                    failed=false;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        MismatchedSetException mse =
+                            new MismatchedSetException(null,input);
+                        recover(mse);    throw mse;
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1859:9: UnicodeEscape
+                    {
+                    mUnicodeEscape(); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1860:9: OctalEscape
+                    {
+                    mOctalEscape(); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EscapeSequence
+
+    // $ANTLR start OctalEscape
+    public final void mOctalEscape() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+            int alt12=3;
+            int LA12_0 = input.LA(1);
+
+            if ( (LA12_0=='\\') ) {
+                int LA12_1 = input.LA(2);
+
+                if ( ((LA12_1>='0' && LA12_1<='3')) ) {
+                    int LA12_2 = input.LA(3);
+
+                    if ( ((LA12_2>='0' && LA12_2<='7')) ) {
+                        int LA12_5 = input.LA(4);
+
+                        if ( ((LA12_5>='0' && LA12_5<='7')) ) {
+                            alt12=1;
+                        }
+                        else {
+                            alt12=2;}
+                    }
+                    else {
+                        alt12=3;}
+                }
+                else if ( ((LA12_1>='4' && LA12_1<='7')) ) {
+                    int LA12_3 = input.LA(3);
+
+                    if ( ((LA12_3>='0' && LA12_3<='7')) ) {
+                        alt12=2;
+                    }
+                    else {
+                        alt12=3;}
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1863:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1863:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
+
+                throw nvae;
+            }
+            switch (alt12) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:14: ( '0' .. '3' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:15: '0' .. '3'
+                    {
+                    matchRange('0','3'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:25: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:36: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:37: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:14: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:25: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:9: '\\\\' ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:14: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OctalEscape
+
+    // $ANTLR start UnicodeEscape
+    public final void mUnicodeEscape() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1872:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1872:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+            {
+            match('\\'); if (failed) return ;
+            match('u'); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end UnicodeEscape
+
+    // $ANTLR start BOOL
+    public final void mBOOL() throws RecognitionException {
+        try {
+            int _type = BOOL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:2: ( ( 'true' | 'false' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:4: ( 'true' | 'false' )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:4: ( 'true' | 'false' )
+            int alt13=2;
+            int LA13_0 = input.LA(1);
+
+            if ( (LA13_0=='t') ) {
+                alt13=1;
+            }
+            else if ( (LA13_0=='f') ) {
+                alt13=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1876:4: ( 'true' | 'false' )", 13, 0, input);
+
+                throw nvae;
+            }
+            switch (alt13) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:5: 'true'
+                    {
+                    match("true"); if (failed) return ;
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:12: 'false'
+                    {
+                    match("false"); if (failed) return ;
+
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end BOOL
+
+    // $ANTLR start PACKAGE
+    public final void mPACKAGE() throws RecognitionException {
+        try {
+            int _type = PACKAGE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1879:9: ( 'package' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1879:11: 'package'
+            {
+            match("package"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end PACKAGE
+
+    // $ANTLR start IMPORT
+    public final void mIMPORT() throws RecognitionException {
+        try {
+            int _type = IMPORT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1881:8: ( 'import' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1881:10: 'import'
+            {
+            match("import"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end IMPORT
+
+    // $ANTLR start FUNCTION
+    public final void mFUNCTION() throws RecognitionException {
+        try {
+            int _type = FUNCTION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1883:10: ( 'function' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1883:12: 'function'
+            {
+            match("function"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FUNCTION
+
+    // $ANTLR start EVENT
+    public final void mEVENT() throws RecognitionException {
+        try {
+            int _type = EVENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1885:7: ( 'event' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1885:10: 'event'
+            {
+            match("event"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EVENT
+
+    // $ANTLR start GLOBAL
+    public final void mGLOBAL() throws RecognitionException {
+        try {
+            int _type = GLOBAL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1887:8: ( 'global' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1887:10: 'global'
+            {
+            match("global"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end GLOBAL
+
+    // $ANTLR start DECLARE
+    public final void mDECLARE() throws RecognitionException {
+        try {
+            int _type = DECLARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1889:9: ( 'declare' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1889:11: 'declare'
+            {
+            match("declare"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DECLARE
+
+    // $ANTLR start RULE
+    public final void mRULE() throws RecognitionException {
+        try {
+            int _type = RULE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1891:9: ( 'rule' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1891:11: 'rule'
+            {
+            match("rule"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RULE
+
+    // $ANTLR start QUERY
+    public final void mQUERY() throws RecognitionException {
+        try {
+            int _type = QUERY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1893:7: ( 'query' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1893:9: 'query'
+            {
+            match("query"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end QUERY
+
+    // $ANTLR start TEMPLATE
+    public final void mTEMPLATE() throws RecognitionException {
+        try {
+            int _type = TEMPLATE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1895:10: ( 'template' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1895:12: 'template'
+            {
+            match("template"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TEMPLATE
+
+    // $ANTLR start ATTRIBUTES
+    public final void mATTRIBUTES() throws RecognitionException {
+        try {
+            int _type = ATTRIBUTES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1897:12: ( 'attributes' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1897:14: 'attributes'
+            {
+            match("attributes"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ATTRIBUTES
+
+    // $ANTLR start DATE_EFFECTIVE
+    public final void mDATE_EFFECTIVE() throws RecognitionException {
+        try {
+            int _type = DATE_EFFECTIVE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1900:2: ( 'date-effective' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1900:4: 'date-effective'
+            {
+            match("date-effective"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DATE_EFFECTIVE
+
+    // $ANTLR start DATE_EXPIRES
+    public final void mDATE_EXPIRES() throws RecognitionException {
+        try {
+            int _type = DATE_EXPIRES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1903:2: ( 'date-expires' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1903:4: 'date-expires'
+            {
+            match("date-expires"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DATE_EXPIRES
+
+    // $ANTLR start ENABLED
+    public final void mENABLED() throws RecognitionException {
+        try {
+            int _type = ENABLED;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1905:9: ( 'enabled' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1905:11: 'enabled'
+            {
+            match("enabled"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ENABLED
+
+    // $ANTLR start SALIENCE
+    public final void mSALIENCE() throws RecognitionException {
+        try {
+            int _type = SALIENCE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1908:2: ( 'salience' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1908:4: 'salience'
+            {
+            match("salience"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SALIENCE
+
+    // $ANTLR start NO_LOOP
+    public final void mNO_LOOP() throws RecognitionException {
+        try {
+            int _type = NO_LOOP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1910:9: ( 'no-loop' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1910:11: 'no-loop'
+            {
+            match("no-loop"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NO_LOOP
+
+    // $ANTLR start AUTO_FOCUS
+    public final void mAUTO_FOCUS() throws RecognitionException {
+        try {
+            int _type = AUTO_FOCUS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1913:2: ( 'auto-focus' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1913:4: 'auto-focus'
+            {
+            match("auto-focus"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AUTO_FOCUS
+
+    // $ANTLR start ACTIVATION_GROUP
+    public final void mACTIVATION_GROUP() throws RecognitionException {
+        try {
+            int _type = ACTIVATION_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1916:2: ( 'activation-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1916:4: 'activation-group'
+            {
+            match("activation-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACTIVATION_GROUP
+
+    // $ANTLR start AGENDA_GROUP
+    public final void mAGENDA_GROUP() throws RecognitionException {
+        try {
+            int _type = AGENDA_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1919:2: ( 'agenda-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1919:4: 'agenda-group'
+            {
+            match("agenda-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AGENDA_GROUP
+
+    // $ANTLR start DIALECT
+    public final void mDIALECT() throws RecognitionException {
+        try {
+            int _type = DIALECT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1922:2: ( 'dialect' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1922:4: 'dialect'
+            {
+            match("dialect"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DIALECT
+
+    // $ANTLR start RULEFLOW_GROUP
+    public final void mRULEFLOW_GROUP() throws RecognitionException {
+        try {
+            int _type = RULEFLOW_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1925:2: ( 'ruleflow-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1925:4: 'ruleflow-group'
+            {
+            match("ruleflow-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RULEFLOW_GROUP
+
+    // $ANTLR start DURATION
+    public final void mDURATION() throws RecognitionException {
+        try {
+            int _type = DURATION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1928:2: ( 'duration' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1928:4: 'duration'
+            {
+            match("duration"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DURATION
+
+    // $ANTLR start LOCK_ON_ACTIVE
+    public final void mLOCK_ON_ACTIVE() throws RecognitionException {
+        try {
+            int _type = LOCK_ON_ACTIVE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1931:2: ( 'lock-on-active' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1931:4: 'lock-on-active'
+            {
+            match("lock-on-active"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LOCK_ON_ACTIVE
+
+    // $ANTLR start FROM
+    public final void mFROM() throws RecognitionException {
+        try {
+            int _type = FROM;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1933:6: ( 'from' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1933:8: 'from'
+            {
+            match("from"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FROM
+
+    // $ANTLR start ACCUMULATE
+    public final void mACCUMULATE() throws RecognitionException {
+        try {
+            int _type = ACCUMULATE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1936:2: ( 'accumulate' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1936:4: 'accumulate'
+            {
+            match("accumulate"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACCUMULATE
+
+    // $ANTLR start TIMEWINDOW
+    public final void mTIMEWINDOW() throws RecognitionException {
+        try {
+            int _type = TIMEWINDOW;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1938:2: ( 'timewindow' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1938:4: 'timewindow'
+            {
+            match("timewindow"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TIMEWINDOW
+
+    // $ANTLR start INIT
+    public final void mINIT() throws RecognitionException {
+        try {
+            int _type = INIT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1940:6: ( 'init' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1940:8: 'init'
+            {
+            match("init"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end INIT
+
+    // $ANTLR start ACTION
+    public final void mACTION() throws RecognitionException {
+        try {
+            int _type = ACTION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1942:8: ( 'action' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1942:10: 'action'
+            {
+            match("action"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACTION
+
+    // $ANTLR start REVERSE
+    public final void mREVERSE() throws RecognitionException {
+        try {
+            int _type = REVERSE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1944:9: ( 'reverse' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1944:11: 'reverse'
+            {
+            match("reverse"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end REVERSE
+
+    // $ANTLR start RESULT
+    public final void mRESULT() throws RecognitionException {
+        try {
+            int _type = RESULT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1946:8: ( 'result' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1946:10: 'result'
+            {
+            match("result"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RESULT
+
+    // $ANTLR start COLLECT
+    public final void mCOLLECT() throws RecognitionException {
+        try {
+            int _type = COLLECT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1948:9: ( 'collect' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1948:11: 'collect'
+            {
+            match("collect"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end COLLECT
+
+    // $ANTLR start ENTRY_POINT
+    public final void mENTRY_POINT() throws RecognitionException {
+        try {
+            int _type = ENTRY_POINT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1950:13: ( 'entry-point' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1950:15: 'entry-point'
+            {
+            match("entry-point"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ENTRY_POINT
+
+    // $ANTLR start OR
+    public final void mOR() throws RecognitionException {
+        try {
+            int _type = OR;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1952:4: ( 'or' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1952:6: 'or'
+            {
+            match("or"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OR
+
+    // $ANTLR start AND
+    public final void mAND() throws RecognitionException {
+        try {
+            int _type = AND;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1954:5: ( 'and' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1954:7: 'and'
+            {
+            match("and"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AND
+
+    // $ANTLR start CONTAINS
+    public final void mCONTAINS() throws RecognitionException {
+        try {
+            int _type = CONTAINS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1957:8: ( 'contains' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1957:16: 'contains'
+            {
+            match("contains"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end CONTAINS
+
+    // $ANTLR start EXCLUDES
+    public final void mEXCLUDES() throws RecognitionException {
+        try {
+            int _type = EXCLUDES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1960:8: ( 'excludes' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1960:16: 'excludes'
+            {
+            match("excludes"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EXCLUDES
+
+    // $ANTLR start MEMBEROF
+    public final void mMEMBEROF() throws RecognitionException {
+        try {
+            int _type = MEMBEROF;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1963:8: ( 'memberOf' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1963:16: 'memberOf'
+            {
+            match("memberOf"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MEMBEROF
+
+    // $ANTLR start MATCHES
+    public final void mMATCHES() throws RecognitionException {
+        try {
+            int _type = MATCHES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1965:9: ( 'matches' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1965:16: 'matches'
+            {
+            match("matches"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MATCHES
+
+    // $ANTLR start SOUNDSLIKE
+    public final void mSOUNDSLIKE() throws RecognitionException {
+        try {
+            int _type = SOUNDSLIKE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1967:12: ( 'soundslike' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1967:16: 'soundslike'
+            {
+            match("soundslike"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SOUNDSLIKE
+
+    // $ANTLR start IN
+    public final void mIN() throws RecognitionException {
+        try {
+            int _type = IN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1969:4: ( 'in' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1969:6: 'in'
+            {
+            match("in"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end IN
+
+    // $ANTLR start NULL
+    public final void mNULL() throws RecognitionException {
+        try {
+            int _type = NULL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1971:6: ( 'null' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1971:8: 'null'
+            {
+            match("null"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NULL
+
+    // $ANTLR start EXISTS
+    public final void mEXISTS() throws RecognitionException {
+        try {
+            int _type = EXISTS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1973:8: ( 'exists' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1973:10: 'exists'
+            {
+            match("exists"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EXISTS
+
+    // $ANTLR start NOT
+    public final void mNOT() throws RecognitionException {
+        try {
+            int _type = NOT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1975:5: ( 'not' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1975:7: 'not'
+            {
+            match("not"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NOT
+
+    // $ANTLR start EVAL
+    public final void mEVAL() throws RecognitionException {
+        try {
+            int _type = EVAL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1977:6: ( 'eval' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1977:8: 'eval'
+            {
+            match("eval"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EVAL
+
+    // $ANTLR start FORALL
+    public final void mFORALL() throws RecognitionException {
+        try {
+            int _type = FORALL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1979:8: ( 'forall' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1979:10: 'forall'
+            {
+            match("forall"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FORALL
+
+    // $ANTLR start WHEN
+    public final void mWHEN() throws RecognitionException {
+        try {
+            int _type = WHEN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1981:9: ( 'when' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1981:11: 'when'
+            {
+            match("when"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end WHEN
+
+    // $ANTLR start THEN
+    public final void mTHEN() throws RecognitionException {
+        try {
+            int _type = THEN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1983:6: ( 'then' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1983:12: 'then'
+            {
+            match("then"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end THEN
+
+    // $ANTLR start END
+    public final void mEND() throws RecognitionException {
+        try {
+            int _type = END;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1985:9: ( 'end' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1985:11: 'end'
+            {
+            match("end"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end END
+
+    // $ANTLR start ID
+    public final void mID() throws RecognitionException {
+        try {
+            int _type = ID;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '$' | '\\u00c0' .. '\\u00ff' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '$' | '\\u00c0' .. '\\u00ff' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )*
+            {
+            if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:50: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )*
+            loop14:
+            do {
+                int alt14=2;
+                int LA14_0 = input.LA(1);
+
+                if ( ((LA14_0>='0' && LA14_0<='9')||(LA14_0>='A' && LA14_0<='Z')||LA14_0=='_'||(LA14_0>='a' && LA14_0<='z')||(LA14_0>='\u00C0' && LA14_0<='\u00FF')) ) {
+                    alt14=1;
+                }
+
+
+                switch (alt14) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            	    {
+            	    if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
+            	        input.consume();
+            	    failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recover(mse);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop14;
+                }
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ID
+
+    // $ANTLR start LEFT_PAREN
+    public final void mLEFT_PAREN() throws RecognitionException {
+        try {
+            int _type = LEFT_PAREN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1992:9: ( '(' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1992:11: '('
+            {
+            match('('); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_PAREN
+
+    // $ANTLR start RIGHT_PAREN
+    public final void mRIGHT_PAREN() throws RecognitionException {
+        try {
+            int _type = RIGHT_PAREN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1996:9: ( ')' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1996:11: ')'
+            {
+            match(')'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_PAREN
+
+    // $ANTLR start LEFT_SQUARE
+    public final void mLEFT_SQUARE() throws RecognitionException {
+        try {
+            int _type = LEFT_SQUARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2000:9: ( '[' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2000:11: '['
+            {
+            match('['); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_SQUARE
+
+    // $ANTLR start RIGHT_SQUARE
+    public final void mRIGHT_SQUARE() throws RecognitionException {
+        try {
+            int _type = RIGHT_SQUARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2004:9: ( ']' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2004:11: ']'
+            {
+            match(']'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_SQUARE
+
+    // $ANTLR start LEFT_CURLY
+    public final void mLEFT_CURLY() throws RecognitionException {
+        try {
+            int _type = LEFT_CURLY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2008:9: ( '{' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2008:11: '{'
+            {
+            match('{'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_CURLY
+
+    // $ANTLR start RIGHT_CURLY
+    public final void mRIGHT_CURLY() throws RecognitionException {
+        try {
+            int _type = RIGHT_CURLY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2012:9: ( '}' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2012:11: '}'
+            {
+            match('}'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_CURLY
+
+    // $ANTLR start COMMA
+    public final void mCOMMA() throws RecognitionException {
+        try {
+            int _type = COMMA;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2015:7: ( ',' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2015:9: ','
+            {
+            match(','); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end COMMA
+
+    // $ANTLR start DOT
+    public final void mDOT() throws RecognitionException {
+        try {
+            int _type = DOT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2018:5: ( '.' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2018:7: '.'
+            {
+            match('.'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOT
+
+    // $ANTLR start DOUBLE_AMPER
+    public final void mDOUBLE_AMPER() throws RecognitionException {
+        try {
+            int _type = DOUBLE_AMPER;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2022:2: ( '&&' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2022:4: '&&'
+            {
+            match("&&"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOUBLE_AMPER
+
+    // $ANTLR start DOUBLE_PIPE
+    public final void mDOUBLE_PIPE() throws RecognitionException {
+        try {
+            int _type = DOUBLE_PIPE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2026:2: ( '||' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2026:4: '||'
+            {
+            match("||"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOUBLE_PIPE
+
+    // $ANTLR start TILDE
+    public final void mTILDE() throws RecognitionException {
+        try {
+            int _type = TILDE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2029:7: ( '~' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2029:9: '~'
+            {
+            match('~'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TILDE
+
+    // $ANTLR start SH_STYLE_SINGLE_LINE_COMMENT
+    public final void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = SH_STYLE_SINGLE_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:2: ( '#' ( options {greedy=false; } : . )* EOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:4: '#' ( options {greedy=false; } : . )* EOL
+            {
+            match('#'); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:8: ( options {greedy=false; } : . )*
+            loop15:
+            do {
+                int alt15=2;
+                int LA15_0 = input.LA(1);
+
+                if ( (LA15_0=='\r') ) {
+                    alt15=2;
+                }
+                else if ( (LA15_0=='\n') ) {
+                    alt15=2;
+                }
+                else if ( ((LA15_0>='\u0000' && LA15_0<='\t')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\uFFFE')) ) {
+                    alt15=1;
+                }
+
+
+                switch (alt15) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:35: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop15;
+                }
+            } while (true);
+
+            mEOL(); if (failed) return ;
+            if ( backtracking==0 ) {
+               channel=HIDDEN; setText("//"+getText().substring(1));
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SH_STYLE_SINGLE_LINE_COMMENT
+
+    // $ANTLR start C_STYLE_SINGLE_LINE_COMMENT
+    public final void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = C_STYLE_SINGLE_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:2: ( '//' ( options {greedy=false; } : . )* EOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:4: '//' ( options {greedy=false; } : . )* EOL
+            {
+            match("//"); if (failed) return ;
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:9: ( options {greedy=false; } : . )*
+            loop16:
+            do {
+                int alt16=2;
+                int LA16_0 = input.LA(1);
+
+                if ( (LA16_0=='\r') ) {
+                    alt16=2;
+                }
+                else if ( (LA16_0=='\n') ) {
+                    alt16=2;
+                }
+                else if ( ((LA16_0>='\u0000' && LA16_0<='\t')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\uFFFE')) ) {
+                    alt16=1;
+                }
+
+
+                switch (alt16) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:36: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop16;
+                }
+            } while (true);
+
+            mEOL(); if (failed) return ;
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end C_STYLE_SINGLE_LINE_COMMENT
+
+    // $ANTLR start MULTI_LINE_COMMENT
+    public final void mMULTI_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = MULTI_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:4: '/*' ( options {greedy=false; } : . )* '*/'
+            {
+            match("/*"); if (failed) return ;
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:9: ( options {greedy=false; } : . )*
+            loop17:
+            do {
+                int alt17=2;
+                int LA17_0 = input.LA(1);
+
+                if ( (LA17_0=='*') ) {
+                    int LA17_1 = input.LA(2);
+
+                    if ( (LA17_1=='/') ) {
+                        alt17=2;
+                    }
+                    else if ( ((LA17_1>='\u0000' && LA17_1<='.')||(LA17_1>='0' && LA17_1<='\uFFFE')) ) {
+                        alt17=1;
+                    }
+
+
+                }
+                else if ( ((LA17_0>='\u0000' && LA17_0<=')')||(LA17_0>='+' && LA17_0<='\uFFFE')) ) {
+                    alt17=1;
+                }
+
+
+                switch (alt17) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:35: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop17;
+                }
+            } while (true);
+
+            match("*/"); if (failed) return ;
+
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MULTI_LINE_COMMENT
+
+    // $ANTLR start MISC
+    public final void mMISC() throws RecognitionException {
+        try {
+            int _type = MISC;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2047:7: ( '!' | '@' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '?' | '=' | '/' | '\\'' | '\\\\' | '|' | '&' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            {
+            if ( input.LA(1)=='!'||(input.LA(1)>='$' && input.LA(1)<='\'')||(input.LA(1)>='*' && input.LA(1)<='+')||input.LA(1)=='-'||input.LA(1)=='/'||input.LA(1)=='='||(input.LA(1)>='?' && input.LA(1)<='@')||input.LA(1)=='\\'||(input.LA(1)>='^' && input.LA(1)<='_')||input.LA(1)=='|' ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MISC
+
+    public void mTokens() throws RecognitionException {
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:8: ( T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | WS | INT | FLOAT | STRING | BOOL | PACKAGE | IMPORT | FUNCTION | EVENT | GLOBAL | DECLARE | RULE | QUERY | TEMPLATE | ATTRIBUTES | DATE_EFFECTIVE | DATE_EXPIRES | ENABLED | SALIENCE | NO_LOOP | AUTO_FOCUS | ACTIVATION_GROUP | AGENDA_GROUP | DIALECT | RULEFLOW_GROUP | DURATION | LOCK_ON_ACTIVE | FROM | ACCUMULATE | TIMEWINDOW | INIT | ACTION | REVERSE | RESULT | COLLECT | ENTRY_POINT | OR | AND | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | IN | NULL | EXISTS | NOT | EVAL | FORALL | WHEN | THEN | END | ID | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | COMMA | DOT | DOUBLE_AMPER | DOUBLE_PIPE | TILDE | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT | MISC )
+        int alt18=78;
+        alt18 = dfa18.predict(input);
+        switch (alt18) {
+            case 1 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:10: T77
+                {
+                mT77(); if (failed) return ;
+
+                }
+                break;
+            case 2 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:14: T78
+                {
+                mT78(); if (failed) return ;
+
+                }
+                break;
+            case 3 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:18: T79
+                {
+                mT79(); if (failed) return ;
+
+                }
+                break;
+            case 4 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:22: T80
+                {
+                mT80(); if (failed) return ;
+
+                }
+                break;
+            case 5 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:26: T81
+                {
+                mT81(); if (failed) return ;
+
+                }
+                break;
+            case 6 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:30: T82
+                {
+                mT82(); if (failed) return ;
+
+                }
+                break;
+            case 7 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:34: T83
+                {
+                mT83(); if (failed) return ;
+
+                }
+                break;
+            case 8 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:38: T84
+                {
+                mT84(); if (failed) return ;
+
+                }
+                break;
+            case 9 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:42: T85
+                {
+                mT85(); if (failed) return ;
+
+                }
+                break;
+            case 10 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:46: T86
+                {
+                mT86(); if (failed) return ;
+
+                }
+                break;
+            case 11 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:50: WS
+                {
+                mWS(); if (failed) return ;
+
+                }
+                break;
+            case 12 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:53: INT
+                {
+                mINT(); if (failed) return ;
+
+                }
+                break;
+            case 13 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:57: FLOAT
+                {
+                mFLOAT(); if (failed) return ;
+
+                }
+                break;
+            case 14 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:63: STRING
+                {
+                mSTRING(); if (failed) return ;
+
+                }
+                break;
+            case 15 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:70: BOOL
+                {
+                mBOOL(); if (failed) return ;
+
+                }
+                break;
+            case 16 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:75: PACKAGE
+                {
+                mPACKAGE(); if (failed) return ;
+
+                }
+                break;
+            case 17 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:83: IMPORT
+                {
+                mIMPORT(); if (failed) return ;
+
+                }
+                break;
+            case 18 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:90: FUNCTION
+                {
+                mFUNCTION(); if (failed) return ;
+
+                }
+                break;
+            case 19 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:99: EVENT
+                {
+                mEVENT(); if (failed) return ;
+
+                }
+                break;
+            case 20 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:105: GLOBAL
+                {
+                mGLOBAL(); if (failed) return ;
+
+                }
+                break;
+            case 21 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:112: DECLARE
+                {
+                mDECLARE(); if (failed) return ;
+
+                }
+                break;
+            case 22 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:120: RULE
+                {
+                mRULE(); if (failed) return ;
+
+                }
+                break;
+            case 23 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:125: QUERY
+                {
+                mQUERY(); if (failed) return ;
+
+                }
+                break;
+            case 24 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:131: TEMPLATE
+                {
+                mTEMPLATE(); if (failed) return ;
+
+                }
+                break;
+            case 25 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:140: ATTRIBUTES
+                {
+                mATTRIBUTES(); if (failed) return ;
+
+                }
+                break;
+            case 26 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:151: DATE_EFFECTIVE
+                {
+                mDATE_EFFECTIVE(); if (failed) return ;
+
+                }
+                break;
+            case 27 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:166: DATE_EXPIRES
+                {
+                mDATE_EXPIRES(); if (failed) return ;
+
+                }
+                break;
+            case 28 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:179: ENABLED
+                {
+                mENABLED(); if (failed) return ;
+
+                }
+                break;
+            case 29 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:187: SALIENCE
+                {
+                mSALIENCE(); if (failed) return ;
+
+                }
+                break;
+            case 30 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:196: NO_LOOP
+                {
+                mNO_LOOP(); if (failed) return ;
+
+                }
+                break;
+            case 31 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:204: AUTO_FOCUS
+                {
+                mAUTO_FOCUS(); if (failed) return ;
+
+                }
+                break;
+            case 32 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:215: ACTIVATION_GROUP
+                {
+                mACTIVATION_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 33 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:232: AGENDA_GROUP
+                {
+                mAGENDA_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 34 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:245: DIALECT
+                {
+                mDIALECT(); if (failed) return ;
+
+                }
+                break;
+            case 35 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:253: RULEFLOW_GROUP
+                {
+                mRULEFLOW_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 36 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:268: DURATION
+                {
+                mDURATION(); if (failed) return ;
+
+                }
+                break;
+            case 37 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:277: LOCK_ON_ACTIVE
+                {
+                mLOCK_ON_ACTIVE(); if (failed) return ;
+
+                }
+                break;
+            case 38 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:292: FROM
+                {
+                mFROM(); if (failed) return ;
+
+                }
+                break;
+            case 39 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:297: ACCUMULATE
+                {
+                mACCUMULATE(); if (failed) return ;
+
+                }
+                break;
+            case 40 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:308: TIMEWINDOW
+                {
+                mTIMEWINDOW(); if (failed) return ;
+
+                }
+                break;
+            case 41 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:319: INIT
+                {
+                mINIT(); if (failed) return ;
+
+                }
+                break;
+            case 42 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:324: ACTION
+                {
+                mACTION(); if (failed) return ;
+
+                }
+                break;
+            case 43 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:331: REVERSE
+                {
+                mREVERSE(); if (failed) return ;
+
+                }
+                break;
+            case 44 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:339: RESULT
+                {
+                mRESULT(); if (failed) return ;
+
+                }
+                break;
+            case 45 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:346: COLLECT
+                {
+                mCOLLECT(); if (failed) return ;
+
+                }
+                break;
+            case 46 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:354: ENTRY_POINT
+                {
+                mENTRY_POINT(); if (failed) return ;
+
+                }
+                break;
+            case 47 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:366: OR
+                {
+                mOR(); if (failed) return ;
+
+                }
+                break;
+            case 48 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:369: AND
+                {
+                mAND(); if (failed) return ;
+
+                }
+                break;
+            case 49 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:373: CONTAINS
+                {
+                mCONTAINS(); if (failed) return ;
+
+                }
+                break;
+            case 50 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:382: EXCLUDES
+                {
+                mEXCLUDES(); if (failed) return ;
+
+                }
+                break;
+            case 51 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:391: MEMBEROF
+                {
+                mMEMBEROF(); if (failed) return ;
+
+                }
+                break;
+            case 52 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:400: MATCHES
+                {
+                mMATCHES(); if (failed) return ;
+
+                }
+                break;
+            case 53 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:408: SOUNDSLIKE
+                {
+                mSOUNDSLIKE(); if (failed) return ;
+
+                }
+                break;
+            case 54 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:419: IN
+                {
+                mIN(); if (failed) return ;
+
+                }
+                break;
+            case 55 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:422: NULL
+                {
+                mNULL(); if (failed) return ;
+
+                }
+                break;
+            case 56 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:427: EXISTS
+                {
+                mEXISTS(); if (failed) return ;
+
+                }
+                break;
+            case 57 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:434: NOT
+                {
+                mNOT(); if (failed) return ;
+
+                }
+                break;
+            case 58 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:438: EVAL
+                {
+                mEVAL(); if (failed) return ;
+
+                }
+                break;
+            case 59 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:443: FORALL
+                {
+                mFORALL(); if (failed) return ;
+
+                }
+                break;
+            case 60 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:450: WHEN
+                {
+                mWHEN(); if (failed) return ;
+
+                }
+                break;
+            case 61 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:455: THEN
+                {
+                mTHEN(); if (failed) return ;
+
+                }
+                break;
+            case 62 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:460: END
+                {
+                mEND(); if (failed) return ;
+
+                }
+                break;
+            case 63 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:464: ID
+                {
+                mID(); if (failed) return ;
+
+                }
+                break;
+            case 64 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:467: LEFT_PAREN
+                {
+                mLEFT_PAREN(); if (failed) return ;
+
+                }
+                break;
+            case 65 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:478: RIGHT_PAREN
+                {
+                mRIGHT_PAREN(); if (failed) return ;
+
+                }
+                break;
+            case 66 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:490: LEFT_SQUARE
+                {
+                mLEFT_SQUARE(); if (failed) return ;
+
+                }
+                break;
+            case 67 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:502: RIGHT_SQUARE
+                {
+                mRIGHT_SQUARE(); if (failed) return ;
+
+                }
+                break;
+            case 68 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:515: LEFT_CURLY
+                {
+                mLEFT_CURLY(); if (failed) return ;
+
+                }
+                break;
+            case 69 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:526: RIGHT_CURLY
+                {
+                mRIGHT_CURLY(); if (failed) return ;
+
+                }
+                break;
+            case 70 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:538: COMMA
+                {
+                mCOMMA(); if (failed) return ;
+
+                }
+                break;
+            case 71 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:544: DOT
+                {
+                mDOT(); if (failed) return ;
+
+                }
+                break;
+            case 72 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:548: DOUBLE_AMPER
+                {
+                mDOUBLE_AMPER(); if (failed) return ;
+
+                }
+                break;
+            case 73 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:561: DOUBLE_PIPE
+                {
+                mDOUBLE_PIPE(); if (failed) return ;
+
+                }
+                break;
+            case 74 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:573: TILDE
+                {
+                mTILDE(); if (failed) return ;
+
+                }
+                break;
+            case 75 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:579: SH_STYLE_SINGLE_LINE_COMMENT
+                {
+                mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 76 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:608: C_STYLE_SINGLE_LINE_COMMENT
+                {
+                mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 77 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:636: MULTI_LINE_COMMENT
+                {
+                mMULTI_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 78 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:655: MISC
+                {
+                mMISC(); if (failed) return ;
+
+                }
+                break;
+
+        }
+
+    }
+
+    // $ANTLR start synpred1
+    public final void synpred1_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:14: ( '\\r\\n' )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:16: '\\r\\n'
+        {
+        match("\r\n"); if (failed) return ;
+
+
+        }
+    }
+    // $ANTLR end synpred1
+
+    public final boolean synpred1() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred1_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+
+
+    protected DFA18 dfa18 = new DFA18(this);
+    static final String DFA18_eotS =
+        "\2\uffff\1\56\1\uffff\2\54\1\62\1\64\1\54\1\uffff\1\66\1\uffff\1"+
+        "\54\21\53\10\uffff\2\54\2\uffff\1\54\15\uffff\11\53\1\153\27\53"+
+        "\1\u008b\3\53\4\uffff\12\53\1\uffff\3\53\1\u009c\20\53\1\u00ad\4"+
+        "\53\1\uffff\1\u00b2\4\53\1\uffff\5\53\1\u00bc\1\u00bd\1\u00be\4"+
+        "\53\1\u00c3\3\53\1\uffff\2\53\1\u00c9\6\53\1\u00d1\6\53\1\uffff"+
+        "\4\53\1\uffff\1\u00dd\5\53\1\u00e3\2\53\3\uffff\1\53\1\u00bd\2\53"+
+        "\1\uffff\5\53\1\uffff\1\u00ee\4\53\1\uffff\1\53\1\uffff\2\53\1\u00f7"+
+        "\4\53\1\uffff\3\53\2\uffff\4\53\1\uffff\2\53\1\u0105\2\53\1\u0108"+
+        "\1\53\1\u010a\1\uffff\1\53\1\uffff\1\u010c\3\53\1\uffff\2\53\1\u0114"+
+        "\1\uffff\1\u0115\14\53\1\uffff\1\53\1\u0123\1\uffff\1\53\1\uffff"+
+        "\1\u0125\1\uffff\1\53\1\u0127\1\u0128\2\uffff\1\53\1\u012a\2\uffff"+
+        "\2\53\1\uffff\3\53\1\u0130\2\53\1\u0133\1\53\1\u0135\1\u0136\1\uffff"+
+        "\1\u0137\1\uffff\1\u0138\2\uffff\1\53\1\uffff\4\53\1\u013e\1\uffff"+
+        "\1\u013f\1\u0140\1\uffff\1\53\5\uffff\4\53\3\uffff\1\u0146\1\53"+
+        "\1\u0148\1\u0149\1\u014a\5\uffff";
+    static final String DFA18_eofS =
+        "\u014b\uffff";
+    static final String DFA18_minS =
+        "\1\11\1\uffff\1\52\1\uffff\1\60\4\75\1\uffff\1\56\1\uffff\1\0\1"+
+        "\145\2\141\1\155\1\156\1\154\1\141\1\145\1\165\1\143\1\141\3\157"+
+        "\1\162\1\141\1\150\10\uffff\1\46\1\174\2\uffff\1\52\15\uffff\2\155"+
+        "\1\145\1\165\1\157\1\162\1\154\1\156\1\143\1\60\1\160\1\143\2\141"+
+        "\1\157\1\162\1\141\1\143\1\164\1\154\1\163\1\145\1\143\1\145\1\144"+
+        "\2\164\1\165\1\154\1\55\1\154\1\143\1\154\1\60\1\155\1\164\1\145"+
+        "\4\uffff\1\145\1\160\1\156\1\145\1\155\1\141\1\163\1\143\1\153\1"+
+        "\164\1\uffff\1\157\1\154\1\163\1\60\1\162\1\142\1\154\1\156\1\142"+
+        "\1\141\2\154\3\145\1\165\1\162\1\151\1\165\1\156\1\60\1\157\1\162"+
+        "\1\156\1\151\1\uffff\1\60\1\154\1\153\1\154\1\164\1\uffff\1\142"+
+        "\1\143\1\156\1\167\1\154\3\60\1\154\1\145\1\164\1\141\1\60\1\162"+
+        "\1\165\1\164\1\uffff\1\171\1\154\1\60\1\164\1\141\1\164\1\145\1"+
+        "\141\1\55\1\60\1\162\1\154\1\171\1\157\1\155\1\144\1\uffff\1\55"+
+        "\1\151\1\144\1\145\1\uffff\1\60\1\55\1\145\1\141\1\145\1\150\1\60"+
+        "\1\151\1\141\3\uffff\1\154\1\60\1\151\1\147\1\uffff\1\164\1\144"+
+        "\1\163\1\55\1\145\1\uffff\1\60\1\154\1\151\1\143\1\162\1\145\1\154"+
+        "\1\uffff\1\163\1\164\1\60\1\156\1\141\1\165\1\141\1\uffff\1\142"+
+        "\1\163\1\156\2\uffff\1\143\1\151\1\162\1\145\1\uffff\1\156\1\164"+
+        "\1\60\1\157\1\145\1\60\1\145\1\60\1\uffff\1\144\1\uffff\1\60\1\157"+
+        "\1\164\1\145\1\146\1\157\1\145\1\60\1\uffff\1\60\1\164\1\154\1\55"+
+        "\1\165\1\154\1\143\1\164\1\156\1\117\1\163\1\144\1\145\1\uffff\1"+
+        "\156\1\60\1\uffff\1\163\1\uffff\1\60\1\uffff\1\156\2\60\2\uffff"+
+        "\1\167\1\60\2\uffff\1\151\1\141\1\uffff\1\164\1\151\1\145\1\60\1"+
+        "\163\1\146\1\60\1\157\2\60\1\uffff\1\60\1\uffff\1\60\2\uffff\1\55"+
+        "\1\uffff\1\157\1\164\1\145\1\153\1\60\1\uffff\2\60\1\uffff\1\167"+
+        "\5\uffff\1\156\1\145\1\163\1\145\3\uffff\1\60\1\55\3\60\5\uffff";
+    static final String DFA18_maxS =
+        "\1\u00ff\1\uffff\1\52\1\uffff\1\76\4\75\1\uffff\1\71\1\uffff\1\ufffe"+
+        "\1\162\1\165\1\141\1\156\1\170\1\154\4\165\1\157\1\165\2\157\1\162"+
+        "\1\145\1\150\10\uffff\1\46\1\174\2\uffff\1\57\15\uffff\2\155\1\145"+
+        "\1\165\1\157\1\162\1\154\1\156\1\143\1\u00ff\1\160\1\151\1\164\1"+
+        "\145\1\157\1\162\1\141\1\143\1\164\1\154\1\166\1\145\1\164\1\145"+
+        "\1\144\2\164\1\165\1\154\1\164\1\154\1\143\1\156\1\u00ff\1\155\1"+
+        "\164\1\145\4\uffff\1\145\1\160\1\156\1\145\1\155\1\141\1\163\1\143"+
+        "\1\153\1\164\1\uffff\1\157\1\154\1\163\1\u00ff\1\162\1\142\1\154"+
+        "\1\156\1\142\1\141\2\154\3\145\1\165\1\162\1\151\1\165\1\156\1\u00ff"+
+        "\1\157\1\162\1\156\1\151\1\uffff\1\u00ff\1\154\1\153\1\154\1\164"+
+        "\1\uffff\1\142\1\143\1\156\1\167\1\154\3\u00ff\1\154\1\145\1\164"+
+        "\1\141\1\u00ff\1\162\1\165\1\164\1\uffff\1\171\1\154\1\u00ff\1\164"+
+        "\1\141\1\164\1\145\1\141\1\55\1\u00ff\1\162\1\154\1\171\1\166\1"+
+        "\155\1\144\1\uffff\1\55\1\151\1\144\1\145\1\uffff\1\u00ff\1\55\1"+
+        "\145\1\141\1\145\1\150\1\u00ff\1\151\1\141\3\uffff\1\154\1\u00ff"+
+        "\1\151\1\147\1\uffff\1\164\1\144\1\163\1\55\1\145\1\uffff\1\u00ff"+
+        "\1\154\1\151\1\143\1\162\1\145\1\154\1\uffff\1\163\1\164\1\u00ff"+
+        "\1\156\1\141\1\165\1\141\1\uffff\1\142\1\163\1\156\2\uffff\1\143"+
+        "\1\151\1\162\1\145\1\uffff\1\156\1\164\1\u00ff\1\157\1\145\1\u00ff"+
+        "\1\145\1\u00ff\1\uffff\1\144\1\uffff\1\u00ff\1\157\1\164\1\145\1"+
+        "\170\1\157\1\145\1\u00ff\1\uffff\1\u00ff\1\164\1\154\1\55\1\165"+
+        "\1\154\1\143\1\164\1\156\1\117\1\163\1\144\1\145\1\uffff\1\156\1"+
+        "\u00ff\1\uffff\1\163\1\uffff\1\u00ff\1\uffff\1\156\2\u00ff\2\uffff"+
+        "\1\167\1\u00ff\2\uffff\1\151\1\141\1\uffff\1\164\1\151\1\145\1\u00ff"+
+        "\1\163\1\146\1\u00ff\1\157\2\u00ff\1\uffff\1\u00ff\1\uffff\1\u00ff"+
+        "\2\uffff\1\55\1\uffff\1\157\1\164\1\145\1\153\1\u00ff\1\uffff\2"+
+        "\u00ff\1\uffff\1\167\5\uffff\1\156\1\145\1\163\1\145\3\uffff\1\u00ff"+
+        "\1\55\3\u00ff\5\uffff";
+    static final String DFA18_acceptS =
+        "\1\uffff\1\1\1\uffff\1\3\5\uffff\1\13\1\uffff\1\16\22\uffff\1\77"+
+        "\1\100\1\101\1\102\1\103\1\104\1\105\1\106\2\uffff\1\112\1\113\1"+
+        "\uffff\1\77\1\116\1\2\1\107\1\4\1\5\1\7\1\6\1\11\1\10\1\12\1\14"+
+        "\1\15\45\uffff\1\110\1\111\1\115\1\114\12\uffff\1\66\31\uffff\1"+
+        "\36\5\uffff\1\57\20\uffff\1\76\20\uffff\1\60\4\uffff\1\71\11\uffff"+
+        "\1\75\1\17\1\46\4\uffff\1\51\5\uffff\1\72\7\uffff\1\26\7\uffff\1"+
+        "\37\3\uffff\1\67\1\45\4\uffff\1\74\10\uffff\1\56\1\uffff\1\23\10"+
+        "\uffff\1\27\15\uffff\1\73\2\uffff\1\21\1\uffff\1\70\1\uffff\1\24"+
+        "\3\uffff\1\33\1\32\2\uffff\1\54\1\52\2\uffff\1\41\12\uffff\1\20"+
+        "\1\uffff\1\34\1\uffff\1\42\1\25\1\uffff\1\53\5\uffff\1\55\2\uffff"+
+        "\1\64\1\uffff\1\30\1\22\1\62\1\44\1\43\4\uffff\1\35\1\61\1\63\5"+
+        "\uffff\1\50\1\40\1\47\1\31\1\65";
+    static final String DFA18_specialS =
+        "\u014b\uffff}>";
+    static final String[] DFA18_transitionS = {
+            "\2\11\1\uffff\2\11\22\uffff\1\11\1\10\1\13\1\51\1\36\1\54\1"+
+            "\46\1\14\1\37\1\40\2\54\1\45\1\4\1\2\1\52\12\12\1\3\1\1\1\7"+
+            "\1\5\1\6\2\54\32\53\1\41\1\54\1\42\1\54\1\36\1\uffff\1\26\1"+
+            "\53\1\32\1\23\1\21\1\16\1\22\1\53\1\20\2\53\1\31\1\34\1\30\1"+
+            "\33\1\17\1\25\1\24\1\27\1\15\2\53\1\35\3\53\1\43\1\47\1\44\1"+
+            "\50\101\uffff\100\53",
+            "",
+            "\1\55",
+            "",
+            "\12\12\4\uffff\1\57",
+            "\1\60",
+            "\1\61",
+            "\1\63",
+            "\1\65",
+            "",
+            "\1\67\1\uffff\12\12",
+            "",
+            "\uffff\13",
+            "\1\71\2\uffff\1\72\1\70\10\uffff\1\73",
+            "\1\76\15\uffff\1\75\2\uffff\1\74\2\uffff\1\77",
+            "\1\100",
+            "\1\102\1\101",
+            "\1\104\7\uffff\1\105\1\uffff\1\103",
+            "\1\106",
+            "\1\112\3\uffff\1\111\3\uffff\1\110\13\uffff\1\107",
+            "\1\114\17\uffff\1\113",
+            "\1\115",
+            "\1\116\3\uffff\1\117\6\uffff\1\120\5\uffff\1\122\1\121",
+            "\1\124\15\uffff\1\123",
+            "\1\125\5\uffff\1\126",
+            "\1\127",
+            "\1\130",
+            "\1\131",
+            "\1\133\3\uffff\1\132",
+            "\1\134",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\135",
+            "\1\136",
+            "",
+            "",
+            "\1\137\4\uffff\1\140",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\141",
+            "\1\142",
+            "\1\143",
+            "\1\144",
+            "\1\145",
+            "\1\146",
+            "\1\147",
+            "\1\150",
+            "\1\151",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\10\53\1\152\21\53"+
+            "\105\uffff\100\53",
+            "\1\154",
+            "\1\155\5\uffff\1\156",
+            "\1\161\2\uffff\1\157\17\uffff\1\160",
+            "\1\162\3\uffff\1\163",
+            "\1\164",
+            "\1\165",
+            "\1\166",
+            "\1\167",
+            "\1\170",
+            "\1\171",
+            "\1\173\2\uffff\1\172",
+            "\1\174",
+            "\1\176\20\uffff\1\175",
+            "\1\177",
+            "\1\u0080",
+            "\1\u0081",
+            "\1\u0082",
+            "\1\u0083",
+            "\1\u0084",
+            "\1\u0085\106\uffff\1\u0086",
+            "\1\u0087",
+            "\1\u0088",
+            "\1\u0089\1\uffff\1\u008a",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u008c",
+            "\1\u008d",
+            "\1\u008e",
+            "",
+            "",
+            "",
+            "",
+            "\1\u008f",
+            "\1\u0090",
+            "\1\u0091",
+            "\1\u0092",
+            "\1\u0093",
+            "\1\u0094",
+            "\1\u0095",
+            "\1\u0096",
+            "\1\u0097",
+            "\1\u0098",
+            "",
+            "\1\u0099",
+            "\1\u009a",
+            "\1\u009b",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u009d",
+            "\1\u009e",
+            "\1\u009f",
+            "\1\u00a0",
+            "\1\u00a1",
+            "\1\u00a2",
+            "\1\u00a3",
+            "\1\u00a4",
+            "\1\u00a5",
+            "\1\u00a6",
+            "\1\u00a7",
+            "\1\u00a8",
+            "\1\u00a9",
+            "\1\u00aa",
+            "\1\u00ab",
+            "\1\u00ac",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ae",
+            "\1\u00af",
+            "\1\u00b0",
+            "\1\u00b1",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00b3",
+            "\1\u00b4",
+            "\1\u00b5",
+            "\1\u00b6",
+            "",
+            "\1\u00b7",
+            "\1\u00b8",
+            "\1\u00b9",
+            "\1\u00ba",
+            "\1\u00bb",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00bf",
+            "\1\u00c0",
+            "\1\u00c1",
+            "\1\u00c2",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00c4",
+            "\1\u00c5",
+            "\1\u00c6",
+            "",
+            "\1\u00c7",
+            "\1\u00c8",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ca",
+            "\1\u00cb",
+            "\1\u00cc",
+            "\1\u00cd",
+            "\1\u00ce",
+            "\1\u00cf",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\5\53\1\u00d0\24\53"+
+            "\105\uffff\100\53",
+            "\1\u00d2",
+            "\1\u00d3",
+            "\1\u00d4",
+            "\1\u00d5\6\uffff\1\u00d6",
+            "\1\u00d7",
+            "\1\u00d8",
+            "",
+            "\1\u00d9",
+            "\1\u00da",
+            "\1\u00db",
+            "\1\u00dc",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00de",
+            "\1\u00df",
+            "\1\u00e0",
+            "\1\u00e1",
+            "\1\u00e2",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00e4",
+            "\1\u00e5",
+            "",
+            "",
+            "",
+            "\1\u00e6",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00e7",
+            "\1\u00e8",
+            "",
+            "\1\u00e9",
+            "\1\u00ea",
+            "\1\u00eb",
+            "\1\u00ec",
+            "\1\u00ed",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ef",
+            "\1\u00f0",
+            "\1\u00f1",
+            "\1\u00f2",
+            "\1\u00f3",
+            "\1\u00f4",
+            "",
+            "\1\u00f5",
+            "\1\u00f6",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00f8",
+            "\1\u00f9",
+            "\1\u00fa",
+            "\1\u00fb",
+            "",
+            "\1\u00fc",
+            "\1\u00fd",
+            "\1\u00fe",
+            "",
+            "",
+            "\1\u00ff",
+            "\1\u0100",
+            "\1\u0101",
+            "\1\u0102",
+            "",
+            "\1\u0103",
+            "\1\u0104",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0106",
+            "\1\u0107",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0109",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u010b",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u010d",
+            "\1\u010e",
+            "\1\u010f",
+            "\1\u0111\21\uffff\1\u0110",
+            "\1\u0112",
+            "\1\u0113",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0116",
+            "\1\u0117",
+            "\1\u0118",
+            "\1\u0119",
+            "\1\u011a",
+            "\1\u011b",
+            "\1\u011c",
+            "\1\u011d",
+            "\1\u011e",
+            "\1\u011f",
+            "\1\u0120",
+            "\1\u0121",
+            "",
+            "\1\u0122",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0124",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0126",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u0129",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u012b",
+            "\1\u012c",
+            "",
+            "\1\u012d",
+            "\1\u012e",
+            "\1\u012f",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0131",
+            "\1\u0132",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0134",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u0139",
+            "",
+            "\1\u013a",
+            "\1\u013b",
+            "\1\u013c",
+            "\1\u013d",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0141",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\u0142",
+            "\1\u0143",
+            "\1\u0144",
+            "\1\u0145",
+            "",
+            "",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0147",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "",
+            "",
+            ""
+    };
+
+    static final short[] DFA18_eot = DFA.unpackEncodedString(DFA18_eotS);
+    static final short[] DFA18_eof = DFA.unpackEncodedString(DFA18_eofS);
+    static final char[] DFA18_min = DFA.unpackEncodedStringToUnsignedChars(DFA18_minS);
+    static final char[] DFA18_max = DFA.unpackEncodedStringToUnsignedChars(DFA18_maxS);
+    static final short[] DFA18_accept = DFA.unpackEncodedString(DFA18_acceptS);
+    static final short[] DFA18_special = DFA.unpackEncodedString(DFA18_specialS);
+    static final short[][] DFA18_transition;
+
+    static {
+        int numStates = DFA18_transitionS.length;
+        DFA18_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA18_transition[i] = DFA.unpackEncodedString(DFA18_transitionS[i]);
+        }
+    }
+
+    class DFA18 extends DFA {
+
+        public DFA18(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 18;
+            this.eot = DFA18_eot;
+            this.eof = DFA18_eof;
+            this.min = DFA18_min;
+            this.max = DFA18_max;
+            this.accept = DFA18_accept;
+            this.special = DFA18_special;
+            this.transition = DFA18_transition;
+        }
+        public String getDescription() {
+            return "1:1: Tokens : ( T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | WS | INT | FLOAT | STRING | BOOL | PACKAGE | IMPORT | FUNCTION | EVENT | GLOBAL | DECLARE | RULE | QUERY | TEMPLATE | ATTRIBUTES | DATE_EFFECTIVE | DATE_EXPIRES | ENABLED | SALIENCE | NO_LOOP | AUTO_FOCUS | ACTIVATION_GROUP | AGENDA_GROUP | DIALECT | RULEFLOW_GROUP | DURATION | LOCK_ON_ACTIVE | FROM | ACCUMULATE | TIMEWINDOW | INIT | ACTION | REVERSE | RESULT | COLLECT | ENTRY_POINT | OR | AND | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | IN | NULL | EXISTS | NOT | EVAL | FORALL | WHEN | THEN | END | ID | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | COMMA | DOT | DOUBLE_AMPER | DOUBLE_PIPE | TILDE | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT | MISC );";
+        }
+    }
+ 
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLParser.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLParser.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DRLParser.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10106 @@
+// $ANTLR 3.0.1 C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g 2008-03-12 13:23:56
+
+	package org.drools.lang;
+	import java.util.List;
+	import java.util.ArrayList;
+	import java.util.Iterator;
+	import java.util.HashMap;	
+	import java.util.StringTokenizer;
+	import org.drools.lang.descr.*;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+public class DRLParser extends Parser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PACKAGE", "IMPORT", "FUNCTION", "ID", "DOT", "GLOBAL", "LEFT_PAREN", "COMMA", "RIGHT_PAREN", "DECLARE", "LEFT_CURLY", "RIGHT_CURLY", "STRING", "QUERY", "END", "TEMPLATE", "RULE", "WHEN", "ATTRIBUTES", "DATE_EFFECTIVE", "DATE_EXPIRES", "ENABLED", "BOOL", "SALIENCE", "INT", "NO_LOOP", "AUTO_FOCUS", "ACTIVATION_GROUP", "RULEFLOW_GROUP", "AGENDA_GROUP", "DURATION", "DIALECT", "LOCK_ON_ACTIVE", "OR", "DOUBLE_PIPE", "AND", "DOUBLE_AMPER", "FROM", "EXISTS", "NOT", "EVAL", "FORALL", "ACCUMULATE", "INIT", "ACTION", "REVERSE", "RESULT", "TIMEWINDOW", "COLLECT", "ENTRY_POINT", "CONTAINS", "EXCLUDES", "MATCHES", "SOUNDSLIKE", "MEMBEROF", "TILDE", "IN", "FLOAT", "NULL", "LEFT_SQUARE", "RIGHT_SQUARE", "THEN", "EVENT", "EOL", "WS", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "MULTI_LINE_COMMENT", "MISC", "';'", "'.*'", "':'", "'->'", "'=='", "'>'", "'>='", "'<'!
 ", "'<='", "'!='"
+    };
+    public static final int ACCUMULATE=46;
+    public static final int PACKAGE=4;
+    public static final int FUNCTION=6;
+    public static final int RIGHT_SQUARE=64;
+    public static final int ACTIVATION_GROUP=31;
+    public static final int RIGHT_CURLY=15;
+    public static final int ATTRIBUTES=22;
+    public static final int DIALECT=35;
+    public static final int CONTAINS=54;
+    public static final int NO_LOOP=29;
+    public static final int MEMBEROF=58;
+    public static final int LOCK_ON_ACTIVE=36;
+    public static final int AGENDA_GROUP=33;
+    public static final int FLOAT=61;
+    public static final int SH_STYLE_SINGLE_LINE_COMMENT=73;
+    public static final int NOT=43;
+    public static final int ID=7;
+    public static final int AND=39;
+    public static final int EOF=-1;
+    public static final int HexDigit=70;
+    public static final int DATE_EFFECTIVE=23;
+    public static final int ACTION=48;
+    public static final int DOUBLE_PIPE=38;
+    public static final int RIGHT_PAREN=12;
+    public static final int IMPORT=5;
+    public static final int EOL=67;
+    public static final int DOUBLE_AMPER=40;
+    public static final int THEN=65;
+    public static final int IN=60;
+    public static final int MATCHES=56;
+    public static final int COMMA=11;
+    public static final int TILDE=59;
+    public static final int ENABLED=25;
+    public static final int EXISTS=42;
+    public static final int DOT=8;
+    public static final int RULE=20;
+    public static final int TIMEWINDOW=51;
+    public static final int EXCLUDES=55;
+    public static final int AUTO_FOCUS=30;
+    public static final int NULL=62;
+    public static final int SOUNDSLIKE=57;
+    public static final int BOOL=26;
+    public static final int FORALL=45;
+    public static final int SALIENCE=27;
+    public static final int RULEFLOW_GROUP=32;
+    public static final int RESULT=50;
+    public static final int INT=28;
+    public static final int EVENT=66;
+    public static final int MULTI_LINE_COMMENT=75;
+    public static final int DURATION=34;
+    public static final int WS=68;
+    public static final int EVAL=44;
+    public static final int TEMPLATE=19;
+    public static final int WHEN=21;
+    public static final int UnicodeEscape=71;
+    public static final int ENTRY_POINT=53;
+    public static final int LEFT_CURLY=14;
+    public static final int OR=37;
+    public static final int LEFT_PAREN=10;
+    public static final int QUERY=17;
+    public static final int DECLARE=13;
+    public static final int MISC=76;
+    public static final int REVERSE=49;
+    public static final int END=18;
+    public static final int GLOBAL=9;
+    public static final int FROM=41;
+    public static final int COLLECT=52;
+    public static final int LEFT_SQUARE=63;
+    public static final int INIT=47;
+    public static final int OctalEscape=72;
+    public static final int EscapeSequence=69;
+    public static final int C_STYLE_SINGLE_LINE_COMMENT=74;
+    public static final int STRING=16;
+    public static final int DATE_EXPIRES=24;
+
+        public DRLParser(TokenStream input) {
+            super(input);
+            ruleMemo = new HashMap[88+1];
+         }
+        
+
+    public String[] getTokenNames() { return tokenNames; }
+    public String getGrammarFileName() { return "C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g"; }
+
+    
+    	private PackageDescr packageDescr;
+    	private List errors = new ArrayList();
+    	private String source = "unknown";
+    	private int lineOffset = 0;
+    	private DescrFactory factory = new DescrFactory();
+    	private boolean parserDebug = false;
+    	private Location location = new Location( Location.LOCATION_UNKNOWN );
+    	
+    	// THE FOLLOWING LINES ARE DUMMY ATTRIBUTES TO WORK AROUND AN ANTLR BUG
+    	private BaseDescr from = null;
+    	private FieldConstraintDescr fc = null;
+    	private RestrictionConnectiveDescr and = null;
+    	private RestrictionConnectiveDescr or = null;
+    	private ConditionalElementDescr base = null;
+    	
+    	public void setParserDebug(boolean parserDebug) {
+    		this.parserDebug = parserDebug;
+    	}
+    	
+    	public void debug(String message) {
+    		if ( parserDebug ) 
+    			System.err.println( "drl parser: " + message );
+    	}
+    	
+    	public void setSource(String source) {
+    		this.source = source;
+    	}
+    	public DescrFactory getFactory() {
+    		return factory;
+    	}	
+    
+    	public String getSource() {
+    		return this.source;
+    	}
+    	
+    	public PackageDescr getPackageDescr() {
+    		return packageDescr;
+    	}
+    	
+    	private int offset(int line) {
+    		return line + lineOffset;
+    	}
+    	
+    	/**
+    	 * This will set the offset to record when reparsing. Normally is zero of course 
+    	 */
+    	public void setLineOffset(int i) {
+    	 	this.lineOffset = i;
+    	}
+    	
+    	private String getString(String token) {
+    		return safeSubstring( token, 1, token.length() -1 );
+    	}
+    	
+    	private String cleanupSpaces( String input ) {
+                    return input.replaceAll( "\\s", "" );
+            }
+    	
+    	
+    	public void reportError(RecognitionException ex) {
+    	        // if we've already reported an error and have not matched a token
+                    // yet successfully, don't report any errors.
+                    if ( errorRecovery ) {
+                            return;
+                    }
+                    errorRecovery = true;
+    
+    		ex.line = offset(ex.line); //add the offset if there is one
+    		errors.add( ex ); 
+    	}
+         	
+         	/** return the raw RecognitionException errors */
+         	public List getErrors() {
+         		return errors;
+         	}
+         	
+         	/** Return a list of pretty strings summarising the errors */
+         	public List getErrorMessages() {
+         		List messages = new ArrayList();
+     		for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+         	     		messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+         	     	}
+         	     	return messages;
+         	}
+         	
+         	/** return true if any parser errors were accumulated */
+         	public boolean hasErrors() {
+      		return ! errors.isEmpty();
+         	}
+         	
+         	/** This will take a RecognitionException, and create a sensible error message out of it */
+         	public String createErrorMessage(RecognitionException e)
+            {
+    		StringBuffer message = new StringBuffer();		
+                    message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+                    if ( e instanceof MismatchedTokenException ) {
+                            MismatchedTokenException mte = (MismatchedTokenException)e;
+                            if( mte.expecting >=0 && mte.expecting < tokenNames.length ) {
+    	                        message.append("mismatched token: "+
+                                                               e.token+
+                                                               "; expecting type "+
+                                                               tokenNames[mte.expecting]);
+                            } else {
+    	                        message.append("mismatched token: "+
+                                                               e.token+
+                                                               ";");
+                            }
+                    }
+                    else if ( e instanceof MismatchedTreeNodeException ) {
+                            MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+                            if( mtne.expecting >=0 && mtne.expecting < tokenNames.length ) {
+    	                        message.append("mismatched tree node: "+
+                                                               mtne.toString() +
+                                                               "; expecting type "+
+                                                               tokenNames[mtne.expecting]);
+                            } else {
+    	                        message.append("mismatched tree node: "+
+                                                               mtne.toString() +
+                                                               ";");
+                            }
+                    }
+                    else if ( e instanceof NoViableAltException ) {
+                            NoViableAltException nvae = (NoViableAltException)e;
+    			message.append( "Unexpected token '" + e.token.getText() + "'" );
+                            /*
+                            message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+                                                               " state "+nvae.stateNumber+
+                                                               " (decision="+nvae.decisionNumber+
+                                                               ") no viable alt; token="+
+                                                               e.token);
+                                                               */
+                    }
+                    else if ( e instanceof EarlyExitException ) {
+                            EarlyExitException eee = (EarlyExitException)e;
+                            message.append("required (...)+ loop (decision="+
+                                                               eee.decisionNumber+
+                                                               ") did not match anything; token="+
+                                                               e.token);
+                    }
+                    else if ( e instanceof MismatchedSetException ) {
+                            MismatchedSetException mse = (MismatchedSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof MismatchedNotSetException ) {
+                            MismatchedNotSetException mse = (MismatchedNotSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof FailedPredicateException ) {
+                            FailedPredicateException fpe = (FailedPredicateException)e;
+                            message.append("rule "+fpe.ruleName+" failed predicate: {"+
+                                                               fpe.predicateText+"}?");
+                    } else if (e instanceof GeneralParseException) {
+    			message.append(" " + e.getMessage());
+    		}
+                   	return message.toString();
+            }   
+            
+            void checkTrailingSemicolon(String text, int line) {
+            	if (text.trim().endsWith( ";" ) ) {
+            		this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
+            	}
+            }
+            
+            public Location getLocation() {
+                    return this.location;
+            }
+            
+            private String safeSubstring( String text, int start, int end ) {
+                	return text.substring( Math.min( start, text.length() ), Math.min( Math.max( start, end ), text.length() ) );
+            }
+          
+
+
+
+    // $ANTLR start opt_semicolon
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:195:1: opt_semicolon : ( ';' )? ;
+    public final void opt_semicolon() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:2: ( ( ';' )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ( ';' )?
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ( ';' )?
+            int alt1=2;
+            int LA1_0 = input.LA(1);
+
+            if ( (LA1_0==77) ) {
+                alt1=1;
+            }
+            switch (alt1) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ';'
+                    {
+                    match(input,77,FOLLOW_77_in_opt_semicolon39); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end opt_semicolon
+
+
+    // $ANTLR start compilation_unit
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:199:1: compilation_unit : prolog ( statement )* EOF ;
+    public final void compilation_unit() throws RecognitionException {
+        
+        		// reset Location information
+        		this.location = new Location( Location.LOCATION_UNKNOWN );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:204:2: ( prolog ( statement )* EOF )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:204:4: prolog ( statement )* EOF
+            {
+            pushFollow(FOLLOW_prolog_in_compilation_unit57);
+            prolog();
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:205:3: ( statement )*
+            loop2:
+            do {
+                int alt2=2;
+                int LA2_0 = input.LA(1);
+
+                if ( ((LA2_0>=IMPORT && LA2_0<=FUNCTION)||LA2_0==GLOBAL||LA2_0==DECLARE||LA2_0==QUERY||(LA2_0>=TEMPLATE && LA2_0<=RULE)||(LA2_0>=DATE_EFFECTIVE && LA2_0<=ENABLED)||LA2_0==SALIENCE||(LA2_0>=NO_LOOP && LA2_0<=LOCK_ON_ACTIVE)) ) {
+                    alt2=1;
+                }
+
+
+                switch (alt2) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:205:3: statement
+            	    {
+            	    pushFollow(FOLLOW_statement_in_compilation_unit62);
+            	    statement();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop2;
+                }
+            } while (true);
+
+            match(input,EOF,FOLLOW_EOF_in_compilation_unit67); if (failed) return ;
+
+            }
+
+        }
+        catch ( RecognitionException e ) {
+            
+            		reportError( e );
+            	
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end compilation_unit
+
+
+    // $ANTLR start prolog
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:212:1: prolog : (pkgstmt= package_statement )? ;
+    public final void prolog() throws RecognitionException {
+        String pkgstmt = null;
+
+
+        
+        		String packageName = "";
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:2: ( (pkgstmt= package_statement )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:4: (pkgstmt= package_statement )?
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:4: (pkgstmt= package_statement )?
+            int alt3=2;
+            int LA3_0 = input.LA(1);
+
+            if ( (LA3_0==PACKAGE) ) {
+                alt3=1;
+            }
+            switch (alt3) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:6: pkgstmt= package_statement
+                    {
+                    pushFollow(FOLLOW_package_statement_in_prolog96);
+                    pkgstmt=package_statement();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       packageName = pkgstmt; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+               
+              			this.packageDescr = factory.createPackage( packageName ); 
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end prolog
+
+
+    // $ANTLR start statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );
+    public final void statement() throws RecognitionException {
+        AttributeDescr a = null;
+
+        FactTemplateDescr t = null;
+
+        RuleDescr r = null;
+
+        QueryDescr q = null;
+
+        TypeDeclarationDescr d = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:224:2: (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration )
+            int alt4=9;
+            switch ( input.LA(1) ) {
+            case DATE_EFFECTIVE:
+            case DATE_EXPIRES:
+            case ENABLED:
+            case SALIENCE:
+            case NO_LOOP:
+            case AUTO_FOCUS:
+            case ACTIVATION_GROUP:
+            case RULEFLOW_GROUP:
+            case AGENDA_GROUP:
+            case DURATION:
+            case DIALECT:
+            case LOCK_ON_ACTIVE:
+                {
+                alt4=1;
+                }
+                break;
+            case IMPORT:
+                {
+                int LA4_2 = input.LA(2);
+
+                if ( (LA4_2==FUNCTION) ) {
+                    alt4=2;
+                }
+                else if ( (LA4_2==ID) ) {
+                    alt4=3;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );", 4, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case GLOBAL:
+                {
+                alt4=4;
+                }
+                break;
+            case FUNCTION:
+                {
+                alt4=5;
+                }
+                break;
+            case TEMPLATE:
+                {
+                alt4=6;
+                }
+                break;
+            case RULE:
+                {
+                alt4=7;
+                }
+                break;
+            case QUERY:
+                {
+                alt4=8;
+                }
+                break;
+            case DECLARE:
+                {
+                alt4=9;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );", 4, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt4) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:224:4: a= rule_attribute
+                    {
+                    pushFollow(FOLLOW_rule_attribute_in_statement121);
+                    a=rule_attribute();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addAttribute( a ); 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:225:4: function_import_statement
+                    {
+                    pushFollow(FOLLOW_function_import_statement_in_statement128);
+                    function_import_statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:226:4: import_statement
+                    {
+                    pushFollow(FOLLOW_import_statement_in_statement134);
+                    import_statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:227:4: global
+                    {
+                    pushFollow(FOLLOW_global_in_statement140);
+                    global();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:228:4: function
+                    {
+                    pushFollow(FOLLOW_function_in_statement146);
+                    function();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:229:10: t= template
+                    {
+                    pushFollow(FOLLOW_template_in_statement160);
+                    t=template();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addFactTemplate( t ); 
+                    }
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:230:4: r= rule
+                    {
+                    pushFollow(FOLLOW_rule_in_statement169);
+                    r=rule();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addRule( r ); 
+                    }
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:231:4: q= query
+                    {
+                    pushFollow(FOLLOW_query_in_statement181);
+                    q=query();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addRule( q ); 
+                    }
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:232:10: d= type_declaration
+                    {
+                    pushFollow(FOLLOW_type_declaration_in_statement196);
+                    d=type_declaration();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addTypeDeclaration( d ); 
+                    }
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end statement
+
+
+    // $ANTLR start package_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:235:1: package_statement returns [String packageName] : PACKAGE n= dotted_name opt_semicolon ;
+    public final String package_statement() throws RecognitionException {
+        String packageName = null;
+
+        String n = null;
+
+
+        
+        		packageName = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:239:2: ( PACKAGE n= dotted_name opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:240:3: PACKAGE n= dotted_name opt_semicolon
+            {
+            match(input,PACKAGE,FOLLOW_PACKAGE_in_package_statement222); if (failed) return packageName;
+            pushFollow(FOLLOW_dotted_name_in_package_statement226);
+            n=dotted_name();
+            _fsp--;
+            if (failed) return packageName;
+            pushFollow(FOLLOW_opt_semicolon_in_package_statement228);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return packageName;
+            if ( backtracking==0 ) {
+              
+              			packageName = n;
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return packageName;
+    }
+    // $ANTLR end package_statement
+
+
+    // $ANTLR start import_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:248:1: import_statement : IMPORT import_name[importDecl] opt_semicolon ;
+    public final void import_statement() throws RecognitionException {
+        Token IMPORT1=null;
+
+        
+                	ImportDescr importDecl = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:252:2: ( IMPORT import_name[importDecl] opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:252:4: IMPORT import_name[importDecl] opt_semicolon
+            {
+            IMPORT1=(Token)input.LT(1);
+            match(input,IMPORT,FOLLOW_IMPORT_in_import_statement259); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	            importDecl = factory.createImport( );
+              	            importDecl.setStartCharacter( ((CommonToken)IMPORT1).getStartIndex() );
+              		    if (packageDescr != null) {
+              			packageDescr.addImport( importDecl );
+              		    }
+              	        
+            }
+            pushFollow(FOLLOW_import_name_in_import_statement282);
+            import_name(importDecl);
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_import_statement285);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end import_statement
+
+
+    // $ANTLR start function_import_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:263:1: function_import_statement : IMPORT FUNCTION import_name[importDecl] opt_semicolon ;
+    public final void function_import_statement() throws RecognitionException {
+        Token IMPORT2=null;
+
+        
+                	FunctionImportDescr importDecl = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:267:2: ( IMPORT FUNCTION import_name[importDecl] opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:267:4: IMPORT FUNCTION import_name[importDecl] opt_semicolon
+            {
+            IMPORT2=(Token)input.LT(1);
+            match(input,IMPORT,FOLLOW_IMPORT_in_function_import_statement309); if (failed) return ;
+            match(input,FUNCTION,FOLLOW_FUNCTION_in_function_import_statement311); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	            importDecl = factory.createFunctionImport();
+              	            importDecl.setStartCharacter( ((CommonToken)IMPORT2).getStartIndex() );
+              		    if (packageDescr != null) {
+              			packageDescr.addFunctionImport( importDecl );
+              		    }
+              	        
+            }
+            pushFollow(FOLLOW_import_name_in_function_import_statement334);
+            import_name(importDecl);
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_function_import_statement337);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end function_import_statement
+
+
+    // $ANTLR start import_name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:278:1: import_name[ImportDescr importDecl] returns [String name] : ID ( DOT id= identifier )* (star= '.*' )? ;
+    public final String import_name(ImportDescr importDecl) throws RecognitionException {
+        String name = null;
+
+        Token star=null;
+        Token ID3=null;
+        Token DOT4=null;
+        identifier_return id = null;
+
+
+        
+        		name = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:282:2: ( ID ( DOT id= identifier )* (star= '.*' )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:283:3: ID ( DOT id= identifier )* (star= '.*' )?
+            {
+            ID3=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_import_name362); if (failed) return name;
+            if ( backtracking==0 ) {
+               
+              		    name =ID3.getText(); 
+              		    importDecl.setTarget( name );
+              		    importDecl.setEndCharacter( ((CommonToken)ID3).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:289:3: ( DOT id= identifier )*
+            loop5:
+            do {
+                int alt5=2;
+                int LA5_0 = input.LA(1);
+
+                if ( (LA5_0==DOT) ) {
+                    alt5=1;
+                }
+
+
+                switch (alt5) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:289:5: DOT id= identifier
+            	    {
+            	    DOT4=(Token)input.LT(1);
+            	    match(input,DOT,FOLLOW_DOT_in_import_name374); if (failed) return name;
+            	    pushFollow(FOLLOW_identifier_in_import_name378);
+            	    id=identifier();
+            	    _fsp--;
+            	    if (failed) return name;
+            	    if ( backtracking==0 ) {
+            	       
+            	      		        name = name + DOT4.getText() + input.toString(id.start,id.stop); 
+            	      			importDecl.setTarget( name );
+            	      		        importDecl.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+            	      		    
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop5;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:296:3: (star= '.*' )?
+            int alt6=2;
+            int LA6_0 = input.LA(1);
+
+            if ( (LA6_0==78) ) {
+                alt6=1;
+            }
+            switch (alt6) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:296:5: star= '.*'
+                    {
+                    star=(Token)input.LT(1);
+                    match(input,78,FOLLOW_78_in_import_name402); if (failed) return name;
+                    if ( backtracking==0 ) {
+                       
+                      		        name = name + star.getText(); 
+                      			importDecl.setTarget( name );
+                      		        importDecl.setEndCharacter( ((CommonToken)star).getStopIndex() );
+                      		    
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return name;
+    }
+    // $ANTLR end import_name
+
+
+    // $ANTLR start global
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:306:1: global : GLOBAL type= dotted_name id= identifier opt_semicolon ;
+    public final void global() throws RecognitionException {
+        Token GLOBAL5=null;
+        String type = null;
+
+        identifier_return id = null;
+
+
+        
+        	    GlobalDescr global = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:310:2: ( GLOBAL type= dotted_name id= identifier opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:311:3: GLOBAL type= dotted_name id= identifier opt_semicolon
+            {
+            GLOBAL5=(Token)input.LT(1);
+            match(input,GLOBAL,FOLLOW_GLOBAL_in_global436); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global = factory.createGlobal();
+              	            global.setStartCharacter( ((CommonToken)GLOBAL5).getStartIndex() );
+              		    packageDescr.addGlobal( global );
+              		
+            }
+            pushFollow(FOLLOW_dotted_name_in_global447);
+            type=dotted_name();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global.setType( type );
+              		
+            }
+            pushFollow(FOLLOW_identifier_in_global458);
+            id=identifier();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_global460);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global.setIdentifier( input.toString(id.start,id.stop) );
+              		    global.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end global
+
+
+    // $ANTLR start function
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:329:1: function : FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk ;
+    public final void function() throws RecognitionException {
+        Token FUNCTION6=null;
+        String retType = null;
+
+        identifier_return id = null;
+
+        String paramType = null;
+
+        String paramName = null;
+
+        curly_chunk_return body = null;
+
+
+        
+        		FunctionDescr f = null;
+        		String type = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:334:2: ( FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:3: FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk
+            {
+            FUNCTION6=(Token)input.LT(1);
+            match(input,FUNCTION,FOLLOW_FUNCTION_in_function485); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:19: (retType= dotted_name )?
+            int alt7=2;
+            int LA7_0 = input.LA(1);
+
+            if ( ((LA7_0>=PACKAGE && LA7_0<=ID)||LA7_0==GLOBAL||(LA7_0>=QUERY && LA7_0<=ATTRIBUTES)||LA7_0==ENABLED||LA7_0==SALIENCE||(LA7_0>=DURATION && LA7_0<=DIALECT)||LA7_0==FROM||(LA7_0>=INIT && LA7_0<=RESULT)||(LA7_0>=CONTAINS && LA7_0<=MEMBEROF)||LA7_0==IN||(LA7_0>=THEN && LA7_0<=EVENT)) ) {
+                int LA7_1 = input.LA(2);
+
+                if ( ((LA7_1>=PACKAGE && LA7_1<=GLOBAL)||(LA7_1>=QUERY && LA7_1<=ATTRIBUTES)||LA7_1==ENABLED||LA7_1==SALIENCE||(LA7_1>=DURATION && LA7_1<=DIALECT)||LA7_1==FROM||(LA7_1>=INIT && LA7_1<=RESULT)||(LA7_1>=CONTAINS && LA7_1<=MEMBEROF)||LA7_1==IN||LA7_1==LEFT_SQUARE||(LA7_1>=THEN && LA7_1<=EVENT)) ) {
+                    alt7=1;
+                }
+            }
+            switch (alt7) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:19: retType= dotted_name
+                    {
+                    pushFollow(FOLLOW_dotted_name_in_function489);
+                    retType=dotted_name();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_identifier_in_function494);
+            id=identifier();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			//System.err.println( "function :: " + n.getText() );
+              			type = retType != null ? retType : null;
+              			f = factory.createFunction( input.toString(id.start,id.stop), type );
+              			f.setLocation(offset(FUNCTION6.getLine()), FUNCTION6.getCharPositionInLine());
+              	        	f.setStartCharacter( ((CommonToken)FUNCTION6).getStartIndex() );
+              			packageDescr.addFunction( f );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function503); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:4: ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )?
+            int alt11=2;
+            int LA11_0 = input.LA(1);
+
+            if ( ((LA11_0>=PACKAGE && LA11_0<=ID)||LA11_0==GLOBAL||(LA11_0>=QUERY && LA11_0<=ATTRIBUTES)||LA11_0==ENABLED||LA11_0==SALIENCE||(LA11_0>=DURATION && LA11_0<=DIALECT)||LA11_0==FROM||(LA11_0>=INIT && LA11_0<=RESULT)||(LA11_0>=CONTAINS && LA11_0<=MEMBEROF)||LA11_0==IN||(LA11_0>=THEN && LA11_0<=EVENT)) ) {
+                alt11=1;
+            }
+            switch (alt11) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:6: (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )*
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:15: (paramType= dotted_name )?
+                    int alt8=2;
+                    alt8 = dfa8.predict(input);
+                    switch (alt8) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:15: paramType= dotted_name
+                            {
+                            pushFollow(FOLLOW_dotted_name_in_function512);
+                            paramType=dotted_name();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    pushFollow(FOLLOW_argument_in_function517);
+                    paramName=argument();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      					type = paramType != null ? paramType : null;
+                      					f.addParameter( type, paramName );
+                      				
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:5: ( COMMA (paramType= dotted_name )? paramName= argument )*
+                    loop10:
+                    do {
+                        int alt10=2;
+                        int LA10_0 = input.LA(1);
+
+                        if ( (LA10_0==COMMA) ) {
+                            alt10=1;
+                        }
+
+
+                        switch (alt10) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:7: COMMA (paramType= dotted_name )? paramName= argument
+                    	    {
+                    	    match(input,COMMA,FOLLOW_COMMA_in_function531); if (failed) return ;
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:22: (paramType= dotted_name )?
+                    	    int alt9=2;
+                    	    alt9 = dfa9.predict(input);
+                    	    switch (alt9) {
+                    	        case 1 :
+                    	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:22: paramType= dotted_name
+                    	            {
+                    	            pushFollow(FOLLOW_dotted_name_in_function535);
+                    	            paramType=dotted_name();
+                    	            _fsp--;
+                    	            if (failed) return ;
+
+                    	            }
+                    	            break;
+
+                    	    }
+
+                    	    pushFollow(FOLLOW_argument_in_function540);
+                    	    paramName=argument();
+                    	    _fsp--;
+                    	    if (failed) return ;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      						type = paramType != null ? paramType : null;
+                    	      						f.addParameter( type, paramName );
+                    	      					
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop10;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function564); if (failed) return ;
+            pushFollow(FOLLOW_curly_chunk_in_function570);
+            body=curly_chunk();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			//strip out '{','}'
+              			f.setText( safeSubstring( input.toString(body.start,body.stop), 1, input.toString(body.start,body.stop).length()-1 ) );
+              			f.setEndCharacter( ((CommonToken)((Token)body.stop)).getStopIndex() );
+              			f.setEndLocation(offset(((Token)body.stop).getLine()), ((Token)body.stop).getCharPositionInLine());
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end function
+
+
+    // $ANTLR start argument
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:367:1: argument returns [String name] : id= identifier ( '[' ']' )* ;
+    public final String argument() throws RecognitionException {
+        String name = null;
+
+        identifier_return id = null;
+
+
+        
+        		name = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:2: (id= identifier ( '[' ']' )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:4: id= identifier ( '[' ']' )*
+            {
+            pushFollow(FOLLOW_identifier_in_argument597);
+            id=identifier();
+            _fsp--;
+            if (failed) return name;
+            if ( backtracking==0 ) {
+               name =input.toString(id.start,id.stop); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:38: ( '[' ']' )*
+            loop12:
+            do {
+                int alt12=2;
+                int LA12_0 = input.LA(1);
+
+                if ( (LA12_0==LEFT_SQUARE) ) {
+                    alt12=1;
+                }
+
+
+                switch (alt12) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:40: '[' ']'
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_argument603); if (failed) return name;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_argument605); if (failed) return name;
+            	    if ( backtracking==0 ) {
+            	       name += "[]";
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop12;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return name;
+    }
+    // $ANTLR end argument
+
+
+    // $ANTLR start type_declaration
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:374:1: type_declaration returns [TypeDeclarationDescr declaration] : DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY ;
+    public final TypeDeclarationDescr type_declaration() throws RecognitionException {
+        TypeDeclarationDescr declaration = null;
+
+        identifier_return id = null;
+
+
+        
+                        declaration = factory.createTypeDeclaration();
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:378:9: ( DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:378:11: DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY
+            {
+            match(input,DECLARE,FOLLOW_DECLARE_in_type_declaration645); if (failed) return declaration;
+            pushFollow(FOLLOW_identifier_in_type_declaration649);
+            id=identifier();
+            _fsp--;
+            if (failed) return declaration;
+            if ( backtracking==0 ) {
+              
+                                          declaration.setTypeName( input.toString(id.start,id.stop) );
+                                      
+            }
+            match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_type_declaration694); if (failed) return declaration;
+            pushFollow(FOLLOW_type_decl_attribute_in_type_declaration720);
+            type_decl_attribute(declaration);
+            _fsp--;
+            if (failed) return declaration;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:383:59: ( COMMA type_decl_attribute[$declaration] )*
+            loop13:
+            do {
+                int alt13=2;
+                int LA13_0 = input.LA(1);
+
+                if ( (LA13_0==COMMA) ) {
+                    alt13=1;
+                }
+
+
+                switch (alt13) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:383:61: COMMA type_decl_attribute[$declaration]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_type_declaration725); if (failed) return declaration;
+            	    pushFollow(FOLLOW_type_decl_attribute_in_type_declaration727);
+            	    type_decl_attribute(declaration);
+            	    _fsp--;
+            	    if (failed) return declaration;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop13;
+                }
+            } while (true);
+
+            match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_type_declaration749); if (failed) return declaration;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return declaration;
+    }
+    // $ANTLR end type_declaration
+
+
+    // $ANTLR start type_decl_attribute
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:387:1: type_decl_attribute[TypeDeclarationDescr declaration] : att= identifier (val= STRING | cl= dotted_name ) ;
+    public final void type_decl_attribute(TypeDeclarationDescr declaration) throws RecognitionException {
+        Token val=null;
+        identifier_return att = null;
+
+        String cl = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:388:9: (att= identifier (val= STRING | cl= dotted_name ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:388:11: att= identifier (val= STRING | cl= dotted_name )
+            {
+            pushFollow(FOLLOW_identifier_in_type_decl_attribute785);
+            att=identifier();
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:389:17: (val= STRING | cl= dotted_name )
+            int alt14=2;
+            int LA14_0 = input.LA(1);
+
+            if ( (LA14_0==STRING) ) {
+                alt14=1;
+            }
+            else if ( ((LA14_0>=PACKAGE && LA14_0<=ID)||LA14_0==GLOBAL||(LA14_0>=QUERY && LA14_0<=ATTRIBUTES)||LA14_0==ENABLED||LA14_0==SALIENCE||(LA14_0>=DURATION && LA14_0<=DIALECT)||LA14_0==FROM||(LA14_0>=INIT && LA14_0<=RESULT)||(LA14_0>=CONTAINS && LA14_0<=MEMBEROF)||LA14_0==IN||(LA14_0>=THEN && LA14_0<=EVENT)) ) {
+                alt14=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("389:17: (val= STRING | cl= dotted_name )", 14, 0, input);
+
+                throw nvae;
+            }
+            switch (alt14) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:389:19: val= STRING
+                    {
+                    val=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_type_decl_attribute808); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                                          declaration.addAttribute( input.toString(att.start,att.stop), getString( val.getText() ) );
+                                      
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:393:19: cl= dotted_name
+                    {
+                    pushFollow(FOLLOW_dotted_name_in_type_decl_attribute849);
+                    cl=dotted_name();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                                          declaration.addAttribute( input.toString(att.start,att.stop), cl );
+                                      
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end type_decl_attribute
+
+
+    // $ANTLR start query
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:400:1: query returns [QueryDescr query] : QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon ;
+    public final QueryDescr query() throws RecognitionException {
+        QueryDescr query = null;
+
+        Token paramName=null;
+        Token QUERY7=null;
+        Token END8=null;
+        name_return queryName = null;
+
+        qualified_id_return paramType = null;
+
+
+        
+        		query = null;
+        		AndDescr lhs = null;
+        		List params = null;
+        		List types = null;		
+         
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:408:2: ( QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:409:3: QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon
+            {
+            QUERY7=(Token)input.LT(1);
+            match(input,QUERY,FOLLOW_QUERY_in_query922); if (failed) return query;
+            pushFollow(FOLLOW_name_in_query926);
+            queryName=name();
+            _fsp--;
+            if (failed) return query;
+            if ( backtracking==0 ) {
+               
+              			query = factory.createQuery( queryName.name ); 
+              			query.setLocation( offset(QUERY7.getLine()), QUERY7.getCharPositionInLine() );
+              			query.setStartCharacter( ((CommonToken)QUERY7).getStartIndex() );
+              			lhs = new AndDescr(); query.setLhs( lhs ); 
+              			lhs.setLocation( offset(QUERY7.getLine()), QUERY7.getCharPositionInLine() );
+                                      location.setType( Location.LOCATION_RULE_HEADER );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:418:3: ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )?
+            int alt19=2;
+            alt19 = dfa19.predict(input);
+            switch (alt19) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:418:5: LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_query936); if (failed) return query;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:419:11: ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )?
+                    int alt18=2;
+                    int LA18_0 = input.LA(1);
+
+                    if ( (LA18_0==ID) ) {
+                        alt18=1;
+                    }
+                    switch (alt18) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:419:13: ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )*
+                            {
+                            if ( backtracking==0 ) {
+                               params = new ArrayList(); types = new ArrayList();
+                            }
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:15: ( (paramType= qualified_id )? paramName= ID )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:16: (paramType= qualified_id )? paramName= ID
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:25: (paramType= qualified_id )?
+                            int alt15=2;
+                            int LA15_0 = input.LA(1);
+
+                            if ( (LA15_0==ID) ) {
+                                int LA15_1 = input.LA(2);
+
+                                if ( ((LA15_1>=ID && LA15_1<=DOT)||LA15_1==LEFT_SQUARE) ) {
+                                    alt15=1;
+                                }
+                            }
+                            switch (alt15) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:25: paramType= qualified_id
+                                    {
+                                    pushFollow(FOLLOW_qualified_id_in_query971);
+                                    paramType=qualified_id();
+                                    _fsp--;
+                                    if (failed) return query;
+
+                                    }
+                                    break;
+
+                            }
+
+                            paramName=(Token)input.LT(1);
+                            match(input,ID,FOLLOW_ID_in_query976); if (failed) return query;
+                            if ( backtracking==0 ) {
+                               params.add( paramName.getText() ); String type = (paramType != null) ? paramType.text : "Object"; types.add( type ); 
+                            }
+
+                            }
+
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:15: ( COMMA (paramType= qualified_id )? paramName= ID )*
+                            loop17:
+                            do {
+                                int alt17=2;
+                                int LA17_0 = input.LA(1);
+
+                                if ( (LA17_0==COMMA) ) {
+                                    alt17=1;
+                                }
+
+
+                                switch (alt17) {
+                            	case 1 :
+                            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:16: COMMA (paramType= qualified_id )? paramName= ID
+                            	    {
+                            	    match(input,COMMA,FOLLOW_COMMA_in_query997); if (failed) return query;
+                            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:31: (paramType= qualified_id )?
+                            	    int alt16=2;
+                            	    int LA16_0 = input.LA(1);
+
+                            	    if ( (LA16_0==ID) ) {
+                            	        int LA16_1 = input.LA(2);
+
+                            	        if ( ((LA16_1>=ID && LA16_1<=DOT)||LA16_1==LEFT_SQUARE) ) {
+                            	            alt16=1;
+                            	        }
+                            	    }
+                            	    switch (alt16) {
+                            	        case 1 :
+                            	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:31: paramType= qualified_id
+                            	            {
+                            	            pushFollow(FOLLOW_qualified_id_in_query1001);
+                            	            paramType=qualified_id();
+                            	            _fsp--;
+                            	            if (failed) return query;
+
+                            	            }
+                            	            break;
+
+                            	    }
+
+                            	    paramName=(Token)input.LT(1);
+                            	    match(input,ID,FOLLOW_ID_in_query1006); if (failed) return query;
+                            	    if ( backtracking==0 ) {
+                            	       params.add( paramName.getText() );  String type = (paramType != null) ? paramType.text : "Object"; types.add( type );  
+                            	    }
+
+                            	    }
+                            	    break;
+
+                            	default :
+                            	    break loop17;
+                                }
+                            } while (true);
+
+                            if ( backtracking==0 ) {
+                              	query.setParameters( (String[]) params.toArray( new String[params.size()] ) ); 
+                              		            	query.setParameterTypes( (String[]) types.toArray( new String[types.size()] ) ); 
+                              		            
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_query1056); if (failed) return query;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+                                      location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              	        
+            }
+            pushFollow(FOLLOW_normal_lhs_block_in_query1085);
+            normal_lhs_block(lhs);
+            _fsp--;
+            if (failed) return query;
+            END8=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_query1090); if (failed) return query;
+            pushFollow(FOLLOW_opt_semicolon_in_query1092);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return query;
+            if ( backtracking==0 ) {
+              
+              			query.setEndCharacter( ((CommonToken)END8).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return query;
+    }
+    // $ANTLR end query
+
+
+    // $ANTLR start template
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:440:1: template returns [FactTemplateDescr template] : TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon ;
+    public final FactTemplateDescr template() throws RecognitionException {
+        FactTemplateDescr template = null;
+
+        Token TEMPLATE9=null;
+        Token END10=null;
+        name_return templateName = null;
+
+        FieldTemplateDescr slot = null;
+
+
+        
+        		template = null;		
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:444:2: ( TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:445:3: TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon
+            {
+            TEMPLATE9=(Token)input.LT(1);
+            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_template1120); if (failed) return template;
+            pushFollow(FOLLOW_name_in_template1124);
+            templateName=name();
+            _fsp--;
+            if (failed) return template;
+            pushFollow(FOLLOW_opt_semicolon_in_template1126);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return template;
+            if ( backtracking==0 ) {
+              
+              			template = new FactTemplateDescr(templateName.name);
+              			template.setLocation( offset(TEMPLATE9.getLine()), TEMPLATE9.getCharPositionInLine() );			
+              			template.setStartCharacter( ((CommonToken)TEMPLATE9).getStartIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:451:3: (slot= template_slot )+
+            int cnt20=0;
+            loop20:
+            do {
+                int alt20=2;
+                int LA20_0 = input.LA(1);
+
+                if ( (LA20_0==ID) ) {
+                    alt20=1;
+                }
+
+
+                switch (alt20) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:452:4: slot= template_slot
+            	    {
+            	    pushFollow(FOLLOW_template_slot_in_template1141);
+            	    slot=template_slot();
+            	    _fsp--;
+            	    if (failed) return template;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				template.addFieldTemplate( slot );
+            	      			
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt20 >= 1 ) break loop20;
+            	    if (backtracking>0) {failed=true; return template;}
+                        EarlyExitException eee =
+                            new EarlyExitException(20, input);
+                        throw eee;
+                }
+                cnt20++;
+            } while (true);
+
+            END10=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_template1156); if (failed) return template;
+            pushFollow(FOLLOW_opt_semicolon_in_template1158);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return template;
+            if ( backtracking==0 ) {
+              
+              			template.setEndCharacter( ((CommonToken)END10).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return template;
+    }
+    // $ANTLR end template
+
+
+    // $ANTLR start template_slot
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:463:1: template_slot returns [FieldTemplateDescr field] : fieldType= qualified_id id= identifier opt_semicolon ;
+    public final FieldTemplateDescr template_slot() throws RecognitionException {
+        FieldTemplateDescr field = null;
+
+        qualified_id_return fieldType = null;
+
+        identifier_return id = null;
+
+
+        
+        		field = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:467:2: (fieldType= qualified_id id= identifier opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:468:11: fieldType= qualified_id id= identifier opt_semicolon
+            {
+            if ( backtracking==0 ) {
+              
+              			field = factory.createFieldTemplate();
+              	         
+            }
+            pushFollow(FOLLOW_qualified_id_in_template_slot1204);
+            fieldType=qualified_id();
+            _fsp--;
+            if (failed) return field;
+            if ( backtracking==0 ) {
+              
+              		        field.setClassType( fieldType.text );
+              			field.setStartCharacter( ((CommonToken)((Token)fieldType.start)).getStartIndex() );
+              			field.setEndCharacter( ((CommonToken)((Token)fieldType.stop)).getStopIndex() );
+              		 
+            }
+            pushFollow(FOLLOW_identifier_in_template_slot1220);
+            id=identifier();
+            _fsp--;
+            if (failed) return field;
+            pushFollow(FOLLOW_opt_semicolon_in_template_slot1222);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return field;
+            if ( backtracking==0 ) {
+              
+              		        field.setName( input.toString(id.start,id.stop) );
+              			field.setLocation( offset(((Token)id.start).getLine()), ((Token)id.start).getCharPositionInLine() );
+              			field.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+              		 
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return field;
+    }
+    // $ANTLR end template_slot
+
+
+    // $ANTLR start rule
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:486:1: rule returns [RuleDescr rule] : RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule] ;
+    public final RuleDescr rule() throws RecognitionException {
+        RuleDescr rule = null;
+
+        Token RULE11=null;
+        Token WHEN12=null;
+        name_return ruleName = null;
+
+
+        
+        		rule = null;
+        		AndDescr lhs = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:491:2: ( RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:492:3: RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule]
+            {
+            RULE11=(Token)input.LT(1);
+            match(input,RULE,FOLLOW_RULE_in_rule1253); if (failed) return rule;
+            pushFollow(FOLLOW_name_in_rule1257);
+            ruleName=name();
+            _fsp--;
+            if (failed) return rule;
+            if ( backtracking==0 ) {
+               
+              			location.setType( Location.LOCATION_RULE_HEADER );
+              			debug( "start rule: " + ruleName.name );
+              			rule = new RuleDescr( ruleName.name, null ); 
+              			rule.setLocation( offset(RULE11.getLine()), RULE11.getCharPositionInLine() );
+              			rule.setStartCharacter( ((CommonToken)RULE11).getStartIndex() );
+              			lhs = new AndDescr(); 
+              			rule.setLhs( lhs ); 
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:502:3: ( rule_attributes[$rule] )?
+            int alt21=2;
+            int LA21_0 = input.LA(1);
+
+            if ( ((LA21_0>=ATTRIBUTES && LA21_0<=ENABLED)||LA21_0==SALIENCE||(LA21_0>=NO_LOOP && LA21_0<=LOCK_ON_ACTIVE)) ) {
+                alt21=1;
+            }
+            switch (alt21) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:502:3: rule_attributes[$rule]
+                    {
+                    pushFollow(FOLLOW_rule_attributes_in_rule1266);
+                    rule_attributes(rule);
+                    _fsp--;
+                    if (failed) return rule;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:503:3: ( WHEN ( ':' )? normal_lhs_block[lhs] )?
+            int alt23=2;
+            int LA23_0 = input.LA(1);
+
+            if ( (LA23_0==WHEN) ) {
+                alt23=1;
+            }
+            switch (alt23) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:4: WHEN ( ':' )? normal_lhs_block[lhs]
+                    {
+                    WHEN12=(Token)input.LT(1);
+                    match(input,WHEN,FOLLOW_WHEN_in_rule1278); if (failed) return rule;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:9: ( ':' )?
+                    int alt22=2;
+                    int LA22_0 = input.LA(1);
+
+                    if ( (LA22_0==79) ) {
+                        alt22=1;
+                    }
+                    switch (alt22) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:9: ':'
+                            {
+                            match(input,79,FOLLOW_79_in_rule1280); if (failed) return rule;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                       
+                      				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+                      				lhs.setLocation( offset(WHEN12.getLine()), WHEN12.getCharPositionInLine() );
+                      				lhs.setStartCharacter( ((CommonToken)WHEN12).getStartIndex() );
+                      			
+                    }
+                    pushFollow(FOLLOW_normal_lhs_block_in_rule1291);
+                    normal_lhs_block(lhs);
+                    _fsp--;
+                    if (failed) return rule;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_rhs_chunk_in_rule1301);
+            rhs_chunk(rule);
+            _fsp--;
+            if (failed) return rule;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return rule;
+    }
+    // $ANTLR end rule
+
+
+    // $ANTLR start rule_attributes
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:517:1: rule_attributes[RuleDescr rule] : ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )* ;
+    public final void rule_attributes(RuleDescr rule) throws RecognitionException {
+        AttributeDescr attr = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:518:2: ( ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:2: ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )*
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:2: ( ATTRIBUTES ':' )?
+            int alt24=2;
+            int LA24_0 = input.LA(1);
+
+            if ( (LA24_0==ATTRIBUTES) ) {
+                alt24=1;
+            }
+            switch (alt24) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:4: ATTRIBUTES ':'
+                    {
+                    match(input,ATTRIBUTES,FOLLOW_ATTRIBUTES_in_rule_attributes1321); if (failed) return ;
+                    match(input,79,FOLLOW_79_in_rule_attributes1323); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_rule_attribute_in_rule_attributes1331);
+            attr=rule_attribute();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+               rule.addAttribute( attr ); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:2: ( ( ',' )? attr= rule_attribute )*
+            loop26:
+            do {
+                int alt26=2;
+                int LA26_0 = input.LA(1);
+
+                if ( (LA26_0==COMMA||(LA26_0>=DATE_EFFECTIVE && LA26_0<=ENABLED)||LA26_0==SALIENCE||(LA26_0>=NO_LOOP && LA26_0<=LOCK_ON_ACTIVE)) ) {
+                    alt26=1;
+                }
+
+
+                switch (alt26) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ( ',' )? attr= rule_attribute
+            	    {
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ( ',' )?
+            	    int alt25=2;
+            	    int LA25_0 = input.LA(1);
+
+            	    if ( (LA25_0==COMMA) ) {
+            	        alt25=1;
+            	    }
+            	    switch (alt25) {
+            	        case 1 :
+            	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ','
+            	            {
+            	            match(input,COMMA,FOLLOW_COMMA_in_rule_attributes1338); if (failed) return ;
+
+            	            }
+            	            break;
+
+            	    }
+
+            	    pushFollow(FOLLOW_rule_attribute_in_rule_attributes1343);
+            	    attr=rule_attribute();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       rule.addAttribute( attr ); 
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop26;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end rule_attributes
+
+
+    // $ANTLR start rule_attribute
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:526:1: rule_attribute returns [AttributeDescr attr] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect );
+    public final AttributeDescr rule_attribute() throws RecognitionException {
+        AttributeDescr attr = null;
+
+        AttributeDescr a = null;
+
+
+        
+        		attr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:533:2: (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect )
+            int alt27=12;
+            switch ( input.LA(1) ) {
+            case SALIENCE:
+                {
+                alt27=1;
+                }
+                break;
+            case NO_LOOP:
+                {
+                alt27=2;
+                }
+                break;
+            case AGENDA_GROUP:
+                {
+                alt27=3;
+                }
+                break;
+            case DURATION:
+                {
+                alt27=4;
+                }
+                break;
+            case ACTIVATION_GROUP:
+                {
+                alt27=5;
+                }
+                break;
+            case AUTO_FOCUS:
+                {
+                alt27=6;
+                }
+                break;
+            case DATE_EFFECTIVE:
+                {
+                alt27=7;
+                }
+                break;
+            case DATE_EXPIRES:
+                {
+                alt27=8;
+                }
+                break;
+            case ENABLED:
+                {
+                alt27=9;
+                }
+                break;
+            case RULEFLOW_GROUP:
+                {
+                alt27=10;
+                }
+                break;
+            case LOCK_ON_ACTIVE:
+                {
+                alt27=11;
+                }
+                break;
+            case DIALECT:
+                {
+                alt27=12;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return attr;}
+                NoViableAltException nvae =
+                    new NoViableAltException("526:1: rule_attribute returns [AttributeDescr attr] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect );", 27, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt27) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:533:4: a= salience
+                    {
+                    pushFollow(FOLLOW_salience_in_rule_attribute1380);
+                    a=salience();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:534:4: a= no_loop
+                    {
+                    pushFollow(FOLLOW_no_loop_in_rule_attribute1388);
+                    a=no_loop();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:535:4: a= agenda_group
+                    {
+                    pushFollow(FOLLOW_agenda_group_in_rule_attribute1397);
+                    a=agenda_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:536:4: a= duration
+                    {
+                    pushFollow(FOLLOW_duration_in_rule_attribute1406);
+                    a=duration();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:537:4: a= activation_group
+                    {
+                    pushFollow(FOLLOW_activation_group_in_rule_attribute1415);
+                    a=activation_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:538:4: a= auto_focus
+                    {
+                    pushFollow(FOLLOW_auto_focus_in_rule_attribute1423);
+                    a=auto_focus();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:539:4: a= date_effective
+                    {
+                    pushFollow(FOLLOW_date_effective_in_rule_attribute1431);
+                    a=date_effective();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:540:4: a= date_expires
+                    {
+                    pushFollow(FOLLOW_date_expires_in_rule_attribute1439);
+                    a=date_expires();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:541:4: a= enabled
+                    {
+                    pushFollow(FOLLOW_enabled_in_rule_attribute1447);
+                    a=enabled();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 10 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:542:4: a= ruleflow_group
+                    {
+                    pushFollow(FOLLOW_ruleflow_group_in_rule_attribute1455);
+                    a=ruleflow_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 11 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:543:4: a= lock_on_active
+                    {
+                    pushFollow(FOLLOW_lock_on_active_in_rule_attribute1463);
+                    a=lock_on_active();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 12 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:544:4: a= dialect
+                    {
+                    pushFollow(FOLLOW_dialect_in_rule_attribute1470);
+                    a=dialect();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+
+            }
+            if ( backtracking==0 ) {
+              
+              		attr = a;
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return attr;
+    }
+    // $ANTLR end rule_attribute
+
+
+    // $ANTLR start date_effective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:547:1: date_effective returns [AttributeDescr descr] : DATE_EFFECTIVE STRING ;
+    public final AttributeDescr date_effective() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING13=null;
+        Token DATE_EFFECTIVE14=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:551:2: ( DATE_EFFECTIVE STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:552:3: DATE_EFFECTIVE STRING
+            {
+            DATE_EFFECTIVE14=(Token)input.LT(1);
+            match(input,DATE_EFFECTIVE,FOLLOW_DATE_EFFECTIVE_in_date_effective1496); if (failed) return descr;
+            STRING13=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_date_effective1498); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "date-effective", getString( STRING13.getText() ) );
+              			descr.setLocation( offset( DATE_EFFECTIVE14.getLine() ), DATE_EFFECTIVE14.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DATE_EFFECTIVE14).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING13).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end date_effective
+
+
+    // $ANTLR start date_expires
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:562:1: date_expires returns [AttributeDescr descr] : DATE_EXPIRES STRING ;
+    public final AttributeDescr date_expires() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING15=null;
+        Token DATE_EXPIRES16=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:566:2: ( DATE_EXPIRES STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:566:4: DATE_EXPIRES STRING
+            {
+            DATE_EXPIRES16=(Token)input.LT(1);
+            match(input,DATE_EXPIRES,FOLLOW_DATE_EXPIRES_in_date_expires1527); if (failed) return descr;
+            STRING15=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_date_expires1529); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "date-expires", getString( STRING15.getText() ) );
+              			descr.setLocation( offset(DATE_EXPIRES16.getLine()), DATE_EXPIRES16.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DATE_EXPIRES16).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING15).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end date_expires
+
+
+    // $ANTLR start enabled
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:575:1: enabled returns [AttributeDescr descr] : ENABLED BOOL ;
+    public final AttributeDescr enabled() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token BOOL17=null;
+        Token ENABLED18=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:579:2: ( ENABLED BOOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:579:5: ENABLED BOOL
+            {
+            ENABLED18=(Token)input.LT(1);
+            match(input,ENABLED,FOLLOW_ENABLED_in_enabled1558); if (failed) return descr;
+            BOOL17=(Token)input.LT(1);
+            match(input,BOOL,FOLLOW_BOOL_in_enabled1560); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              				descr = new AttributeDescr( "enabled", BOOL17.getText() );
+              				descr.setLocation( offset(ENABLED18.getLine()), ENABLED18.getCharPositionInLine() );
+              				descr.setStartCharacter( ((CommonToken)ENABLED18).getStartIndex() );
+              				descr.setEndCharacter( ((CommonToken)BOOL17).getStopIndex() );
+              			
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end enabled
+
+
+    // $ANTLR start salience
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:588:1: salience returns [AttributeDescr descr] : SALIENCE ( INT | txt= paren_chunk ) ;
+    public final AttributeDescr salience() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token SALIENCE19=null;
+        Token INT20=null;
+        paren_chunk_return txt = null;
+
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:592:2: ( SALIENCE ( INT | txt= paren_chunk ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:593:3: SALIENCE ( INT | txt= paren_chunk )
+            {
+            SALIENCE19=(Token)input.LT(1);
+            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience1593); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "salience" );
+              			descr.setLocation( offset(SALIENCE19.getLine()), SALIENCE19.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)SALIENCE19).getStartIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:599:3: ( INT | txt= paren_chunk )
+            int alt28=2;
+            int LA28_0 = input.LA(1);
+
+            if ( (LA28_0==INT) ) {
+                alt28=1;
+            }
+            else if ( (LA28_0==LEFT_PAREN) ) {
+                alt28=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return descr;}
+                NoViableAltException nvae =
+                    new NoViableAltException("599:3: ( INT | txt= paren_chunk )", 28, 0, input);
+
+                throw nvae;
+            }
+            switch (alt28) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:599:5: INT
+                    {
+                    INT20=(Token)input.LT(1);
+                    match(input,INT,FOLLOW_INT_in_salience1604); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      			descr.setValue( INT20.getText() );
+                      			descr.setEndCharacter( ((CommonToken)INT20).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:604:5: txt= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_salience1619);
+                    txt=paren_chunk();
+                    _fsp--;
+                    if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      			descr.setValue( input.toString(txt.start,txt.stop) );
+                      			descr.setEndCharacter( ((CommonToken)((Token)txt.stop)).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end salience
+
+
+    // $ANTLR start no_loop
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:612:1: no_loop returns [AttributeDescr descr] : NO_LOOP ( BOOL )? ;
+    public final AttributeDescr no_loop() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token NO_LOOP21=null;
+        Token BOOL22=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:616:2: ( NO_LOOP ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:616:4: NO_LOOP ( BOOL )?
+            {
+            NO_LOOP21=(Token)input.LT(1);
+            match(input,NO_LOOP,FOLLOW_NO_LOOP_in_no_loop1649); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "no-loop", "true" );
+              			descr.setLocation( offset(NO_LOOP21.getLine()), NO_LOOP21.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)NO_LOOP21).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)NO_LOOP21).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:623:3: ( BOOL )?
+            int alt29=2;
+            int LA29_0 = input.LA(1);
+
+            if ( (LA29_0==BOOL) ) {
+                alt29=1;
+            }
+            switch (alt29) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:623:5: BOOL
+                    {
+                    BOOL22=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_no_loop1662); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL22.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL22).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end no_loop
+
+
+    // $ANTLR start auto_focus
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:631:1: auto_focus returns [AttributeDescr descr] : AUTO_FOCUS ( BOOL )? ;
+    public final AttributeDescr auto_focus() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token AUTO_FOCUS23=null;
+        Token BOOL24=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:635:2: ( AUTO_FOCUS ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:635:4: AUTO_FOCUS ( BOOL )?
+            {
+            AUTO_FOCUS23=(Token)input.LT(1);
+            match(input,AUTO_FOCUS,FOLLOW_AUTO_FOCUS_in_auto_focus1697); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "auto-focus", "true" );
+              			descr.setLocation( offset(AUTO_FOCUS23.getLine()), AUTO_FOCUS23.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)AUTO_FOCUS23).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)AUTO_FOCUS23).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:642:3: ( BOOL )?
+            int alt30=2;
+            int LA30_0 = input.LA(1);
+
+            if ( (LA30_0==BOOL) ) {
+                alt30=1;
+            }
+            switch (alt30) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:642:5: BOOL
+                    {
+                    BOOL24=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_auto_focus1710); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL24.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL24).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end auto_focus
+
+
+    // $ANTLR start activation_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:650:1: activation_group returns [AttributeDescr descr] : ACTIVATION_GROUP STRING ;
+    public final AttributeDescr activation_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING25=null;
+        Token ACTIVATION_GROUP26=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:654:2: ( ACTIVATION_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:654:4: ACTIVATION_GROUP STRING
+            {
+            ACTIVATION_GROUP26=(Token)input.LT(1);
+            match(input,ACTIVATION_GROUP,FOLLOW_ACTIVATION_GROUP_in_activation_group1746); if (failed) return descr;
+            STRING25=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_activation_group1748); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "activation-group", getString( STRING25.getText() ) );
+              			descr.setLocation( offset(ACTIVATION_GROUP26.getLine()), ACTIVATION_GROUP26.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)ACTIVATION_GROUP26).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING25).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end activation_group
+
+
+    // $ANTLR start ruleflow_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:663:1: ruleflow_group returns [AttributeDescr descr] : RULEFLOW_GROUP STRING ;
+    public final AttributeDescr ruleflow_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING27=null;
+        Token RULEFLOW_GROUP28=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:667:2: ( RULEFLOW_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:667:4: RULEFLOW_GROUP STRING
+            {
+            RULEFLOW_GROUP28=(Token)input.LT(1);
+            match(input,RULEFLOW_GROUP,FOLLOW_RULEFLOW_GROUP_in_ruleflow_group1776); if (failed) return descr;
+            STRING27=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_ruleflow_group1778); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "ruleflow-group", getString( STRING27.getText() ) );
+              			descr.setLocation( offset(RULEFLOW_GROUP28.getLine()), RULEFLOW_GROUP28.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)RULEFLOW_GROUP28).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING27).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end ruleflow_group
+
+
+    // $ANTLR start agenda_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:676:1: agenda_group returns [AttributeDescr descr] : AGENDA_GROUP STRING ;
+    public final AttributeDescr agenda_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING29=null;
+        Token AGENDA_GROUP30=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:680:2: ( AGENDA_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:680:4: AGENDA_GROUP STRING
+            {
+            AGENDA_GROUP30=(Token)input.LT(1);
+            match(input,AGENDA_GROUP,FOLLOW_AGENDA_GROUP_in_agenda_group1806); if (failed) return descr;
+            STRING29=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_agenda_group1808); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "agenda-group", getString( STRING29.getText() ) );
+              			descr.setLocation( offset(AGENDA_GROUP30.getLine()), AGENDA_GROUP30.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)AGENDA_GROUP30).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING29).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end agenda_group
+
+
+    // $ANTLR start duration
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:689:1: duration returns [AttributeDescr descr] : DURATION INT ;
+    public final AttributeDescr duration() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token INT31=null;
+        Token DURATION32=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:693:2: ( DURATION INT )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:693:4: DURATION INT
+            {
+            DURATION32=(Token)input.LT(1);
+            match(input,DURATION,FOLLOW_DURATION_in_duration1836); if (failed) return descr;
+            INT31=(Token)input.LT(1);
+            match(input,INT,FOLLOW_INT_in_duration1838); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "duration", INT31.getText() );
+              			descr.setLocation( offset(DURATION32.getLine()), DURATION32.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DURATION32).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)INT31).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end duration
+
+
+    // $ANTLR start dialect
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:702:1: dialect returns [AttributeDescr descr] : DIALECT STRING ;
+    public final AttributeDescr dialect() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING33=null;
+        Token DIALECT34=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:706:2: ( DIALECT STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:706:4: DIALECT STRING
+            {
+            DIALECT34=(Token)input.LT(1);
+            match(input,DIALECT,FOLLOW_DIALECT_in_dialect1866); if (failed) return descr;
+            STRING33=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_dialect1868); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "dialect", getString( STRING33.getText() ) );
+              			descr.setLocation( offset(DIALECT34.getLine()), DIALECT34.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DIALECT34).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING33).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end dialect
+
+
+    // $ANTLR start lock_on_active
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:715:1: lock_on_active returns [AttributeDescr descr] : LOCK_ON_ACTIVE ( BOOL )? ;
+    public final AttributeDescr lock_on_active() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token LOCK_ON_ACTIVE35=null;
+        Token BOOL36=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:719:2: ( LOCK_ON_ACTIVE ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:719:4: LOCK_ON_ACTIVE ( BOOL )?
+            {
+            LOCK_ON_ACTIVE35=(Token)input.LT(1);
+            match(input,LOCK_ON_ACTIVE,FOLLOW_LOCK_ON_ACTIVE_in_lock_on_active1900); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "lock-on-active", "true" );
+              			descr.setLocation( offset(LOCK_ON_ACTIVE35.getLine()), LOCK_ON_ACTIVE35.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)LOCK_ON_ACTIVE35).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)LOCK_ON_ACTIVE35).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:726:3: ( BOOL )?
+            int alt31=2;
+            int LA31_0 = input.LA(1);
+
+            if ( (LA31_0==BOOL) ) {
+                alt31=1;
+            }
+            switch (alt31) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:726:5: BOOL
+                    {
+                    BOOL36=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_lock_on_active1913); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL36.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL36).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end lock_on_active
+
+
+    // $ANTLR start normal_lhs_block
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:734:1: normal_lhs_block[AndDescr descr] : (d= lhs[$descr] )* ;
+    public final void normal_lhs_block(AndDescr descr) throws RecognitionException {
+        BaseDescr d = null;
+
+
+        
+        		location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:738:2: ( (d= lhs[$descr] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:3: (d= lhs[$descr] )*
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:3: (d= lhs[$descr] )*
+            loop32:
+            do {
+                int alt32=2;
+                int LA32_0 = input.LA(1);
+
+                if ( (LA32_0==ID||LA32_0==LEFT_PAREN||(LA32_0>=EXISTS && LA32_0<=FORALL)) ) {
+                    alt32=1;
+                }
+
+
+                switch (alt32) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:5: d= lhs[$descr]
+            	    {
+            	    pushFollow(FOLLOW_lhs_in_normal_lhs_block1952);
+            	    d=lhs(descr);
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       if( d != null) descr.addDescr( d ); 
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop32;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end normal_lhs_block
+
+
+    // $ANTLR start lhs
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:745:1: lhs[ConditionalElementDescr ce] returns [BaseDescr d] : l= lhs_or ;
+    public final BaseDescr lhs(ConditionalElementDescr ce) throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr l = null;
+
+
+        
+        		d =null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:749:2: (l= lhs_or )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:749:4: l= lhs_or
+            {
+            pushFollow(FOLLOW_lhs_or_in_lhs1989);
+            l=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               d = l; 
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs
+
+
+    // $ANTLR start lhs_or
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );
+    public final BaseDescr lhs_or() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr lhsand = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d = null;
+        		OrDescr or = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:758:2: ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* )
+            int alt35=2;
+            int LA35_0 = input.LA(1);
+
+            if ( (LA35_0==LEFT_PAREN) ) {
+                int LA35_1 = input.LA(2);
+
+                if ( (LA35_1==ID||LA35_1==LEFT_PAREN||LA35_1==AND||(LA35_1>=EXISTS && LA35_1<=FORALL)) ) {
+                    alt35=2;
+                }
+                else if ( (LA35_1==OR) ) {
+                    alt35=1;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );", 35, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA35_0==ID||(LA35_0>=EXISTS && LA35_0<=FORALL)) ) {
+                alt35=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );", 35, 0, input);
+
+                throw nvae;
+            }
+            switch (alt35) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:758:4: LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_or2014); if (failed) return d;
+                    match(input,OR,FOLLOW_OR_in_lhs_or2016); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      			or = new OrDescr();
+                      			d = or;
+                      			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:764:3: (lhsand= lhs_and )+
+                    int cnt33=0;
+                    loop33:
+                    do {
+                        int alt33=2;
+                        int LA33_0 = input.LA(1);
+
+                        if ( (LA33_0==ID||LA33_0==LEFT_PAREN||(LA33_0>=EXISTS && LA33_0<=FORALL)) ) {
+                            alt33=1;
+                        }
+
+
+                        switch (alt33) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:764:5: lhsand= lhs_and
+                    	    {
+                    	    pushFollow(FOLLOW_lhs_and_in_lhs_or2029);
+                    	    lhsand=lhs_and();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      			or.addDescr( lhsand );
+                    	      		
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt33 >= 1 ) break loop33;
+                    	    if (backtracking>0) {failed=true; return d;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(33, input);
+                                throw eee;
+                        }
+                        cnt33++;
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_or2040); if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:770:10: left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )*
+                    {
+                    pushFollow(FOLLOW_lhs_and_in_lhs_or2058);
+                    left=lhs_and();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = left; 
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:771:3: ( ( OR | DOUBLE_PIPE ) right= lhs_and )*
+                    loop34:
+                    do {
+                        int alt34=2;
+                        int LA34_0 = input.LA(1);
+
+                        if ( ((LA34_0>=OR && LA34_0<=DOUBLE_PIPE)) ) {
+                            alt34=1;
+                        }
+
+
+                        switch (alt34) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:771:5: ( OR | DOUBLE_PIPE ) right= lhs_and
+                    	    {
+                    	    if ( (input.LA(1)>=OR && input.LA(1)<=DOUBLE_PIPE) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_or2066);    throw mse;
+                    	    }
+
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                    	      			
+                    	    }
+                    	    pushFollow(FOLLOW_lhs_and_in_lhs_or2082);
+                    	    right=lhs_and();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( or == null ) {
+                    	      					or = new OrDescr();
+                    	      					or.addDescr( left );
+                    	      					d = or;
+                    	      				}
+                    	      				
+                    	      				or.addDescr( right );
+                    	      			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop34;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_or
+
+
+    // $ANTLR start lhs_and
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );
+    public final BaseDescr lhs_and() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr lhsunary = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d = null;
+        		AndDescr and = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:793:2: ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* )
+            int alt38=2;
+            int LA38_0 = input.LA(1);
+
+            if ( (LA38_0==LEFT_PAREN) ) {
+                int LA38_1 = input.LA(2);
+
+                if ( (LA38_1==AND) ) {
+                    alt38=1;
+                }
+                else if ( (LA38_1==ID||LA38_1==LEFT_PAREN||(LA38_1>=EXISTS && LA38_1<=FORALL)) ) {
+                    alt38=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );", 38, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA38_0==ID||(LA38_0>=EXISTS && LA38_0<=FORALL)) ) {
+                alt38=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );", 38, 0, input);
+
+                throw nvae;
+            }
+            switch (alt38) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:793:4: LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_and2113); if (failed) return d;
+                    match(input,AND,FOLLOW_AND_in_lhs_and2115); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      			and = new AndDescr();
+                      			d = and;
+                      			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:799:3: (lhsunary= lhs_unary )+
+                    int cnt36=0;
+                    loop36:
+                    do {
+                        int alt36=2;
+                        int LA36_0 = input.LA(1);
+
+                        if ( (LA36_0==ID||LA36_0==LEFT_PAREN||(LA36_0>=EXISTS && LA36_0<=FORALL)) ) {
+                            alt36=1;
+                        }
+
+
+                        switch (alt36) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:799:4: lhsunary= lhs_unary
+                    	    {
+                    	    pushFollow(FOLLOW_lhs_unary_in_lhs_and2127);
+                    	    lhsunary=lhs_unary();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      			and.addDescr( lhsunary );
+                    	      		
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt36 >= 1 ) break loop36;
+                    	    if (backtracking>0) {failed=true; return d;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(36, input);
+                                throw eee;
+                        }
+                        cnt36++;
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_and2137); if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:805:10: left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )*
+                    {
+                    pushFollow(FOLLOW_lhs_unary_in_lhs_and2155);
+                    left=lhs_unary();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = left; 
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:806:3: ( ( AND | DOUBLE_AMPER ) right= lhs_unary )*
+                    loop37:
+                    do {
+                        int alt37=2;
+                        int LA37_0 = input.LA(1);
+
+                        if ( ((LA37_0>=AND && LA37_0<=DOUBLE_AMPER)) ) {
+                            alt37=1;
+                        }
+
+
+                        switch (alt37) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:806:5: ( AND | DOUBLE_AMPER ) right= lhs_unary
+                    	    {
+                    	    if ( (input.LA(1)>=AND && input.LA(1)<=DOUBLE_AMPER) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_and2163);    throw mse;
+                    	    }
+
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                    	      			
+                    	    }
+                    	    pushFollow(FOLLOW_lhs_unary_in_lhs_and2179);
+                    	    right=lhs_unary();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( and == null ) {
+                    	      					and = new AndDescr();
+                    	      					and.addDescr( left );
+                    	      					d = and;
+                    	      				}
+                    	      				
+                    	      				and.addDescr( right );
+                    	      			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop37;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_and
+
+
+    // $ANTLR start lhs_unary
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:823:1: lhs_unary returns [BaseDescr d] : ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon ;
+    public final BaseDescr lhs_unary() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr u = null;
+
+        BaseDescr ps = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:2: ( ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source )
+            int alt39=6;
+            int LA39_0 = input.LA(1);
+
+            if ( (LA39_0==EXISTS) && (synpred1())) {
+                alt39=1;
+            }
+            else if ( (LA39_0==NOT) && (synpred2())) {
+                alt39=2;
+            }
+            else if ( (LA39_0==EVAL) && (synpred3())) {
+                alt39=3;
+            }
+            else if ( (LA39_0==FORALL) && (synpred4())) {
+                alt39=4;
+            }
+            else if ( (LA39_0==LEFT_PAREN) && (synpred5())) {
+                alt39=5;
+            }
+            else if ( (LA39_0==ID) ) {
+                alt39=6;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source )", 39, 0, input);
+
+                throw nvae;
+            }
+            switch (alt39) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:6: ( EXISTS )=>u= lhs_exist
+                    {
+                    pushFollow(FOLLOW_lhs_exist_in_lhs_unary2224);
+                    u=lhs_exist();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:5: ( NOT )=>u= lhs_not
+                    {
+                    pushFollow(FOLLOW_lhs_not_in_lhs_unary2242);
+                    u=lhs_not();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:5: ( EVAL )=>u= lhs_eval
+                    {
+                    pushFollow(FOLLOW_lhs_eval_in_lhs_unary2261);
+                    u=lhs_eval();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:5: ( FORALL )=>u= lhs_forall
+                    {
+                    pushFollow(FOLLOW_lhs_forall_in_lhs_unary2280);
+                    u=lhs_forall();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:5: ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_unary2297); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_unary2301);
+                    u=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_unary2303); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:832:5: ps= pattern_source
+                    {
+                    pushFollow(FOLLOW_pattern_source_in_lhs_unary2314);
+                    ps=pattern_source();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = (BaseDescr) ps; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_opt_semicolon_in_lhs_unary2326);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return d;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_unary
+
+
+    // $ANTLR start pattern_source
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:837:1: pattern_source returns [BaseDescr d] : u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )? ;
+    public final BaseDescr pattern_source() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr u = null;
+
+        EntryPointDescr ep = null;
+
+        AccumulateDescr ac = null;
+
+        TimeWindowDescr tw = null;
+
+        CollectDescr cs = null;
+
+        FromDescr fm = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:841:2: (u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:842:3: u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )?
+            {
+            pushFollow(FOLLOW_lhs_pattern_in_pattern_source2353);
+            u=lhs_pattern();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               d = u; 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:843:3: ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )?
+            int alt41=3;
+            int LA41_0 = input.LA(1);
+
+            if ( (LA41_0==FROM) ) {
+                int LA41_1 = input.LA(2);
+
+                if ( ((LA41_1>=PACKAGE && LA41_1<=ID)||LA41_1==GLOBAL||(LA41_1>=QUERY && LA41_1<=ATTRIBUTES)||LA41_1==ENABLED||LA41_1==SALIENCE||(LA41_1>=DURATION && LA41_1<=DIALECT)||LA41_1==FROM||(LA41_1>=ACCUMULATE && LA41_1<=COLLECT)||(LA41_1>=CONTAINS && LA41_1<=MEMBEROF)||LA41_1==IN||(LA41_1>=THEN && LA41_1<=EVENT)) ) {
+                    alt41=2;
+                }
+                else if ( (LA41_1==ENTRY_POINT) && (synpred6())) {
+                    alt41=1;
+                }
+            }
+            switch (alt41) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:11: ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:11: ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:13: ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement
+                    {
+                    match(input,FROM,FOLLOW_FROM_in_pattern_source2404); if (failed) return d;
+                    pushFollow(FOLLOW_entrypoint_statement_in_pattern_source2408);
+                    ep=entrypoint_statement();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) ep); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:848:4: FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )
+                    {
+                    match(input,FROM,FOLLOW_FROM_in_pattern_source2428); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType(Location.LOCATION_LHS_FROM);
+                      				location.setProperty(Location.LOCATION_FROM_CONTENT, "");
+                      		        
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:853:11: ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )
+                    int alt40=4;
+                    switch ( input.LA(1) ) {
+                    case ACCUMULATE:
+                        {
+                        alt40=1;
+                        }
+                        break;
+                    case TIMEWINDOW:
+                        {
+                        alt40=2;
+                        }
+                        break;
+                    case COLLECT:
+                        {
+                        alt40=3;
+                        }
+                        break;
+                    case PACKAGE:
+                    case IMPORT:
+                    case FUNCTION:
+                    case ID:
+                    case GLOBAL:
+                    case QUERY:
+                    case END:
+                    case TEMPLATE:
+                    case RULE:
+                    case WHEN:
+                    case ATTRIBUTES:
+                    case ENABLED:
+                    case SALIENCE:
+                    case DURATION:
+                    case DIALECT:
+                    case FROM:
+                    case INIT:
+                    case ACTION:
+                    case REVERSE:
+                    case RESULT:
+                    case CONTAINS:
+                    case EXCLUDES:
+                    case MATCHES:
+                    case SOUNDSLIKE:
+                    case MEMBEROF:
+                    case IN:
+                    case THEN:
+                    case EVENT:
+                        {
+                        alt40=4;
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return d;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("853:11: ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )", 40, 0, input);
+
+                        throw nvae;
+                    }
+
+                    switch (alt40) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:13: (ac= accumulate_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:13: (ac= accumulate_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:15: ac= accumulate_statement
+                            {
+                            pushFollow(FOLLOW_accumulate_statement_in_pattern_source2486);
+                            ac=accumulate_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) ac); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 2 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:15: (tw= timewindow_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:15: (tw= timewindow_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:17: tw= timewindow_statement
+                            {
+                            pushFollow(FOLLOW_timewindow_statement_in_pattern_source2509);
+                            tw=timewindow_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) tw); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 3 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:15: (cs= collect_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:15: (cs= collect_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:17: cs= collect_statement
+                            {
+                            pushFollow(FOLLOW_collect_statement_in_pattern_source2533);
+                            cs=collect_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) cs); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 4 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:15: (fm= from_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:15: (fm= from_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:17: fm= from_statement
+                            {
+                            pushFollow(FOLLOW_from_statement_in_pattern_source2570);
+                            fm=from_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) fm); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end pattern_source
+
+
+    // $ANTLR start lhs_exist
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:863:1: lhs_exist returns [BaseDescr d] : EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) ;
+    public final BaseDescr lhs_exist() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token EXISTS37=null;
+        Token RIGHT_PAREN38=null;
+        BaseDescr or = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:867:2: ( EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:867:4: EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            {
+            EXISTS37=(Token)input.LT(1);
+            match(input,EXISTS,FOLLOW_EXISTS_in_lhs_exist2612); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d = new ExistsDescr( ); 
+              			d.setLocation( offset(EXISTS37.getLine()), EXISTS37.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)EXISTS37).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:10: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            int alt42=2;
+            int LA42_0 = input.LA(1);
+
+            if ( (LA42_0==LEFT_PAREN) ) {
+                alt42=1;
+            }
+            else if ( (LA42_0==ID) ) {
+                alt42=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("874:10: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )", 42, 0, input);
+
+                throw nvae;
+            }
+            switch (alt42) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:12: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:12: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:14: LEFT_PAREN or= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_exist2632); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_exist2636);
+                    or=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if ( or != null ) ((ExistsDescr)d).addDescr( or ); 
+                    }
+                    RIGHT_PAREN38=(Token)input.LT(1);
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_exist2666); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d.setEndCharacter( ((CommonToken)RIGHT_PAREN38).getStopIndex() ); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:879:12: pattern= lhs_pattern
+                    {
+                    pushFollow(FOLLOW_lhs_pattern_in_lhs_exist2716);
+                    pattern=lhs_pattern();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      	                	if ( pattern != null ) {
+                      	                		((ExistsDescr)d).addDescr( pattern );
+                      	                		d.setEndCharacter( pattern.getEndCharacter() );
+                      	                	}
+                      	                
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_exist
+
+
+    // $ANTLR start lhs_not
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:889:1: lhs_not returns [NotDescr d] : NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) ;
+    public final NotDescr lhs_not() throws RecognitionException {
+        NotDescr d = null;
+
+        Token NOT39=null;
+        Token RIGHT_PAREN40=null;
+        BaseDescr or = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:893:2: ( NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:893:4: NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            {
+            NOT39=(Token)input.LT(1);
+            match(input,NOT,FOLLOW_NOT_in_lhs_not2768); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d = new NotDescr( ); 
+              			d.setLocation( offset(NOT39.getLine()), NOT39.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)NOT39).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:3: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            int alt43=2;
+            int LA43_0 = input.LA(1);
+
+            if ( (LA43_0==LEFT_PAREN) ) {
+                alt43=1;
+            }
+            else if ( (LA43_0==ID) ) {
+                alt43=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("900:3: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )", 43, 0, input);
+
+                throw nvae;
+            }
+            switch (alt43) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:5: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:5: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:7: LEFT_PAREN or= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_not2781); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_not2785);
+                    or=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if ( or != null ) d.addDescr( or ); 
+                    }
+                    RIGHT_PAREN40=(Token)input.LT(1);
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_not2816); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d.setEndCharacter( ((CommonToken)RIGHT_PAREN40).getStopIndex() ); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:906:3: pattern= lhs_pattern
+                    {
+                    pushFollow(FOLLOW_lhs_pattern_in_lhs_not2853);
+                    pattern=lhs_pattern();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      	                	if ( pattern != null ) {
+                      	                		d.addDescr( pattern );
+                      	                		d.setEndCharacter( pattern.getEndCharacter() );
+                      	                	}
+                      	                
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_not
+
+
+    // $ANTLR start lhs_eval
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:916:1: lhs_eval returns [BaseDescr d] : EVAL c= paren_chunk ;
+    public final BaseDescr lhs_eval() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token EVAL41=null;
+        paren_chunk_return c = null;
+
+
+        
+        		d = new EvalDescr( );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:920:2: ( EVAL c= paren_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:921:3: EVAL c= paren_chunk
+            {
+            EVAL41=(Token)input.LT(1);
+            match(input,EVAL,FOLLOW_EVAL_in_lhs_eval2899); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_INSIDE_EVAL );
+              		
+            }
+            pushFollow(FOLLOW_paren_chunk_in_lhs_eval2910);
+            c=paren_chunk();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setStartCharacter( ((CommonToken)EVAL41).getStartIndex() );
+              		        if( input.toString(c.start,c.stop) != null ) {
+              	  		    this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		            String body = safeSubstring( input.toString(c.start,c.stop), 1, input.toString(c.start,c.stop).length()-1 );
+              			    checkTrailingSemicolon( body, offset(EVAL41.getLine()) );
+              			    ((EvalDescr) d).setContent( body );
+              			    location.setProperty(Location.LOCATION_EVAL_CONTENT, body);
+              			}
+              			if( ((Token)c.stop) != null ) {
+              			    d.setEndCharacter( ((CommonToken)((Token)c.stop)).getStopIndex() );
+              			}
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_eval
+
+
+    // $ANTLR start lhs_forall
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:941:1: lhs_forall returns [ForallDescr d] : FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN ;
+    public final ForallDescr lhs_forall() throws RecognitionException {
+        ForallDescr d = null;
+
+        Token FORALL42=null;
+        Token RIGHT_PAREN43=null;
+        BaseDescr base = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = factory.createForall();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:945:2: ( FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:945:4: FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN
+            {
+            FORALL42=(Token)input.LT(1);
+            match(input,FORALL,FOLLOW_FORALL_in_lhs_forall2936); if (failed) return d;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_forall2938); if (failed) return d;
+            pushFollow(FOLLOW_lhs_pattern_in_lhs_forall2942);
+            base=lhs_pattern();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d.setStartCharacter( ((CommonToken)FORALL42).getStartIndex() );
+              		        // adding the base pattern
+              		        d.addDescr( base );
+              			d.setLocation( offset(FORALL42.getLine()), FORALL42.getCharPositionInLine() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:952:3: (pattern= lhs_pattern )*
+            loop44:
+            do {
+                int alt44=2;
+                int LA44_0 = input.LA(1);
+
+                if ( (LA44_0==ID) ) {
+                    alt44=1;
+                }
+
+
+                switch (alt44) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:952:5: pattern= lhs_pattern
+            	    {
+            	    pushFollow(FOLLOW_lhs_pattern_in_lhs_forall2957);
+            	    pattern=lhs_pattern();
+            	    _fsp--;
+            	    if (failed) return d;
+            	    if ( backtracking==0 ) {
+            	      
+            	      		        // adding additional patterns
+            	      			d.addDescr( pattern );
+            	      		   
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop44;
+                }
+            } while (true);
+
+            RIGHT_PAREN43=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_forall2973); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setEndCharacter( ((CommonToken)RIGHT_PAREN43).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_forall
+
+
+    // $ANTLR start lhs_pattern
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );
+    public final BaseDescr lhs_pattern() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr f = null;
+
+
+        
+        		d =null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:971:2: (f= fact_binding | f= fact[null] )
+            int alt45=2;
+            int LA45_0 = input.LA(1);
+
+            if ( (LA45_0==ID) ) {
+                int LA45_1 = input.LA(2);
+
+                if ( (LA45_1==79) ) {
+                    alt45=1;
+                }
+                else if ( (LA45_1==DOT||LA45_1==LEFT_PAREN||LA45_1==LEFT_SQUARE) ) {
+                    alt45=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );", 45, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );", 45, 0, input);
+
+                throw nvae;
+            }
+            switch (alt45) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:971:4: f= fact_binding
+                    {
+                    pushFollow(FOLLOW_fact_binding_in_lhs_pattern3006);
+                    f=fact_binding();
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:972:4: f= fact[null]
+                    {
+                    pushFollow(FOLLOW_fact_in_lhs_pattern3014);
+                    f=fact(null);
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+
+            }
+            if ( backtracking==0 ) {
+              
+              		d =f;
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_pattern
+
+
+    // $ANTLR start from_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:975:1: from_statement returns [FromDescr d] : ds= from_source[$d] ;
+    public final FromDescr from_statement() throws RecognitionException {
+        FromDescr d = null;
+
+        DeclarativeInvokerDescr ds = null;
+
+
+        
+        		d =factory.createFrom();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:979:2: (ds= from_source[$d] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:980:2: ds= from_source[$d]
+            {
+            pushFollow(FOLLOW_from_source_in_from_statement3041);
+            ds=from_source(d);
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		d.setDataSource( ds );
+              	
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end from_statement
+
+
+    // $ANTLR start accumulate_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:987:1: accumulate_statement returns [AccumulateDescr d] : ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN ;
+    public final AccumulateDescr accumulate_statement() throws RecognitionException {
+        AccumulateDescr d = null;
+
+        Token id=null;
+        Token ACCUMULATE44=null;
+        Token RIGHT_PAREN45=null;
+        BaseDescr inputCE = null;
+
+        paren_chunk_return text = null;
+
+
+        
+        		d = factory.createAccumulate();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:991:2: ( ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:992:10: ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN
+            {
+            ACCUMULATE44=(Token)input.LT(1);
+            match(input,ACCUMULATE,FOLLOW_ACCUMULATE_in_accumulate_statement3078); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(ACCUMULATE44.getLine()), ACCUMULATE44.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)ACCUMULATE44).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_accumulate_statement3088); if (failed) return d;
+            pushFollow(FOLLOW_lhs_or_in_accumulate_statement3092);
+            inputCE=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:998:29: ( COMMA )?
+            int alt46=2;
+            int LA46_0 = input.LA(1);
+
+            if ( (LA46_0==COMMA) ) {
+                alt46=1;
+            }
+            switch (alt46) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:998:29: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3094); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              		        d.setInput( inputCE );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )
+            int alt51=2;
+            int LA51_0 = input.LA(1);
+
+            if ( (LA51_0==INIT) ) {
+                alt51=1;
+            }
+            else if ( (LA51_0==ID) ) {
+                alt51=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1002:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )", 51, 0, input);
+
+                throw nvae;
+            }
+            switch (alt51) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1003:4: INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk
+                    {
+                    match(input,INIT,FOLLOW_INIT_in_accumulate_statement3112); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_INIT );
+                      			
+                    }
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3125);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1007:21: ( COMMA )?
+                    int alt47=2;
+                    int LA47_0 = input.LA(1);
+
+                    if ( (LA47_0==COMMA) ) {
+                        alt47=1;
+                    }
+                    switch (alt47) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1007:21: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3127); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setInitCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_INIT_CONTENT, d.getInitCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_ACTION );
+                      				}
+                      			
+                    }
+                    match(input,ACTION,FOLLOW_ACTION_in_accumulate_statement3138); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3142);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1015:28: ( COMMA )?
+                    int alt48=2;
+                    int LA48_0 = input.LA(1);
+
+                    if ( (LA48_0==COMMA) ) {
+                        alt48=1;
+                    }
+                    switch (alt48) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1015:28: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3144); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setActionCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_ACTION_CONTENT, d.getActionCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_REVERSE );
+                      				}
+                      			
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:4: ( REVERSE text= paren_chunk ( COMMA )? )?
+                    int alt50=2;
+                    int LA50_0 = input.LA(1);
+
+                    if ( (LA50_0==REVERSE) ) {
+                        alt50=1;
+                    }
+                    switch (alt50) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:6: REVERSE text= paren_chunk ( COMMA )?
+                            {
+                            match(input,REVERSE,FOLLOW_REVERSE_in_accumulate_statement3157); if (failed) return d;
+                            pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3161);
+                            text=paren_chunk();
+                            _fsp--;
+                            if (failed) return d;
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:31: ( COMMA )?
+                            int alt49=2;
+                            int LA49_0 = input.LA(1);
+
+                            if ( (LA49_0==COMMA) ) {
+                                alt49=1;
+                            }
+                            switch (alt49) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:31: COMMA
+                                    {
+                                    match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3163); if (failed) return d;
+
+                                    }
+                                    break;
+
+                            }
+
+                            if ( backtracking==0 ) {
+                              
+                              				if( input.toString(text.start,text.stop) != null ) {
+                              				        d.setReverseCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                              	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_REVERSE_CONTENT, d.getReverseCode());
+                              					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_RESULT );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RESULT,FOLLOW_RESULT_in_accumulate_statement3180); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3184);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setResultCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_RESULT_CONTENT, d.getResultCode());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1041:3: (id= ID text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1041:3: (id= ID text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1042:4: id= ID text= paren_chunk
+                    {
+                    id=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_accumulate_statement3210); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3214);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( id.getText() != null ) {
+                      				        d.setExternalFunction( true );
+                      					d.setFunctionIdentifier( id.getText() );
+                      				}
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setExpression( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_EXPRESSION_CONTENT, d.getExpression());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN45=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_accumulate_statement3231); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN45).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end accumulate_statement
+
+
+    // $ANTLR start timewindow_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1062:1: timewindow_statement returns [TimeWindowDescr d] : TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN ;
+    public final TimeWindowDescr timewindow_statement() throws RecognitionException {
+        TimeWindowDescr d = null;
+
+        Token id=null;
+        Token TIMEWINDOW46=null;
+        Token INT47=null;
+        Token RIGHT_PAREN48=null;
+        BaseDescr inputCE = null;
+
+        paren_chunk_return text = null;
+
+
+        
+        		d = factory.createTimeWindow();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1066:2: ( TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1067:10: TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN
+            {
+            TIMEWINDOW46=(Token)input.LT(1);
+            match(input,TIMEWINDOW,FOLLOW_TIMEWINDOW_in_timewindow_statement3269); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(TIMEWINDOW46.getLine()), TIMEWINDOW46.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)TIMEWINDOW46).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_timewindow_statement3279); if (failed) return d;
+            pushFollow(FOLLOW_lhs_or_in_timewindow_statement3283);
+            inputCE=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1073:29: ( COMMA )?
+            int alt52=2;
+            int LA52_0 = input.LA(1);
+
+            if ( (LA52_0==COMMA) ) {
+                alt52=1;
+            }
+            switch (alt52) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1073:29: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3285); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              		        d.setInput( inputCE );
+              		
+            }
+            INT47=(Token)input.LT(1);
+            match(input,INT,FOLLOW_INT_in_timewindow_statement3295); if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1077:7: ( COMMA )?
+            int alt53=2;
+            int LA53_0 = input.LA(1);
+
+            if ( (LA53_0==COMMA) ) {
+                alt53=1;
+            }
+            switch (alt53) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1077:7: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3297); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              			d.setWindowSize( INT47.getText() );
+              			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_WINDOWSIZE );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )
+            int alt58=2;
+            int LA58_0 = input.LA(1);
+
+            if ( (LA58_0==INIT) ) {
+                alt58=1;
+            }
+            else if ( (LA58_0==ID) ) {
+                alt58=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1082:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )", 58, 0, input);
+
+                throw nvae;
+            }
+            switch (alt58) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1083:4: INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk
+                    {
+                    match(input,INIT,FOLLOW_INIT_in_timewindow_statement3313); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_INIT );
+                      			
+                    }
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3326);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1087:21: ( COMMA )?
+                    int alt54=2;
+                    int LA54_0 = input.LA(1);
+
+                    if ( (LA54_0==COMMA) ) {
+                        alt54=1;
+                    }
+                    switch (alt54) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1087:21: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3328); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setInitCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_INIT_CONTENT, d.getInitCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_ACTION );
+                      				}
+                      			
+                    }
+                    match(input,ACTION,FOLLOW_ACTION_in_timewindow_statement3339); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3343);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1095:28: ( COMMA )?
+                    int alt55=2;
+                    int LA55_0 = input.LA(1);
+
+                    if ( (LA55_0==COMMA) ) {
+                        alt55=1;
+                    }
+                    switch (alt55) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1095:28: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3345); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setActionCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_ACTION_CONTENT, d.getActionCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_REVERSE );
+                      				}
+                      			
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:4: ( REVERSE text= paren_chunk ( COMMA )? )?
+                    int alt57=2;
+                    int LA57_0 = input.LA(1);
+
+                    if ( (LA57_0==REVERSE) ) {
+                        alt57=1;
+                    }
+                    switch (alt57) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:6: REVERSE text= paren_chunk ( COMMA )?
+                            {
+                            match(input,REVERSE,FOLLOW_REVERSE_in_timewindow_statement3358); if (failed) return d;
+                            pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3362);
+                            text=paren_chunk();
+                            _fsp--;
+                            if (failed) return d;
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:31: ( COMMA )?
+                            int alt56=2;
+                            int LA56_0 = input.LA(1);
+
+                            if ( (LA56_0==COMMA) ) {
+                                alt56=1;
+                            }
+                            switch (alt56) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:31: COMMA
+                                    {
+                                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3364); if (failed) return d;
+
+                                    }
+                                    break;
+
+                            }
+
+                            if ( backtracking==0 ) {
+                              
+                              				if( input.toString(text.start,text.stop) != null ) {
+                              				        d.setReverseCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                              	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_REVERSE_CONTENT, d.getReverseCode());
+                              					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_RESULT );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RESULT,FOLLOW_RESULT_in_timewindow_statement3381); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3385);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setResultCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_RESULT_CONTENT, d.getResultCode());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1121:3: (id= ID text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1121:3: (id= ID text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1122:4: id= ID text= paren_chunk
+                    {
+                    id=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_timewindow_statement3410); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3414);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( id.getText() != null ) {
+                      				        d.setExternalFunction( true );
+                      					d.setFunctionIdentifier( id.getText() );
+                      				}
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setExpression( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_EXPRESSION_CONTENT, d.getExpression());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN48=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_timewindow_statement3431); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN48).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end timewindow_statement
+
+
+    // $ANTLR start from_source
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1142:1: from_source[FromDescr from] returns [DeclarativeInvokerDescr ds] : ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )? ;
+    public final DeclarativeInvokerDescr from_source(FromDescr from) throws RecognitionException {
+        DeclarativeInvokerDescr ds = null;
+
+        identifier_return ident = null;
+
+        paren_chunk_return args = null;
+
+
+        
+        		ds = null;
+        		AccessorDescr ad = null;
+        		FunctionCallDescr fc = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1148:2: (ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1148:4: ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )?
+            {
+            pushFollow(FOLLOW_identifier_in_from_source3461);
+            ident=identifier();
+            _fsp--;
+            if (failed) return ds;
+            if ( backtracking==0 ) {
+              
+              			ad = new AccessorDescr(ident.start.getText());	
+              			ad.setLocation( offset(ident.start.getLine()), ident.start.getCharPositionInLine() );
+              			ad.setStartCharacter( ((CommonToken)ident.start).getStartIndex() );
+              			ad.setEndCharacter( ((CommonToken)ident.start).getStopIndex() );
+              			ds = ad;
+              			location.setProperty(Location.LOCATION_FROM_CONTENT, ident.start.getText());
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1157:3: ( options {k=1; } : args= paren_chunk )?
+            int alt59=2;
+            int LA59_0 = input.LA(1);
+
+            if ( (LA59_0==LEFT_PAREN) ) {
+                alt59=1;
+            }
+            switch (alt59) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1164:5: args= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_from_source3489);
+                    args=paren_chunk();
+                    _fsp--;
+                    if (failed) return ds;
+                    if ( backtracking==0 ) {
+                      
+                      			if( input.toString(args.start,args.stop) != null ) {
+                      				ad.setVariableName( null );
+                      				fc = new FunctionCallDescr(((Token)ident.start).getText());
+                      				fc.setLocation( offset(((Token)ident.start).getLine()), ((Token)ident.start).getCharPositionInLine() );			
+                      				fc.setArguments(input.toString(args.start,args.stop));
+                      				fc.setStartCharacter( ((CommonToken)((Token)ident.start)).getStartIndex() );
+                      				fc.setEndCharacter( ((CommonToken)((Token)ident.start)).getStopIndex() );
+                      				location.setProperty(Location.LOCATION_FROM_CONTENT, input.toString(args.start,args.stop));
+                      				from.setEndCharacter( ((CommonToken)((Token)args.stop)).getStopIndex() );
+                      			}
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1178:3: ( expression_chain[$from, ad] )?
+            int alt60=2;
+            int LA60_0 = input.LA(1);
+
+            if ( (LA60_0==DOT) ) {
+                alt60=1;
+            }
+            switch (alt60) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1178:3: expression_chain[$from, ad]
+                    {
+                    pushFollow(FOLLOW_expression_chain_in_from_source3502);
+                    expression_chain(from,  ad);
+                    _fsp--;
+                    if (failed) return ds;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		if( ad != null ) {
+            			if( fc != null ) {
+            				ad.addFirstInvoker( fc );
+            			}
+            			location.setProperty(Location.LOCATION_FROM_CONTENT, ad.toString() );
+            		}
+            	
+        }
+        return ds;
+    }
+    // $ANTLR end from_source
+
+
+    // $ANTLR start expression_chain
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1189:1: expression_chain[FromDescr from, AccessorDescr as] : ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? ) ;
+    public final void expression_chain(FromDescr from, AccessorDescr as) throws RecognitionException {
+        identifier_return field = null;
+
+        square_chunk_return sqarg = null;
+
+        paren_chunk_return paarg = null;
+
+
+        
+          		FieldAccessDescr fa = null;
+        	    	MethodAccessDescr ma = null;	
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1194:2: ( ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:2: ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:2: ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:4: DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )?
+            {
+            match(input,DOT,FOLLOW_DOT_in_expression_chain3533); if (failed) return ;
+            pushFollow(FOLLOW_identifier_in_expression_chain3537);
+            field=identifier();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	        fa = new FieldAccessDescr(((Token)field.start).getText());	
+              		fa.setLocation( offset(((Token)field.start).getLine()), ((Token)field.start).getCharPositionInLine() );
+              		fa.setStartCharacter( ((CommonToken)((Token)field.start)).getStartIndex() );
+              		fa.setEndCharacter( ((CommonToken)((Token)field.start)).getStopIndex() );
+              	    
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1202:4: ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )?
+            int alt61=3;
+            alt61 = dfa61.predict(input);
+            switch (alt61) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:6: ( LEFT_SQUARE )=>sqarg= square_chunk
+                    {
+                    pushFollow(FOLLOW_square_chunk_in_expression_chain3568);
+                    sqarg=square_chunk();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      	          fa.setArgument( input.toString(sqarg.start,sqarg.stop) );	
+                      		  from.setEndCharacter( ((CommonToken)((Token)sqarg.stop)).getStopIndex() );
+                      	      
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:6: ( LEFT_PAREN )=>paarg= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_expression_chain3601);
+                    paarg=paren_chunk();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      	    	  ma = new MethodAccessDescr( ((Token)field.start).getText(), input.toString(paarg.start,paarg.stop) );	
+                      		  ma.setLocation( offset(((Token)field.start).getLine()), ((Token)field.start).getCharPositionInLine() );
+                      		  ma.setStartCharacter( ((CommonToken)((Token)field.start)).getStartIndex() );
+                      		  from.setEndCharacter( ((CommonToken)((Token)paarg.stop)).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1217:4: ( expression_chain[from, as] )?
+            int alt62=2;
+            int LA62_0 = input.LA(1);
+
+            if ( (LA62_0==DOT) ) {
+                alt62=1;
+            }
+            switch (alt62) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1217:4: expression_chain[from, as]
+                    {
+                    pushFollow(FOLLOW_expression_chain_in_expression_chain3616);
+                    expression_chain(from,  as);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		// must be added to the start, since it is a recursive rule
+            		if( ma != null ) {
+            			as.addFirstInvoker( ma );
+            		} else {
+            			as.addFirstInvoker( fa );
+            		}
+            	
+        }
+        return ;
+    }
+    // $ANTLR end expression_chain
+
+
+    // $ANTLR start collect_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1231:1: collect_statement returns [CollectDescr d] : COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN ;
+    public final CollectDescr collect_statement() throws RecognitionException {
+        CollectDescr d = null;
+
+        Token COLLECT49=null;
+        Token RIGHT_PAREN50=null;
+        BaseDescr pattern = null;
+
+
+        
+        		d = factory.createCollect();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1235:2: ( COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1236:10: COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN
+            {
+            COLLECT49=(Token)input.LT(1);
+            match(input,COLLECT,FOLLOW_COLLECT_in_collect_statement3667); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(COLLECT49.getLine()), COLLECT49.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)COLLECT49).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_COLLECT );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_collect_statement3677); if (failed) return d;
+            pushFollow(FOLLOW_pattern_source_in_collect_statement3681);
+            pattern=pattern_source();
+            _fsp--;
+            if (failed) return d;
+            RIGHT_PAREN50=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_collect_statement3683); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setInputPattern( (PatternDescr) pattern );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN50).getStopIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end collect_statement
+
+
+    // $ANTLR start entrypoint_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1250:1: entrypoint_statement returns [EntryPointDescr d] : ENTRY_POINT id= name ;
+    public final EntryPointDescr entrypoint_statement() throws RecognitionException {
+        EntryPointDescr d = null;
+
+        Token ENTRY_POINT51=null;
+        name_return id = null;
+
+
+        
+        		d = factory.createEntryPoint();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1254:2: ( ENTRY_POINT id= name )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1255:10: ENTRY_POINT id= name
+            {
+            ENTRY_POINT51=(Token)input.LT(1);
+            match(input,ENTRY_POINT,FOLLOW_ENTRY_POINT_in_entrypoint_statement3720); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(ENTRY_POINT51.getLine()), ENTRY_POINT51.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)ENTRY_POINT51).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_ENTRY_POINT );
+              		
+            }
+            pushFollow(FOLLOW_name_in_entrypoint_statement3732);
+            id=name();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setEntryId( id.name );
+              			d.setEndCharacter( ((CommonToken)((Token)id.stop)).getStopIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end entrypoint_statement
+
+
+    // $ANTLR start fact_binding
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1269:1: fact_binding returns [BaseDescr d] : ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN ) ;
+    public final BaseDescr fact_binding() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token ID52=null;
+        BaseDescr fe = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d =null;
+        		OrDescr or = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1274:3: ( ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1275:4: ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )
+            {
+            ID52=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_fact_binding3764); if (failed) return d;
+            match(input,79,FOLLOW_79_in_fact_binding3766); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+               		        // handling incomplete parsing
+               		        d = new PatternDescr( );
+               		        ((PatternDescr) d).setIdentifier( ID52.getText() );
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1281:3: (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )
+            int alt64=2;
+            int LA64_0 = input.LA(1);
+
+            if ( (LA64_0==ID) ) {
+                alt64=1;
+            }
+            else if ( (LA64_0==LEFT_PAREN) ) {
+                alt64=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1281:3: (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )", 64, 0, input);
+
+                throw nvae;
+            }
+            switch (alt64) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1281:5: fe= fact[$ID.text]
+                    {
+                    pushFollow(FOLLOW_fact_in_fact_binding3780);
+                    fe=fact(ID52.getText());
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                       		        // override previously instantiated pattern
+                       			d =fe;
+                       			if( d != null ) {
+                         			    d.setStartCharacter( ((CommonToken)ID52).getStartIndex() );
+                         			}
+                       		
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1290:4: LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_fact_binding3796); if (failed) return d;
+                    pushFollow(FOLLOW_fact_in_fact_binding3800);
+                    left=fact(ID52.getText());
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                       		        // override previously instantiated pattern
+                       			d =left;
+                       			if( d != null ) {
+                         			    d.setStartCharacter( ((CommonToken)ID52).getStartIndex() );
+                         			}
+                       		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1298:4: ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )*
+                    loop63:
+                    do {
+                        int alt63=2;
+                        int LA63_0 = input.LA(1);
+
+                        if ( ((LA63_0>=OR && LA63_0<=DOUBLE_PIPE)) ) {
+                            alt63=1;
+                        }
+
+
+                        switch (alt63) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1298:6: ( OR | DOUBLE_PIPE ) right= fact[$ID.text]
+                    	    {
+                    	    if ( (input.LA(1)>=OR && input.LA(1)<=DOUBLE_PIPE) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_fact_binding3813);    throw mse;
+                    	    }
+
+                    	    pushFollow(FOLLOW_fact_in_fact_binding3825);
+                    	    right=fact(ID52.getText());
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( or == null ) {
+                    	      					or = new OrDescr();
+                    	      					or.addDescr( left );
+                    	      					d = or;
+                    	      				}
+                    	      				or.addDescr( right );
+                    	       			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop63;
+                        }
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_fact_binding3843); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end fact_binding
+
+
+    // $ANTLR start fact
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1313:1: fact[String ident] returns [BaseDescr d] : id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )? ;
+    public final BaseDescr fact(String ident) throws RecognitionException {
+        BaseDescr d = null;
+
+        Token LEFT_PAREN53=null;
+        Token RIGHT_PAREN54=null;
+        qualified_id_return id = null;
+
+
+        
+        		d =null;
+        		PatternDescr pattern = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1318:3: (id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1319:11: id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )?
+            {
+            if ( backtracking==0 ) {
+              
+               			pattern = new PatternDescr( );
+               			if( ident != null ) {
+               				pattern.setIdentifier( ident );
+               			}
+               			d = pattern; 
+               	        
+            }
+            pushFollow(FOLLOW_qualified_id_in_fact3898);
+            id=qualified_id();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               
+               			if( id != null ) {
+              	 		        pattern.setObjectType( id.text );
+               			        pattern.setEndCharacter( -1 );
+              				pattern.setStartCharacter( ((CommonToken)((Token)id.start)).getStartIndex() );
+               			}
+               		
+            }
+            LEFT_PAREN53=(Token)input.LT(1);
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_fact3908); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START );
+                          		location.setProperty( Location.LOCATION_PROPERTY_CLASS_NAME, id.text );
+               				
+               			pattern.setLocation( offset(LEFT_PAREN53.getLine()), LEFT_PAREN53.getCharPositionInLine() );
+               			pattern.setLeftParentCharacter( ((CommonToken)LEFT_PAREN53).getStartIndex() );
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1342:4: ( constraints[pattern] )?
+            int alt65=2;
+            int LA65_0 = input.LA(1);
+
+            if ( ((LA65_0>=PACKAGE && LA65_0<=ID)||(LA65_0>=GLOBAL && LA65_0<=LEFT_PAREN)||(LA65_0>=QUERY && LA65_0<=ATTRIBUTES)||LA65_0==ENABLED||LA65_0==SALIENCE||(LA65_0>=DURATION && LA65_0<=DIALECT)||LA65_0==FROM||LA65_0==EVAL||(LA65_0>=INIT && LA65_0<=RESULT)||(LA65_0>=CONTAINS && LA65_0<=MEMBEROF)||LA65_0==IN||(LA65_0>=THEN && LA65_0<=EVENT)) ) {
+                alt65=1;
+            }
+            switch (alt65) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1342:4: constraints[pattern]
+                    {
+                    pushFollow(FOLLOW_constraints_in_fact3920);
+                    constraints(pattern);
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN54=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_fact3927); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        if( ")".equals( RIGHT_PAREN54.getText() ) ) {
+              				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              				pattern.setEndLocation( offset(RIGHT_PAREN54.getLine()), RIGHT_PAREN54.getCharPositionInLine() );	
+              				pattern.setEndCharacter( ((CommonToken)RIGHT_PAREN54).getStopIndex() );
+              		        	pattern.setRightParentCharacter( ((CommonToken)RIGHT_PAREN54).getStartIndex() );
+              		        }
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1352:4: ( EOF )?
+            int alt66=2;
+            int LA66_0 = input.LA(1);
+
+            if ( (LA66_0==EOF) ) {
+                alt66=1;
+            }
+            switch (alt66) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1352:4: EOF
+                    {
+                    match(input,EOF,FOLLOW_EOF_in_fact3936); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end fact
+
+
+    // $ANTLR start constraints
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1356:1: constraints[PatternDescr pattern] : constraint[$pattern] ( COMMA constraint[$pattern] )* ;
+    public final void constraints(PatternDescr pattern) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1357:2: ( constraint[$pattern] ( COMMA constraint[$pattern] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1357:4: constraint[$pattern] ( COMMA constraint[$pattern] )*
+            {
+            pushFollow(FOLLOW_constraint_in_constraints3954);
+            constraint(pattern);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1358:3: ( COMMA constraint[$pattern] )*
+            loop67:
+            do {
+                int alt67=2;
+                int LA67_0 = input.LA(1);
+
+                if ( (LA67_0==COMMA) ) {
+                    alt67=1;
+                }
+
+
+                switch (alt67) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1358:5: COMMA constraint[$pattern]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_constraints3961); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START ); 
+            	    }
+            	    pushFollow(FOLLOW_constraint_in_constraints3970);
+            	    constraint(pattern);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop67;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraints
+
+
+    // $ANTLR start constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1363:1: constraint[PatternDescr pattern] : or_constr[top] ;
+    public final void constraint(PatternDescr pattern) throws RecognitionException {
+        
+        		ConditionalElementDescr top = null;
+        		location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+        		location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, input.LT(1).getText() );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1369:2: ( or_constr[top] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1370:3: or_constr[top]
+            {
+            if ( backtracking==0 ) {
+              
+              			top = pattern.getConstraint();
+              		
+            }
+            pushFollow(FOLLOW_or_constr_in_constraint4003);
+            or_constr(top);
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraint
+
+
+    // $ANTLR start or_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1376:1: or_constr[ConditionalElementDescr base] : and_constr[or] ( DOUBLE_PIPE and_constr[or] )* ;
+    public final void or_constr(ConditionalElementDescr base) throws RecognitionException {
+        
+        		OrDescr or = new OrDescr();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1380:2: ( and_constr[or] ( DOUBLE_PIPE and_constr[or] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1381:3: and_constr[or] ( DOUBLE_PIPE and_constr[or] )*
+            {
+            pushFollow(FOLLOW_and_constr_in_or_constr4026);
+            and_constr(or);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1382:3: ( DOUBLE_PIPE and_constr[or] )*
+            loop68:
+            do {
+                int alt68=2;
+                int LA68_0 = input.LA(1);
+
+                if ( (LA68_0==DOUBLE_PIPE) ) {
+                    alt68=1;
+                }
+
+
+                switch (alt68) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1382:5: DOUBLE_PIPE and_constr[or]
+            	    {
+            	    match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_or_constr4034); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+            	      		
+            	    }
+            	    pushFollow(FOLLOW_and_constr_in_or_constr4043);
+            	    and_constr(or);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop68;
+                }
+            } while (true);
+
+            if ( backtracking==0 ) {
+              
+              		        if( or.getDescrs().size() == 1 ) {
+              		                base.addOrMerge( (BaseDescr) or.getDescrs().get(0) );
+              		        } else if ( or.getDescrs().size() > 1 ) {
+              		        	base.addDescr( or );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end or_constr
+
+
+    // $ANTLR start and_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1397:1: and_constr[ConditionalElementDescr base] : unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )* ;
+    public final void and_constr(ConditionalElementDescr base) throws RecognitionException {
+        
+        		AndDescr and = new AndDescr();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1401:2: ( unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1402:3: unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )*
+            {
+            pushFollow(FOLLOW_unary_constr_in_and_constr4075);
+            unary_constr(and);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1403:3: ( DOUBLE_AMPER unary_constr[and] )*
+            loop69:
+            do {
+                int alt69=2;
+                int LA69_0 = input.LA(1);
+
+                if ( (LA69_0==DOUBLE_AMPER) ) {
+                    alt69=1;
+                }
+
+
+                switch (alt69) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1403:5: DOUBLE_AMPER unary_constr[and]
+            	    {
+            	    match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_and_constr4083); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+            	      		
+            	    }
+            	    pushFollow(FOLLOW_unary_constr_in_and_constr4092);
+            	    unary_constr(and);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop69;
+                }
+            } while (true);
+
+            if ( backtracking==0 ) {
+              
+              		        if( and.getDescrs().size() == 1) {
+              		                base.addOrMerge( (BaseDescr) and.getDescrs().get(0) );
+              		        } else if( and.getDescrs().size() > 1) {
+              		        	base.addDescr( and );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end and_constr
+
+
+    // $ANTLR start unary_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1418:1: unary_constr[ConditionalElementDescr base] : ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] ) ;
+    public final void unary_constr(ConditionalElementDescr base) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1419:2: ( ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )
+            int alt70=3;
+            switch ( input.LA(1) ) {
+            case PACKAGE:
+            case IMPORT:
+            case FUNCTION:
+            case ID:
+            case GLOBAL:
+            case QUERY:
+            case END:
+            case TEMPLATE:
+            case RULE:
+            case WHEN:
+            case ATTRIBUTES:
+            case ENABLED:
+            case SALIENCE:
+            case DURATION:
+            case DIALECT:
+            case FROM:
+            case INIT:
+            case ACTION:
+            case REVERSE:
+            case RESULT:
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case IN:
+            case THEN:
+            case EVENT:
+                {
+                alt70=1;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt70=2;
+                }
+                break;
+            case EVAL:
+                {
+                alt70=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )", 70, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt70) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:5: field_constraint[$base]
+                    {
+                    pushFollow(FOLLOW_field_constraint_in_unary_constr4120);
+                    field_constraint(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1421:5: LEFT_PAREN or_constr[$base] RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_unary_constr4128); if (failed) return ;
+                    pushFollow(FOLLOW_or_constr_in_unary_constr4130);
+                    or_constr(base);
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_unary_constr4133); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1422:5: EVAL predicate[$base]
+                    {
+                    match(input,EVAL,FOLLOW_EVAL_in_unary_constr4139); if (failed) return ;
+                    pushFollow(FOLLOW_predicate_in_unary_constr4141);
+                    predicate(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end unary_constr
+
+
+    // $ANTLR start field_constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );
+    public final void field_constraint(ConditionalElementDescr base) throws RecognitionException {
+        Token ID55=null;
+        accessor_path_return f = null;
+
+
+        
+        		FieldBindingDescr fbd = null;
+        		FieldConstraintDescr fc = null;
+        		RestrictionConnectiveDescr top = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1432:2: ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) )
+            int alt72=2;
+            int LA72_0 = input.LA(1);
+
+            if ( (LA72_0==ID) ) {
+                int LA72_1 = input.LA(2);
+
+                if ( (LA72_1==79) ) {
+                    alt72=1;
+                }
+                else if ( (LA72_1==DOT||LA72_1==LEFT_PAREN||LA72_1==NOT||(LA72_1>=CONTAINS && LA72_1<=IN)||LA72_1==LEFT_SQUARE||(LA72_1>=81 && LA72_1<=86)) ) {
+                    alt72=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );", 72, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( ((LA72_0>=PACKAGE && LA72_0<=FUNCTION)||LA72_0==GLOBAL||(LA72_0>=QUERY && LA72_0<=ATTRIBUTES)||LA72_0==ENABLED||LA72_0==SALIENCE||(LA72_0>=DURATION && LA72_0<=DIALECT)||LA72_0==FROM||(LA72_0>=INIT && LA72_0<=RESULT)||(LA72_0>=CONTAINS && LA72_0<=MEMBEROF)||LA72_0==IN||(LA72_0>=THEN && LA72_0<=EVENT)) ) {
+                alt72=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );", 72, 0, input);
+
+                throw nvae;
+            }
+            switch (alt72) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1433:10: ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1433:10: ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1434:3: ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )?
+                    {
+                    ID55=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_field_constraint4180); if (failed) return ;
+                    match(input,79,FOLLOW_79_in_field_constraint4182); if (failed) return ;
+                    if ( backtracking==0 ) {
+                       
+                      			fbd = new FieldBindingDescr();
+                      			fbd.setIdentifier( ID55.getText() );
+                      			fbd.setLocation( offset(ID55.getLine()), ID55.getCharPositionInLine() );
+                      			fbd.setStartCharacter( ((CommonToken)ID55).getStartIndex() );
+                      			base.addDescr( fbd );
+                      
+                      		    
+                    }
+                    pushFollow(FOLLOW_accessor_path_in_field_constraint4201);
+                    f=accessor_path();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      		    // use ((Token)f.start) to get token matched in identifier
+                      		    // or use f.text to get text.
+                      		    if( f.text != null ) {
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, f.text);
+                      		    
+                      			if ( fbd != null ) {
+                      			    fbd.setFieldName( f.text );
+                      			    // may have been overwritten
+                      			    fbd.setStartCharacter( ((CommonToken)ID55).getStartIndex() );
+                      			} 
+                      			fc = new FieldConstraintDescr(f.text);
+                      			fc.setLocation( offset(((Token)f.start).getLine()), ((Token)f.start).getCharPositionInLine() );
+                      			fc.setStartCharacter( ((CommonToken)((Token)f.start)).getStartIndex() );
+                      			top = fc.getRestriction();
+                      			
+                      			// it must be a field constraint, as it is not a binding
+                      			if( ID55 == null ) {
+                      			    base.addDescr( fc );
+                      			}
+                      		    }
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1468:3: ( or_restr_connective[top] | '->' predicate[$base] )?
+                    int alt71=3;
+                    int LA71_0 = input.LA(1);
+
+                    if ( (LA71_0==LEFT_PAREN||LA71_0==NOT||(LA71_0>=CONTAINS && LA71_0<=IN)||(LA71_0>=81 && LA71_0<=86)) ) {
+                        alt71=1;
+                    }
+                    else if ( (LA71_0==80) ) {
+                        alt71=2;
+                    }
+                    switch (alt71) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1469:4: or_restr_connective[top]
+                            {
+                            pushFollow(FOLLOW_or_restr_connective_in_field_constraint4215);
+                            or_restr_connective(top);
+                            _fsp--;
+                            if (failed) return ;
+                            if ( backtracking==0 ) {
+                              
+                              				// we must add now as we didn't before
+                              				if( ID55 != null) {
+                              				    base.addDescr( fc );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+                        case 2 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1477:4: '->' predicate[$base]
+                            {
+                            match(input,80,FOLLOW_80_in_field_constraint4230); if (failed) return ;
+                            pushFollow(FOLLOW_predicate_in_field_constraint4232);
+                            predicate(base);
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1481:3: (f= accessor_path or_restr_connective[top] )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1481:3: (f= accessor_path or_restr_connective[top] )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1482:3: f= accessor_path or_restr_connective[top]
+                    {
+                    pushFollow(FOLLOW_accessor_path_in_field_constraint4258);
+                    f=accessor_path();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      		    // use ((Token)f.start) to get token matched in identifier
+                      		    // or use f.text to get text.
+                      		    if( f.text != null ) {
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, f.text);
+                      		    
+                      			fc = new FieldConstraintDescr(f.text);
+                      			fc.setLocation( offset(((Token)f.start).getLine()), ((Token)f.start).getCharPositionInLine() );
+                      			fc.setStartCharacter( ((CommonToken)((Token)f.start)).getStartIndex() );
+                      			top = fc.getRestriction();
+                      			
+                      			base.addDescr( fc );
+                      		    }
+                      		
+                    }
+                    pushFollow(FOLLOW_or_restr_connective_in_field_constraint4267);
+                    or_restr_connective(top);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch ( NoViableAltException nvae ) {
+            
+            	    if( input.LT(1) != null ) {
+            	                // in case of incomplete parsing, build as much as possible of the AST
+            	                // so that IDE requirements can be met
+            			fc = new FieldConstraintDescr( input.LT(1).getText() );
+            			fc.setLocation( offset(input.LT(1).getLine()), input.LT(1).getCharPositionInLine() );
+            			fc.setStartCharacter( ((CommonToken)input.LT(1)).getStartIndex() );
+            			base.addDescr( fc );
+            	    }
+            	    throw nvae;
+            	
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end field_constraint
+
+
+    // $ANTLR start or_restr_connective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1514:1: or_restr_connective[ RestrictionConnectiveDescr base ] options {backtrack=true; } : and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )* ;
+    public final void or_restr_connective(RestrictionConnectiveDescr base) throws RecognitionException {
+        
+        		RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1521:2: ( and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1522:3: and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*
+            {
+            pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective4314);
+            and_restr_connective(or);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1523:3: ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*
+            loop73:
+            do {
+                int alt73=2;
+                alt73 = dfa73.predict(input);
+                switch (alt73) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: DOUBLE_PIPE and_restr_connective[or]
+            	    {
+            	    match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_or_restr_connective4338); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+            	      			
+            	    }
+            	    pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective4349);
+            	    and_restr_connective(or);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop73;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            	        if( or.getRestrictions().size() == 1 ) {
+            	                base.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
+            	        } else if ( or.getRestrictions().size() > 1 ) {
+            	        	base.addRestriction( or );
+            	        }
+            	
+        }
+        return ;
+    }
+    // $ANTLR end or_restr_connective
+
+
+    // $ANTLR start and_restr_connective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1540:1: and_restr_connective[ RestrictionConnectiveDescr base ] : constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )* ;
+    public final void and_restr_connective(RestrictionConnectiveDescr base) throws RecognitionException {
+        Token t=null;
+
+        
+        		RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1544:2: ( constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1545:3: constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*
+            {
+            pushFollow(FOLLOW_constraint_expression_in_and_restr_connective4381);
+            constraint_expression(and);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1546:3: ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*
+            loop74:
+            do {
+                int alt74=2;
+                alt74 = dfa74.predict(input);
+                switch (alt74) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: t= DOUBLE_AMPER constraint_expression[and]
+            	    {
+            	    t=(Token)input.LT(1);
+            	    match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_and_restr_connective4401); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+            	      			
+            	    }
+            	    pushFollow(FOLLOW_constraint_expression_in_and_restr_connective4412);
+            	    constraint_expression(and);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop74;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            	        if( and.getRestrictions().size() == 1) {
+            	                base.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
+            	        } else if ( and.getRestrictions().size() > 1 ) {
+            	        	base.addRestriction( and );
+            	        }
+            	
+        }
+        return ;
+    }
+    // $ANTLR end and_restr_connective
+
+
+    // $ANTLR start constraint_expression
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1562:1: constraint_expression[RestrictionConnectiveDescr base] : ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN ) ;
+    public final void constraint_expression(RestrictionConnectiveDescr base) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1563:9: ( ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )
+            int alt75=3;
+            switch ( input.LA(1) ) {
+            case IN:
+                {
+                alt75=1;
+                }
+                break;
+            case NOT:
+                {
+                int LA75_2 = input.LA(2);
+
+                if ( (LA75_2==CONTAINS||LA75_2==MATCHES||(LA75_2>=MEMBEROF && LA75_2<=TILDE)) ) {
+                    alt75=2;
+                }
+                else if ( (LA75_2==IN) ) {
+                    alt75=1;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )", 75, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case TILDE:
+            case 81:
+            case 82:
+            case 83:
+            case 84:
+            case 85:
+            case 86:
+                {
+                alt75=2;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt75=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )", 75, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt75) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:5: compound_operator[$base]
+                    {
+                    pushFollow(FOLLOW_compound_operator_in_constraint_expression4449);
+                    compound_operator(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1565:5: simple_operator[$base]
+                    {
+                    pushFollow(FOLLOW_simple_operator_in_constraint_expression4456);
+                    simple_operator(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1566:5: LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_constraint_expression4464); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      		
+                    }
+                    pushFollow(FOLLOW_or_restr_connective_in_constraint_expression4473);
+                    or_restr_connective(base);
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_constraint_expression4478); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraint_expression
+
+
+    // $ANTLR start simple_operator
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1575:1: simple_operator[RestrictionConnectiveDescr base] : (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText] ;
+    public final void simple_operator(RestrictionConnectiveDescr base) throws RecognitionException {
+        Token t=null;
+        Token n=null;
+        square_chunk_return param = null;
+
+        RestrictionDescr rd = null;
+
+
+        
+        		String op = null;
+        		String paramText = null;
+        		boolean isNegated = false;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1581:2: ( (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText]
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )
+            int alt78=16;
+            switch ( input.LA(1) ) {
+            case 81:
+                {
+                alt78=1;
+                }
+                break;
+            case 82:
+                {
+                alt78=2;
+                }
+                break;
+            case 83:
+                {
+                alt78=3;
+                }
+                break;
+            case 84:
+                {
+                alt78=4;
+                }
+                break;
+            case 85:
+                {
+                alt78=5;
+                }
+                break;
+            case 86:
+                {
+                alt78=6;
+                }
+                break;
+            case CONTAINS:
+                {
+                alt78=7;
+                }
+                break;
+            case NOT:
+                {
+                switch ( input.LA(2) ) {
+                case MEMBEROF:
+                    {
+                    alt78=14;
+                    }
+                    break;
+                case CONTAINS:
+                    {
+                    alt78=8;
+                    }
+                    break;
+                case TILDE:
+                    {
+                    alt78=16;
+                    }
+                    break;
+                case MATCHES:
+                    {
+                    alt78=12;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )", 78, 8, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case EXCLUDES:
+                {
+                alt78=9;
+                }
+                break;
+            case MATCHES:
+                {
+                alt78=10;
+                }
+                break;
+            case SOUNDSLIKE:
+                {
+                alt78=11;
+                }
+                break;
+            case MEMBEROF:
+                {
+                alt78=13;
+                }
+                break;
+            case TILDE:
+                {
+                alt78=15;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )", 78, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt78) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:5: t= '=='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,81,FOLLOW_81_in_simple_operator4509); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1583:5: t= '>'
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,82,FOLLOW_82_in_simple_operator4517); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1584:5: t= '>='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,83,FOLLOW_83_in_simple_operator4525); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1585:5: t= '<'
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,84,FOLLOW_84_in_simple_operator4533); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1586:5: t= '<='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,85,FOLLOW_85_in_simple_operator4541); if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1587:5: t= '!='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,86,FOLLOW_86_in_simple_operator4549); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1588:25: t= CONTAINS
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,CONTAINS,FOLLOW_CONTAINS_in_simple_operator4577); if (failed) return ;
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1589:25: n= NOT t= CONTAINS
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4605); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,CONTAINS,FOLLOW_CONTAINS_in_simple_operator4609); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1590:25: t= EXCLUDES
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,EXCLUDES,FOLLOW_EXCLUDES_in_simple_operator4637); if (failed) return ;
+
+                    }
+                    break;
+                case 10 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1591:25: t= MATCHES
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,MATCHES,FOLLOW_MATCHES_in_simple_operator4665); if (failed) return ;
+
+                    }
+                    break;
+                case 11 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1592:25: t= SOUNDSLIKE
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,SOUNDSLIKE,FOLLOW_SOUNDSLIKE_in_simple_operator4693); if (failed) return ;
+
+                    }
+                    break;
+                case 12 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1593:25: n= NOT t= MATCHES
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4721); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,MATCHES,FOLLOW_MATCHES_in_simple_operator4725); if (failed) return ;
+
+                    }
+                    break;
+                case 13 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1594:25: t= MEMBEROF
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,MEMBEROF,FOLLOW_MEMBEROF_in_simple_operator4753); if (failed) return ;
+
+                    }
+                    break;
+                case 14 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1595:25: n= NOT t= MEMBEROF
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4781); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,MEMBEROF,FOLLOW_MEMBEROF_in_simple_operator4785); if (failed) return ;
+
+                    }
+                    break;
+                case 15 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:5: TILDE t= ID (param= square_chunk )?
+                    {
+                    match(input,TILDE,FOLLOW_TILDE_in_simple_operator4791); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_simple_operator4795); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:21: (param= square_chunk )?
+                    int alt76=2;
+                    int LA76_0 = input.LA(1);
+
+                    if ( (LA76_0==LEFT_SQUARE) ) {
+                        alt76=1;
+                    }
+                    switch (alt76) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:21: param= square_chunk
+                            {
+                            pushFollow(FOLLOW_square_chunk_in_simple_operator4799);
+                            param=square_chunk();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 16 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:5: n= NOT TILDE t= ID (param= square_chunk )?
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4808); if (failed) return ;
+                    match(input,TILDE,FOLLOW_TILDE_in_simple_operator4810); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_simple_operator4814); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:27: (param= square_chunk )?
+                    int alt77=2;
+                    int LA77_0 = input.LA(1);
+
+                    if ( (LA77_0==LEFT_SQUARE) ) {
+                        alt77=1;
+                    }
+                    switch (alt77) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:27: param= square_chunk
+                            {
+                            pushFollow(FOLLOW_square_chunk_in_simple_operator4818);
+                            param=square_chunk();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+                		    location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, t.getText());
+               	            op = t.getText();
+               	            isNegated = n != null;
+               	            if( param != null ) {
+                                      paramText = safeSubstring( input.toString(param.start,param.stop), 1, input.toString(param.start,param.stop).length()-1 );
+               	            } 
+              		
+            }
+            pushFollow(FOLLOW_expression_value_in_simple_operator4833);
+            rd=expression_value(base,  op,  isNegated,  paramText);
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		if ( rd == null && op != null ) {
+            		        base.addRestriction( new LiteralRestrictionDescr(op, false, null) );
+            		}
+            	
+        }
+        return ;
+    }
+    // $ANTLR end simple_operator
+
+
+    // $ANTLR start compound_operator
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1616:1: compound_operator[RestrictionConnectiveDescr base] : ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN ;
+    public final void compound_operator(RestrictionConnectiveDescr base) throws RecognitionException {
+        RestrictionDescr rd = null;
+
+
+        
+        		String op = null;
+        		RestrictionConnectiveDescr group = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1621:2: ( ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:3: ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:3: ( IN | NOT IN )
+            int alt79=2;
+            int LA79_0 = input.LA(1);
+
+            if ( (LA79_0==IN) ) {
+                alt79=1;
+            }
+            else if ( (LA79_0==NOT) ) {
+                alt79=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1622:3: ( IN | NOT IN )", 79, 0, input);
+
+                throw nvae;
+            }
+            switch (alt79) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:5: IN
+                    {
+                    match(input,IN,FOLLOW_IN_in_compound_operator4863); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			  op = "==";
+                      			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+                      			  base.addRestriction( group );
+                        		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                          	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+                      			
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1630:5: NOT IN
+                    {
+                    match(input,NOT,FOLLOW_NOT_in_compound_operator4875); if (failed) return ;
+                    match(input,IN,FOLLOW_IN_in_compound_operator4877); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			  op = "!=";
+                      			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+                      			  base.addRestriction( group );
+                        		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                          	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_compound_operator4892); if (failed) return ;
+            pushFollow(FOLLOW_expression_value_in_compound_operator4896);
+            rd=expression_value(group,  op,  false,  null);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1640:3: ( COMMA rd= expression_value[group, op, false, null] )*
+            loop80:
+            do {
+                int alt80=2;
+                int LA80_0 = input.LA(1);
+
+                if ( (LA80_0==COMMA) ) {
+                    alt80=1;
+                }
+
+
+                switch (alt80) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1640:5: COMMA rd= expression_value[group, op, false, null]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_compound_operator4903); if (failed) return ;
+            	    pushFollow(FOLLOW_expression_value_in_compound_operator4907);
+            	    rd=expression_value(group,  op,  false,  null);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop80;
+                }
+            } while (true);
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_compound_operator4916); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end compound_operator
+
+
+    // $ANTLR start expression_value
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1647:1: expression_value[RestrictionConnectiveDescr base, String op, boolean isNegated, String paramText] returns [RestrictionDescr rd] : (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk ) ;
+    public final RestrictionDescr expression_value(RestrictionConnectiveDescr base, String op, boolean isNegated, String paramText) throws RecognitionException {
+        RestrictionDescr rd = null;
+
+        accessor_path_return ap = null;
+
+        literal_constraint_return lc = null;
+
+        paren_chunk_return rvc = null;
+
+
+        
+        		rd = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1651:2: ( (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )
+            int alt81=3;
+            switch ( input.LA(1) ) {
+            case PACKAGE:
+            case IMPORT:
+            case FUNCTION:
+            case ID:
+            case GLOBAL:
+            case QUERY:
+            case END:
+            case TEMPLATE:
+            case RULE:
+            case WHEN:
+            case ATTRIBUTES:
+            case ENABLED:
+            case SALIENCE:
+            case DURATION:
+            case DIALECT:
+            case FROM:
+            case INIT:
+            case ACTION:
+            case REVERSE:
+            case RESULT:
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case IN:
+            case THEN:
+            case EVENT:
+                {
+                alt81=1;
+                }
+                break;
+            case STRING:
+            case BOOL:
+            case INT:
+            case FLOAT:
+            case NULL:
+                {
+                alt81=2;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt81=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return rd;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )", 81, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt81) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:5: ap= accessor_path
+                    {
+                    pushFollow(FOLLOW_accessor_path_in_expression_value4950);
+                    ap=accessor_path();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      			        if( ap.text.indexOf( '.' ) > -1 || ap.text.indexOf( '[' ) > -1) {
+                      					rd = new QualifiedIdentifierRestrictionDescr(op, isNegated, paramText, ap.text);
+                      				} else {
+                      					rd = new VariableRestrictionDescr(op, isNegated, paramText, ap.text);
+                      				}
+                      			
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1660:5: lc= literal_constraint
+                    {
+                    pushFollow(FOLLOW_literal_constraint_in_expression_value4970);
+                    lc=literal_constraint();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      				rd = new LiteralRestrictionDescr(op, isNegated, paramText, lc.text, lc.type );
+                      			
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1664:5: rvc= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_expression_value4984);
+                    rvc=paren_chunk();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      				rd = new ReturnValueRestrictionDescr(op, isNegated, paramText, safeSubstring( input.toString(rvc.start,rvc.stop), 1, input.toString(rvc.start,rvc.stop).length()-1) );							
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              			if( rd != null ) {
+              				base.addRestriction( rd );
+              			}
+              			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return rd;
+    }
+    // $ANTLR end expression_value
+
+    public static class literal_constraint_return extends ParserRuleReturnScope {
+        public String text;
+        public int type;
+    };
+
+    // $ANTLR start literal_constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1677:1: literal_constraint returns [String text, int type] : (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+    public final literal_constraint_return literal_constraint() throws RecognitionException {
+        literal_constraint_return retval = new literal_constraint_return();
+        retval.start = input.LT(1);
+
+        Token t=null;
+
+        
+        		retval.text = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:2: ( (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            int alt82=5;
+            switch ( input.LA(1) ) {
+            case STRING:
+                {
+                alt82=1;
+                }
+                break;
+            case INT:
+                {
+                alt82=2;
+                }
+                break;
+            case FLOAT:
+                {
+                alt82=3;
+                }
+                break;
+            case BOOL:
+                {
+                alt82=4;
+                }
+                break;
+            case NULL:
+                {
+                alt82=5;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )", 82, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt82) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:6: t= STRING
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_literal_constraint5027); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = getString( t.getText() ); retval.type = LiteralRestrictionDescr.TYPE_STRING; 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1682:5: t= INT
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,INT,FOLLOW_INT_in_literal_constraint5038); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_NUMBER; 
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1683:5: t= FLOAT
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,FLOAT,FOLLOW_FLOAT_in_literal_constraint5051); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_NUMBER; 
+                    }
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1684:5: t= BOOL
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_literal_constraint5062); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_BOOLEAN; 
+                    }
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1685:5: t= NULL
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,NULL,FOLLOW_NULL_in_literal_constraint5074); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = null; retval.type = LiteralRestrictionDescr.TYPE_NULL; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end literal_constraint
+
+
+    // $ANTLR start predicate
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1689:1: predicate[ConditionalElementDescr base] : text= paren_chunk ;
+    public final void predicate(ConditionalElementDescr base) throws RecognitionException {
+        paren_chunk_return text = null;
+
+
+        
+        		PredicateDescr d = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1693:2: (text= paren_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1694:3: text= paren_chunk
+            {
+            pushFollow(FOLLOW_paren_chunk_in_predicate5112);
+            text=paren_chunk();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		        if( input.toString(text.start,text.stop) != null ) {
+              				d = new PredicateDescr( );
+              			        d.setContent( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+              				d.setEndCharacter( ((CommonToken)((Token)text.stop)).getStopIndex() );
+              				base.addDescr( d );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end predicate
+
+    public static class curly_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start curly_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1706:1: curly_chunk : LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY ;
+    public final curly_chunk_return curly_chunk() throws RecognitionException {
+        curly_chunk_return retval = new curly_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1707:2: ( LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:3: LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY
+            {
+            match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_curly_chunk5130); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:14: (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )*
+            loop83:
+            do {
+                int alt83=3;
+                int LA83_0 = input.LA(1);
+
+                if ( ((LA83_0>=PACKAGE && LA83_0<=DECLARE)||(LA83_0>=STRING && LA83_0<=86)) ) {
+                    alt83=1;
+                }
+                else if ( (LA83_0==LEFT_CURLY) ) {
+                    alt83=2;
+                }
+
+
+                switch (alt83) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:16: ~ ( LEFT_CURLY | RIGHT_CURLY )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=DECLARE)||(input.LA(1)>=STRING && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_curly_chunk5134);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:44: curly_chunk
+            	    {
+            	    pushFollow(FOLLOW_curly_chunk_in_curly_chunk5143);
+            	    curly_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop83;
+                }
+            } while (true);
+
+            match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_curly_chunk5148); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end curly_chunk
+
+    public static class paren_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start paren_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1711:1: paren_chunk : LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN ;
+    public final paren_chunk_return paren_chunk() throws RecognitionException {
+        paren_chunk_return retval = new paren_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1712:2: ( LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:3: LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN
+            {
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_paren_chunk5162); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:14: (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )*
+            loop84:
+            do {
+                int alt84=3;
+                int LA84_0 = input.LA(1);
+
+                if ( ((LA84_0>=PACKAGE && LA84_0<=GLOBAL)||LA84_0==COMMA||(LA84_0>=DECLARE && LA84_0<=86)) ) {
+                    alt84=1;
+                }
+                else if ( (LA84_0==LEFT_PAREN) ) {
+                    alt84=2;
+                }
+
+
+                switch (alt84) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:16: ~ ( LEFT_PAREN | RIGHT_PAREN )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=GLOBAL)||input.LA(1)==COMMA||(input.LA(1)>=DECLARE && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_paren_chunk5166);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:44: paren_chunk
+            	    {
+            	    pushFollow(FOLLOW_paren_chunk_in_paren_chunk5175);
+            	    paren_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop84;
+                }
+            } while (true);
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_paren_chunk5180); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end paren_chunk
+
+    public static class square_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start square_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1716:1: square_chunk : LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE ;
+    public final square_chunk_return square_chunk() throws RecognitionException {
+        square_chunk_return retval = new square_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1717:2: ( LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:3: LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE
+            {
+            match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_square_chunk5193); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:15: (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )*
+            loop85:
+            do {
+                int alt85=3;
+                int LA85_0 = input.LA(1);
+
+                if ( ((LA85_0>=PACKAGE && LA85_0<=NULL)||(LA85_0>=THEN && LA85_0<=86)) ) {
+                    alt85=1;
+                }
+                else if ( (LA85_0==LEFT_SQUARE) ) {
+                    alt85=2;
+                }
+
+
+                switch (alt85) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:17: ~ ( LEFT_SQUARE | RIGHT_SQUARE )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=NULL)||(input.LA(1)>=THEN && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_square_chunk5197);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:47: square_chunk
+            	    {
+            	    pushFollow(FOLLOW_square_chunk_in_square_chunk5206);
+            	    square_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop85;
+                }
+            } while (true);
+
+            match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_square_chunk5211); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end square_chunk
+
+    public static class qualified_id_return extends ParserRuleReturnScope {
+        public String text;
+    };
+
+    // $ANTLR start qualified_id
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1721:1: qualified_id returns [ String text ] : ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* ;
+    public final qualified_id_return qualified_id() throws RecognitionException {
+        qualified_id_return retval = new qualified_id_return();
+        retval.start = input.LT(1);
+
+        Token ID56=null;
+        identifier_return identifier57 = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:2: ( ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:5: ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )*
+            {
+            ID56=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_qualified_id5240); if (failed) return retval;
+            if ( backtracking==0 ) {
+              buf.append(ID56.getText());
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:32: ( DOT identifier )*
+            loop86:
+            do {
+                int alt86=2;
+                int LA86_0 = input.LA(1);
+
+                if ( (LA86_0==DOT) ) {
+                    alt86=1;
+                }
+
+
+                switch (alt86) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:34: DOT identifier
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_qualified_id5246); if (failed) return retval;
+            	    pushFollow(FOLLOW_identifier_in_qualified_id5248);
+            	    identifier57=identifier();
+            	    _fsp--;
+            	    if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+input.toString(identifier57.start,identifier57.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop86;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:88: ( LEFT_SQUARE RIGHT_SQUARE )*
+            loop87:
+            do {
+                int alt87=2;
+                int LA87_0 = input.LA(1);
+
+                if ( (LA87_0==LEFT_SQUARE) ) {
+                    alt87=1;
+                }
+
+
+                switch (alt87) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:90: LEFT_SQUARE RIGHT_SQUARE
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_qualified_id5257); if (failed) return retval;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_qualified_id5259); if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("[]");
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop87;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+            if ( backtracking==0 ) {
+              
+              	        retval.text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end qualified_id
+
+
+    // $ANTLR start dotted_name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1731:1: dotted_name returns [ String text ] : i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* ;
+    public final String dotted_name() throws RecognitionException {
+        String text = null;
+
+        identifier_return i = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:2: (i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:4: i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )*
+            {
+            pushFollow(FOLLOW_identifier_in_dotted_name5293);
+            i=identifier();
+            _fsp--;
+            if (failed) return text;
+            if ( backtracking==0 ) {
+              buf.append(input.toString(i.start,i.stop));
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:40: ( DOT i= identifier )*
+            loop88:
+            do {
+                int alt88=2;
+                int LA88_0 = input.LA(1);
+
+                if ( (LA88_0==DOT) ) {
+                    alt88=1;
+                }
+
+
+                switch (alt88) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:42: DOT i= identifier
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_dotted_name5299); if (failed) return text;
+            	    pushFollow(FOLLOW_identifier_in_dotted_name5303);
+            	    i=identifier();
+            	    _fsp--;
+            	    if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+input.toString(i.start,i.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop88;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:89: ( LEFT_SQUARE RIGHT_SQUARE )*
+            loop89:
+            do {
+                int alt89=2;
+                int LA89_0 = input.LA(1);
+
+                if ( (LA89_0==LEFT_SQUARE) ) {
+                    alt89=1;
+                }
+
+
+                switch (alt89) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:91: LEFT_SQUARE RIGHT_SQUARE
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_dotted_name5312); if (failed) return text;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_dotted_name5314); if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append("[]");
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop89;
+                }
+            } while (true);
+
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              	        text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return text;
+    }
+    // $ANTLR end dotted_name
+
+    public static class accessor_path_return extends ParserRuleReturnScope {
+        public String text;
+    };
+
+    // $ANTLR start accessor_path
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1741:1: accessor_path returns [ String text ] : a= accessor_element ( DOT a= accessor_element )* ;
+    public final accessor_path_return accessor_path() throws RecognitionException {
+        accessor_path_return retval = new accessor_path_return();
+        retval.start = input.LT(1);
+
+        String a = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:2: (a= accessor_element ( DOT a= accessor_element )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:4: a= accessor_element ( DOT a= accessor_element )*
+            {
+            pushFollow(FOLLOW_accessor_element_in_accessor_path5348);
+            a=accessor_element();
+            _fsp--;
+            if (failed) return retval;
+            if ( backtracking==0 ) {
+              buf.append(a);
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:46: ( DOT a= accessor_element )*
+            loop90:
+            do {
+                int alt90=2;
+                int LA90_0 = input.LA(1);
+
+                if ( (LA90_0==DOT) ) {
+                    alt90=1;
+                }
+
+
+                switch (alt90) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:48: DOT a= accessor_element
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_accessor_path5354); if (failed) return retval;
+            	    pushFollow(FOLLOW_accessor_element_in_accessor_path5358);
+            	    a=accessor_element();
+            	    _fsp--;
+            	    if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+a);
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop90;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+            if ( backtracking==0 ) {
+              
+              	        retval.text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end accessor_path
+
+
+    // $ANTLR start accessor_element
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1751:1: accessor_element returns [ String text ] : i= identifier (s= square_chunk )* ;
+    public final String accessor_element() throws RecognitionException {
+        String text = null;
+
+        identifier_return i = null;
+
+        square_chunk_return s = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1758:2: (i= identifier (s= square_chunk )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:3: i= identifier (s= square_chunk )*
+            {
+            pushFollow(FOLLOW_identifier_in_accessor_element5396);
+            i=identifier();
+            _fsp--;
+            if (failed) return text;
+            if ( backtracking==0 ) {
+              buf.append(input.toString(i.start,i.stop));
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:39: (s= square_chunk )*
+            loop91:
+            do {
+                int alt91=2;
+                int LA91_0 = input.LA(1);
+
+                if ( (LA91_0==LEFT_SQUARE) ) {
+                    alt91=1;
+                }
+
+
+                switch (alt91) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:40: s= square_chunk
+            	    {
+            	    pushFollow(FOLLOW_square_chunk_in_accessor_element5403);
+            	    s=square_chunk();
+            	    _fsp--;
+            	    if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append(input.toString(s.start,s.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop91;
+                }
+            } while (true);
+
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              	        text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return text;
+    }
+    // $ANTLR end accessor_element
+
+
+    // $ANTLR start rhs_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1762:1: rhs_chunk[RuleDescr rule] : THEN (~ END )* loc= END opt_semicolon ;
+    public final void rhs_chunk(RuleDescr rule) throws RecognitionException {
+        Token loc=null;
+        Token THEN58=null;
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1763:2: ( THEN (~ END )* loc= END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1764:3: THEN (~ END )* loc= END opt_semicolon
+            {
+            THEN58=(Token)input.LT(1);
+            match(input,THEN,FOLLOW_THEN_in_rhs_chunk5424); if (failed) return ;
+            if ( backtracking==0 ) {
+               location.setType( Location.LOCATION_RHS ); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1765:3: (~ END )*
+            loop92:
+            do {
+                int alt92=2;
+                int LA92_0 = input.LA(1);
+
+                if ( ((LA92_0>=PACKAGE && LA92_0<=QUERY)||(LA92_0>=TEMPLATE && LA92_0<=86)) ) {
+                    alt92=1;
+                }
+
+
+                switch (alt92) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1765:5: ~ END
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=QUERY)||(input.LA(1)>=TEMPLATE && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_rhs_chunk5432);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop92;
+                }
+            } while (true);
+
+            loc=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_rhs_chunk5456); if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_rhs_chunk5458);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+                                  // ignoring first line in the consequence
+                                  String buf = input.toString( THEN58, loc );
+                                  // removing final END keyword
+                                  int idx=4;
+                                  while( idx < buf.length()-3 && (buf.charAt(idx) == ' ' || buf.charAt(idx) == '\t') ) {
+                                      idx++;
+                                  }
+                                  if( idx < buf.length()-3 && buf.charAt(idx) == '\r' ) idx++;
+                                  if( idx < buf.length()-3 && buf.charAt(idx) == '\n' ) idx++;
+                                  buf = safeSubstring( buf, idx, buf.length()-3 );
+              		    rule.setConsequence( buf );
+                   		    rule.setConsequenceLocation(offset(THEN58.getLine()), THEN58.getCharPositionInLine());
+               		    rule.setEndCharacter( ((CommonToken)loc).getStopIndex() );
+               		    location.setProperty( Location.LOCATION_RHS_CONTENT, rule.getConsequence() );
+                              
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end rhs_chunk
+
+    public static class name_return extends ParserRuleReturnScope {
+        public String name;
+    };
+
+    // $ANTLR start name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1785:1: name returns [String name] : ( ID | STRING );
+    public final name_return name() throws RecognitionException {
+        name_return retval = new name_return();
+        retval.start = input.LT(1);
+
+        Token ID59=null;
+        Token STRING60=null;
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1786:2: ( ID | STRING )
+            int alt93=2;
+            int LA93_0 = input.LA(1);
+
+            if ( (LA93_0==ID) ) {
+                alt93=1;
+            }
+            else if ( (LA93_0==STRING) ) {
+                alt93=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1785:1: name returns [String name] : ( ID | STRING );", 93, 0, input);
+
+                throw nvae;
+            }
+            switch (alt93) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1786:5: ID
+                    {
+                    ID59=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_name5492); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.name = ID59.getText(); 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1787:5: STRING
+                    {
+                    STRING60=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_name5500); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.name = getString( STRING60.getText() ); 
+                    }
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end name
+
+    public static class identifier_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start identifier
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1790:1: identifier : ( ID | PACKAGE | FUNCTION | GLOBAL | IMPORT | EVENT | RULE | QUERY | TEMPLATE | ATTRIBUTES | ENABLED | SALIENCE | DURATION | DIALECT | FROM | INIT | ACTION | REVERSE | RESULT | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | WHEN | THEN | END | IN );
+    public final identifier_return identifier() throws RecognitionException {
+        identifier_return retval = new identifier_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1791:2: ( ID | PACKAGE | FUNCTION | GLOBAL | IMPORT | EVENT | RULE | QUERY | TEMPLATE | ATTRIBUTES | ENABLED | SALIENCE | DURATION | DIALECT | FROM | INIT | ACTION | REVERSE | RESULT | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | WHEN | THEN | END | IN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            {
+            if ( (input.LA(1)>=PACKAGE && input.LA(1)<=ID)||input.LA(1)==GLOBAL||(input.LA(1)>=QUERY && input.LA(1)<=ATTRIBUTES)||input.LA(1)==ENABLED||input.LA(1)==SALIENCE||(input.LA(1)>=DURATION && input.LA(1)<=DIALECT)||input.LA(1)==FROM||(input.LA(1)>=INIT && input.LA(1)<=RESULT)||(input.LA(1)>=CONTAINS && input.LA(1)<=MEMBEROF)||input.LA(1)==IN||(input.LA(1)>=THEN && input.LA(1)<=EVENT) ) {
+                input.consume();
+                errorRecovery=false;failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_identifier0);    throw mse;
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end identifier
+
+    // $ANTLR start synpred1
+    public final void synpred1_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:6: ( EXISTS )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:8: EXISTS
+        {
+        match(input,EXISTS,FOLLOW_EXISTS_in_synpred12216); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred1
+
+    // $ANTLR start synpred2
+    public final void synpred2_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:5: ( NOT )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:7: NOT
+        {
+        match(input,NOT,FOLLOW_NOT_in_synpred22234); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred2
+
+    // $ANTLR start synpred3
+    public final void synpred3_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:5: ( EVAL )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:7: EVAL
+        {
+        match(input,EVAL,FOLLOW_EVAL_in_synpred32253); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred3
+
+    // $ANTLR start synpred4
+    public final void synpred4_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:5: ( FORALL )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:7: FORALL
+        {
+        match(input,FORALL,FOLLOW_FORALL_in_synpred42272); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred4
+
+    // $ANTLR start synpred5
+    public final void synpred5_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:5: ( LEFT_PAREN )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:7: LEFT_PAREN
+        {
+        match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_synpred52291); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred5
+
+    // $ANTLR start synpred6
+    public final void synpred6_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:13: ( FROM ENTRY_POINT )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:14: FROM ENTRY_POINT
+        {
+        match(input,FROM,FOLLOW_FROM_in_synpred62397); if (failed) return ;
+        match(input,ENTRY_POINT,FOLLOW_ENTRY_POINT_in_synpred62399); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred6
+
+    // $ANTLR start synpred10
+    public final void synpred10_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:6: ( LEFT_SQUARE )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:8: LEFT_SQUARE
+        {
+        match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_synpred103560); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred10
+
+    // $ANTLR start synpred11
+    public final void synpred11_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:6: ( LEFT_PAREN )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:8: LEFT_PAREN
+        {
+        match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_synpred113593); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred11
+
+    // $ANTLR start synpred12
+    public final void synpred12_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: ( DOUBLE_PIPE and_restr_connective[or] )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: DOUBLE_PIPE and_restr_connective[or]
+        {
+        match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_synpred124338); if (failed) return ;
+        pushFollow(FOLLOW_and_restr_connective_in_synpred124349);
+        and_restr_connective(or);
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred12
+
+    // $ANTLR start synpred13
+    public final void synpred13_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: ( DOUBLE_AMPER constraint_expression[and] )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: DOUBLE_AMPER constraint_expression[and]
+        {
+        match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_synpred134401); if (failed) return ;
+        pushFollow(FOLLOW_constraint_expression_in_synpred134412);
+        constraint_expression(and);
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred13
+
+    public final boolean synpred5() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred5_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred6() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred6_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred10() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred10_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred1() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred1_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred11() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred11_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred2() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred2_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred12() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred12_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred3() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred3_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred13() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred13_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred4() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred4_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+
+
+    protected DFA8 dfa8 = new DFA8(this);
+    protected DFA9 dfa9 = new DFA9(this);
+    protected DFA19 dfa19 = new DFA19(this);
+    protected DFA61 dfa61 = new DFA61(this);
+    protected DFA73 dfa73 = new DFA73(this);
+    protected DFA74 dfa74 = new DFA74(this);
+    static final String DFA8_eotS =
+        "\6\uffff";
+    static final String DFA8_eofS =
+        "\6\uffff";
+    static final String DFA8_minS =
+        "\2\4\1\100\2\uffff\1\4";
+    static final String DFA8_maxS =
+        "\2\102\1\100\2\uffff\1\102";
+    static final String DFA8_acceptS =
+        "\3\uffff\1\2\1\1\1\uffff";
+    static final String DFA8_specialS =
+        "\6\uffff}>";
+    static final String[] DFA8_transitionS = {
+            "\4\1\1\uffff\1\1\7\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6\uffff"+
+            "\2\1\5\uffff\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\1\1\4\uffff"+
+            "\2\1",
+            "\6\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff\1\4\6\uffff"+
+            "\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff\1\4\2\uffff"+
+            "\1\2\1\uffff\2\4",
+            "\1\5",
+            "",
+            "",
+            "\4\4\1\uffff\1\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff"+
+            "\1\4\6\uffff\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff"+
+            "\1\4\2\uffff\1\2\1\uffff\2\4"
+    };
+
+    static final short[] DFA8_eot = DFA.unpackEncodedString(DFA8_eotS);
+    static final short[] DFA8_eof = DFA.unpackEncodedString(DFA8_eofS);
+    static final char[] DFA8_min = DFA.unpackEncodedStringToUnsignedChars(DFA8_minS);
+    static final char[] DFA8_max = DFA.unpackEncodedStringToUnsignedChars(DFA8_maxS);
+    static final short[] DFA8_accept = DFA.unpackEncodedString(DFA8_acceptS);
+    static final short[] DFA8_special = DFA.unpackEncodedString(DFA8_specialS);
+    static final short[][] DFA8_transition;
+
+    static {
+        int numStates = DFA8_transitionS.length;
+        DFA8_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA8_transition[i] = DFA.unpackEncodedString(DFA8_transitionS[i]);
+        }
+    }
+
+    class DFA8 extends DFA {
+
+        public DFA8(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 8;
+            this.eot = DFA8_eot;
+            this.eof = DFA8_eof;
+            this.min = DFA8_min;
+            this.max = DFA8_max;
+            this.accept = DFA8_accept;
+            this.special = DFA8_special;
+            this.transition = DFA8_transition;
+        }
+        public String getDescription() {
+            return "345:15: (paramType= dotted_name )?";
+        }
+    }
+    static final String DFA9_eotS =
+        "\6\uffff";
+    static final String DFA9_eofS =
+        "\6\uffff";
+    static final String DFA9_minS =
+        "\2\4\1\100\2\uffff\1\4";
+    static final String DFA9_maxS =
+        "\2\102\1\100\2\uffff\1\102";
+    static final String DFA9_acceptS =
+        "\3\uffff\1\2\1\1\1\uffff";
+    static final String DFA9_specialS =
+        "\6\uffff}>";
+    static final String[] DFA9_transitionS = {
+            "\4\1\1\uffff\1\1\7\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6\uffff"+
+            "\2\1\5\uffff\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\1\1\4\uffff"+
+            "\2\1",
+            "\6\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff\1\4\6\uffff"+
+            "\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff\1\4\2\uffff"+
+            "\1\2\1\uffff\2\4",
+            "\1\5",
+            "",
+            "",
+            "\4\4\1\uffff\1\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff"+
+            "\1\4\6\uffff\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff"+
+            "\1\4\2\uffff\1\2\1\uffff\2\4"
+    };
+
+    static final short[] DFA9_eot = DFA.unpackEncodedString(DFA9_eotS);
+    static final short[] DFA9_eof = DFA.unpackEncodedString(DFA9_eofS);
+    static final char[] DFA9_min = DFA.unpackEncodedStringToUnsignedChars(DFA9_minS);
+    static final char[] DFA9_max = DFA.unpackEncodedStringToUnsignedChars(DFA9_maxS);
+    static final short[] DFA9_accept = DFA.unpackEncodedString(DFA9_acceptS);
+    static final short[] DFA9_special = DFA.unpackEncodedString(DFA9_specialS);
+    static final short[][] DFA9_transition;
+
+    static {
+        int numStates = DFA9_transitionS.length;
+        DFA9_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA9_transition[i] = DFA.unpackEncodedString(DFA9_transitionS[i]);
+        }
+    }
+
+    class DFA9 extends DFA {
+
+        public DFA9(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 9;
+            this.eot = DFA9_eot;
+            this.eof = DFA9_eof;
+            this.min = DFA9_min;
+            this.max = DFA9_max;
+            this.accept = DFA9_accept;
+            this.special = DFA9_special;
+            this.transition = DFA9_transition;
+        }
+        public String getDescription() {
+            return "350:22: (paramType= dotted_name )?";
+        }
+    }
+    static final String DFA19_eotS =
+        "\11\uffff";
+    static final String DFA19_eofS =
+        "\11\uffff";
+    static final String DFA19_minS =
+        "\2\7\1\uffff\1\7\1\uffff\1\4\1\100\2\7";
+    static final String DFA19_maxS =
+        "\2\55\1\uffff\1\117\1\uffff\1\102\1\100\2\77";
+    static final String DFA19_acceptS =
+        "\2\uffff\1\2\1\uffff\1\1\4\uffff";
+    static final String DFA19_specialS =
+        "\11\uffff}>";
+    static final String[] DFA19_transitionS = {
+            "\1\2\2\uffff\1\1\7\uffff\1\2\27\uffff\4\2",
+            "\1\3\2\uffff\1\2\1\uffff\1\4\30\uffff\1\2\1\uffff\1\2\2\uffff"+
+            "\4\2",
+            "",
+            "\1\4\1\5\1\uffff\1\2\2\4\62\uffff\1\6\17\uffff\1\2",
+            "",
+            "\4\7\1\uffff\1\7\7\uffff\6\7\2\uffff\1\7\1\uffff\1\7\6\uffff"+
+            "\2\7\5\uffff\1\7\5\uffff\4\7\3\uffff\5\7\1\uffff\1\7\4\uffff"+
+            "\2\7",
+            "\1\10",
+            "\1\4\1\5\1\uffff\1\2\64\uffff\1\6",
+            "\1\4\2\uffff\1\2\64\uffff\1\6"
+    };
+
+    static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
+    static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
+    static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
+    static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
+    static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
+    static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
+    static final short[][] DFA19_transition;
+
+    static {
+        int numStates = DFA19_transitionS.length;
+        DFA19_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
+        }
+    }
+
+    class DFA19 extends DFA {
+
+        public DFA19(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 19;
+            this.eot = DFA19_eot;
+            this.eof = DFA19_eof;
+            this.min = DFA19_min;
+            this.max = DFA19_max;
+            this.accept = DFA19_accept;
+            this.special = DFA19_special;
+            this.transition = DFA19_transition;
+        }
+        public String getDescription() {
+            return "418:3: ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )?";
+        }
+    }
+    static final String DFA61_eotS =
+        "\150\uffff";
+    static final String DFA61_eofS =
+        "\150\uffff";
+    static final String DFA61_minS =
+        "\1\7\1\uffff\1\4\1\uffff\3\4\1\0\1\uffff\4\4\1\uffff\1\4\1\0\5\4"+
+        "\1\0\5\4\2\0\1\4\2\0\3\4\1\0\1\4\1\0\1\4\3\0\2\4\1\0\2\4\2\0\1\4"+
+        "\2\0\2\4\1\0\4\4\1\0\2\4\1\0\2\4\1\0\1\4\1\uffff\44\0";
+    static final String DFA61_maxS =
+        "\1\115\1\uffff\1\126\1\uffff\3\126\1\0\1\uffff\4\126\1\uffff\1\126"+
+        "\1\0\5\126\1\0\5\126\2\0\1\126\2\0\3\126\1\0\1\126\1\0\1\126\3\0"+
+        "\2\126\1\0\2\126\2\0\1\126\2\0\2\126\1\0\4\126\1\0\2\126\1\0\2\126"+
+        "\1\0\1\126\1\uffff\44\0";
+    static final String DFA61_acceptS =
+        "\1\uffff\1\1\1\uffff\1\3\4\uffff\1\2\4\uffff\1\2\65\uffff\1\2\44"+
+        "\uffff";
+    static final String DFA61_specialS =
+        "\1\4\1\uffff\1\5\1\uffff\1\66\1\40\1\11\1\10\1\uffff\1\0\1\42\1"+
+        "\22\1\16\1\uffff\1\71\1\56\1\2\1\57\1\54\1\63\1\72\1\37\1\3\1\13"+
+        "\1\67\1\75\1\15\1\60\1\55\1\14\1\30\1\27\1\23\1\46\1\17\1\41\1\62"+
+        "\1\12\1\61\1\26\1\35\1\34\1\70\1\52\1\33\1\53\1\74\1\31\1\7\1\76"+
+        "\1\36\1\1\1\73\1\32\1\6\1\64\1\24\1\47\1\20\1\43\1\25\1\50\1\44"+
+        "\1\21\1\45\1\65\1\51\45\uffff}>";
+    static final String[] DFA61_transitionS = {
+            "\2\3\1\uffff\1\2\2\3\5\uffff\1\3\11\uffff\1\3\10\uffff\4\3\1"+
+            "\uffff\4\3\1\uffff\1\3\17\uffff\1\1\1\uffff\1\3\13\uffff\1\3",
+            "",
+            "\3\15\1\14\2\15\1\7\1\15\1\10\30\15\1\5\1\15\1\4\2\15\1\6\1"+
+            "\11\1\12\1\13\51\15",
+            "",
+            "\3\15\1\23\2\15\1\17\1\15\1\10\35\15\1\16\1\20\1\21\1\22\51"+
+            "\15",
+            "\3\15\1\31\2\15\1\25\1\15\1\10\35\15\1\24\1\26\1\27\1\30\51"+
+            "\15",
+            "\3\15\1\32\2\15\1\33\1\15\1\10\112\15",
+            "\1\uffff",
+            "",
+            "\3\15\1\35\2\15\1\34\1\15\1\10\112\15",
+            "\6\15\1\36\1\15\1\10\112\15",
+            "\6\15\1\37\1\15\1\10\112\15",
+            "\4\15\1\41\1\15\1\43\1\15\1\10\62\15\1\42\17\15\1\40\7\15",
+            "",
+            "\3\15\1\44\2\15\1\45\1\15\1\10\112\15",
+            "\1\uffff",
+            "\3\15\1\46\2\15\1\47\1\15\1\10\112\15",
+            "\6\15\1\50\1\15\1\10\112\15",
+            "\6\15\1\51\1\15\1\10\112\15",
+            "\4\15\1\53\1\15\1\54\1\15\1\10\62\15\1\55\17\15\1\52\7\15",
+            "\3\15\1\56\2\15\1\57\1\15\1\10\112\15",
+            "\1\uffff",
+            "\3\15\1\61\2\15\1\60\1\15\1\10\112\15",
+            "\6\15\1\62\1\15\1\10\112\15",
+            "\6\15\1\63\1\15\1\10\112\15",
+            "\4\15\1\65\1\15\1\66\1\15\1\10\62\15\1\67\17\15\1\64\7\15",
+            "\4\15\1\71\1\15\1\73\1\15\1\10\62\15\1\72\17\15\1\70\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\4\15\1\75\1\15\1\76\1\15\1\10\62\15\1\77\17\15\1\74\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\100\2\15\1\101\1\15\1\10\112\15",
+            "\4\102\1\15\1\102\1\103\1\15\1\10\4\15\6\102\2\15\1\102\1\15"+
+            "\1\102\6\15\2\102\5\15\1\102\5\15\4\102\3\15\5\102\1\15\1\102"+
+            "\4\15\2\102\24\15",
+            "\6\15\1\103\1\15\1\10\63\15\1\104\26\15",
+            "\1\uffff",
+            "\4\15\1\106\1\15\1\107\1\15\1\10\62\15\1\110\17\15\1\105\7\15",
+            "\1\uffff",
+            "\4\15\1\112\1\15\1\114\1\15\1\10\62\15\1\113\17\15\1\111\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\115\2\15\1\116\1\15\1\10\112\15",
+            "\4\117\1\15\1\117\1\103\1\15\1\10\4\15\6\117\2\15\1\117\1\15"+
+            "\1\117\6\15\2\117\5\15\1\117\5\15\4\117\3\15\5\117\1\15\1\117"+
+            "\4\15\2\117\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\120\26\15",
+            "\4\15\1\122\1\15\1\123\1\15\1\10\62\15\1\124\17\15\1\121\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\4\15\1\126\1\15\1\130\1\15\1\10\62\15\1\127\17\15\1\125\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\131\2\15\1\132\1\15\1\10\112\15",
+            "\4\133\1\15\1\133\1\103\1\15\1\10\4\15\6\133\2\15\1\133\1\15"+
+            "\1\133\6\15\2\133\5\15\1\133\5\15\4\133\3\15\5\133\1\15\1\133"+
+            "\4\15\2\133\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\134\26\15",
+            "\3\15\1\135\2\15\1\136\1\15\1\10\112\15",
+            "\4\137\1\15\1\137\1\103\1\15\1\10\4\15\6\137\2\15\1\137\1\15"+
+            "\1\137\6\15\2\137\5\15\1\137\5\15\4\137\3\15\5\137\1\15\1\137"+
+            "\4\15\2\137\24\15",
+            "\6\15\1\103\1\15\1\10\63\15\1\140\26\15",
+            "\1\uffff",
+            "\3\15\1\141\2\15\1\142\1\15\1\10\112\15",
+            "\4\143\1\15\1\143\1\103\1\15\1\10\4\15\6\143\2\15\1\143\1\15"+
+            "\1\143\6\15\2\143\5\15\1\143\5\15\4\143\3\15\5\143\1\15\1\143"+
+            "\4\15\2\143\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\144\26\15",
+            "\4\15\1\145\1\15\1\146\1\15\1\10\62\15\1\147\27\15",
+            "\1\uffff",
+            "\4\15\1\41\1\15\1\43\1\15\1\10\62\15\1\42\27\15",
+            "",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA61_eot = DFA.unpackEncodedString(DFA61_eotS);
+    static final short[] DFA61_eof = DFA.unpackEncodedString(DFA61_eofS);
+    static final char[] DFA61_min = DFA.unpackEncodedStringToUnsignedChars(DFA61_minS);
+    static final char[] DFA61_max = DFA.unpackEncodedStringToUnsignedChars(DFA61_maxS);
+    static final short[] DFA61_accept = DFA.unpackEncodedString(DFA61_acceptS);
+    static final short[] DFA61_special = DFA.unpackEncodedString(DFA61_specialS);
+    static final short[][] DFA61_transition;
+
+    static {
+        int numStates = DFA61_transitionS.length;
+        DFA61_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA61_transition[i] = DFA.unpackEncodedString(DFA61_transitionS[i]);
+        }
+    }
+
+    class DFA61 extends DFA {
+
+        public DFA61(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 61;
+            this.eot = DFA61_eot;
+            this.eof = DFA61_eof;
+            this.min = DFA61_min;
+            this.max = DFA61_max;
+            this.accept = DFA61_accept;
+            this.special = DFA61_special;
+            this.transition = DFA61_transition;
+        }
+        public String getDescription() {
+            return "1202:4: ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )?";
+        }
+        public int specialStateTransition(int s, IntStream input) throws NoViableAltException {
+        	int _s = s;
+            switch ( s ) {
+                    case 0 : 
+                        int LA61_9 = input.LA(1);
+
+                         
+                        int index61_9 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_9==LEFT_PAREN) ) {s = 28;}
+
+                        else if ( (LA61_9==ID) ) {s = 29;}
+
+                        else if ( (LA61_9==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_9>=PACKAGE && LA61_9<=FUNCTION)||(LA61_9>=DOT && LA61_9<=GLOBAL)||LA61_9==COMMA||(LA61_9>=DECLARE && LA61_9<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_9);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 1 : 
+                        int LA61_51 = input.LA(1);
+
+                         
+                        int index61_51 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_51);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 2 : 
+                        int LA61_16 = input.LA(1);
+
+                         
+                        int index61_16 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_16==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_16==ID) ) {s = 38;}
+
+                        else if ( (LA61_16==LEFT_PAREN) ) {s = 39;}
+
+                        else if ( ((LA61_16>=PACKAGE && LA61_16<=FUNCTION)||(LA61_16>=DOT && LA61_16<=GLOBAL)||LA61_16==COMMA||(LA61_16>=DECLARE && LA61_16<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_16);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 3 : 
+                        int LA61_22 = input.LA(1);
+
+                         
+                        int index61_22 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_22==LEFT_PAREN) ) {s = 48;}
+
+                        else if ( (LA61_22==ID) ) {s = 49;}
+
+                        else if ( (LA61_22==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_22>=PACKAGE && LA61_22<=FUNCTION)||(LA61_22>=DOT && LA61_22<=GLOBAL)||LA61_22==COMMA||(LA61_22>=DECLARE && LA61_22<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_22);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 4 : 
+                        int LA61_0 = input.LA(1);
+
+                         
+                        int index61_0 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_0==LEFT_SQUARE) && (synpred10())) {s = 1;}
+
+                        else if ( (LA61_0==LEFT_PAREN) ) {s = 2;}
+
+                        else if ( ((LA61_0>=ID && LA61_0<=DOT)||(LA61_0>=COMMA && LA61_0<=RIGHT_PAREN)||LA61_0==END||LA61_0==INT||(LA61_0>=OR && LA61_0<=DOUBLE_AMPER)||(LA61_0>=EXISTS && LA61_0<=FORALL)||LA61_0==INIT||LA61_0==THEN||LA61_0==77) ) {s = 3;}
+
+                         
+                        input.seek(index61_0);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 5 : 
+                        int LA61_2 = input.LA(1);
+
+                         
+                        int index61_2 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_2==AND) ) {s = 4;}
+
+                        else if ( (LA61_2==OR) ) {s = 5;}
+
+                        else if ( (LA61_2==EXISTS) ) {s = 6;}
+
+                        else if ( (LA61_2==LEFT_PAREN) ) {s = 7;}
+
+                        else if ( (LA61_2==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_2==NOT) ) {s = 9;}
+
+                        else if ( (LA61_2==EVAL) ) {s = 10;}
+
+                        else if ( (LA61_2==FORALL) ) {s = 11;}
+
+                        else if ( (LA61_2==ID) ) {s = 12;}
+
+                        else if ( ((LA61_2>=PACKAGE && LA61_2<=FUNCTION)||(LA61_2>=DOT && LA61_2<=GLOBAL)||LA61_2==COMMA||(LA61_2>=DECLARE && LA61_2<=LOCK_ON_ACTIVE)||LA61_2==DOUBLE_PIPE||(LA61_2>=DOUBLE_AMPER && LA61_2<=FROM)||(LA61_2>=ACCUMULATE && LA61_2<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_2);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 6 : 
+                        int LA61_54 = input.LA(1);
+
+                         
+                        int index61_54 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_54);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 7 : 
+                        int LA61_48 = input.LA(1);
+
+                         
+                        int index61_48 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_48);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 8 : 
+                        int LA61_7 = input.LA(1);
+
+                         
+                        int index61_7 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_7);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 9 : 
+                        int LA61_6 = input.LA(1);
+
+                         
+                        int index61_6 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_6==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_6==ID) ) {s = 26;}
+
+                        else if ( (LA61_6==LEFT_PAREN) ) {s = 27;}
+
+                        else if ( ((LA61_6>=PACKAGE && LA61_6<=FUNCTION)||(LA61_6>=DOT && LA61_6<=GLOBAL)||LA61_6==COMMA||(LA61_6>=DECLARE && LA61_6<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_6);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 10 : 
+                        int LA61_37 = input.LA(1);
+
+                         
+                        int index61_37 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_37);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 11 : 
+                        int LA61_23 = input.LA(1);
+
+                         
+                        int index61_23 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_23==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_23>=PACKAGE && LA61_23<=GLOBAL)||LA61_23==COMMA||(LA61_23>=DECLARE && LA61_23<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_23==LEFT_PAREN) ) {s = 50;}
+
+                         
+                        input.seek(index61_23);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 12 : 
+                        int LA61_29 = input.LA(1);
+
+                         
+                        int index61_29 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_29==79) ) {s = 60;}
+
+                        else if ( (LA61_29==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_29==DOT) ) {s = 61;}
+
+                        else if ( (LA61_29==LEFT_PAREN) ) {s = 62;}
+
+                        else if ( (LA61_29==LEFT_SQUARE) ) {s = 63;}
+
+                        else if ( ((LA61_29>=PACKAGE && LA61_29<=ID)||LA61_29==GLOBAL||LA61_29==COMMA||(LA61_29>=DECLARE && LA61_29<=NULL)||(LA61_29>=RIGHT_SQUARE && LA61_29<=78)||(LA61_29>=80 && LA61_29<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_29);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 13 : 
+                        int LA61_26 = input.LA(1);
+
+                         
+                        int index61_26 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_26==79) ) {s = 56;}
+
+                        else if ( (LA61_26==DOT) ) {s = 57;}
+
+                        else if ( (LA61_26==LEFT_SQUARE) ) {s = 58;}
+
+                        else if ( (LA61_26==LEFT_PAREN) ) {s = 59;}
+
+                        else if ( (LA61_26==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_26>=PACKAGE && LA61_26<=ID)||LA61_26==GLOBAL||LA61_26==COMMA||(LA61_26>=DECLARE && LA61_26<=NULL)||(LA61_26>=RIGHT_SQUARE && LA61_26<=78)||(LA61_26>=80 && LA61_26<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_26);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 14 : 
+                        int LA61_12 = input.LA(1);
+
+                         
+                        int index61_12 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_12==79) ) {s = 32;}
+
+                        else if ( (LA61_12==DOT) ) {s = 33;}
+
+                        else if ( (LA61_12==LEFT_SQUARE) ) {s = 34;}
+
+                        else if ( (LA61_12==LEFT_PAREN) ) {s = 35;}
+
+                        else if ( (LA61_12==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_12>=PACKAGE && LA61_12<=ID)||LA61_12==GLOBAL||LA61_12==COMMA||(LA61_12>=DECLARE && LA61_12<=NULL)||(LA61_12>=RIGHT_SQUARE && LA61_12<=78)||(LA61_12>=80 && LA61_12<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_12);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 15 : 
+                        int LA61_34 = input.LA(1);
+
+                         
+                        int index61_34 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_34==RIGHT_SQUARE) ) {s = 68;}
+
+                        else if ( (LA61_34==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_34>=PACKAGE && LA61_34<=GLOBAL)||LA61_34==COMMA||(LA61_34>=DECLARE && LA61_34<=LEFT_SQUARE)||(LA61_34>=THEN && LA61_34<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_34==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_34);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 16 : 
+                        int LA61_58 = input.LA(1);
+
+                         
+                        int index61_58 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_58==RIGHT_SQUARE) ) {s = 96;}
+
+                        else if ( (LA61_58==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_58>=PACKAGE && LA61_58<=GLOBAL)||LA61_58==COMMA||(LA61_58>=DECLARE && LA61_58<=LEFT_SQUARE)||(LA61_58>=THEN && LA61_58<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_58==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_58);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 17 : 
+                        int LA61_63 = input.LA(1);
+
+                         
+                        int index61_63 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_63==RIGHT_SQUARE) ) {s = 100;}
+
+                        else if ( (LA61_63==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_63>=PACKAGE && LA61_63<=GLOBAL)||LA61_63==COMMA||(LA61_63>=DECLARE && LA61_63<=LEFT_SQUARE)||(LA61_63>=THEN && LA61_63<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_63==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_63);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 18 : 
+                        int LA61_11 = input.LA(1);
+
+                         
+                        int index61_11 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_11==LEFT_PAREN) ) {s = 31;}
+
+                        else if ( (LA61_11==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_11>=PACKAGE && LA61_11<=GLOBAL)||LA61_11==COMMA||(LA61_11>=DECLARE && LA61_11<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_11);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 19 : 
+                        int LA61_32 = input.LA(1);
+
+                         
+                        int index61_32 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_32==ID) ) {s = 64;}
+
+                        else if ( (LA61_32==LEFT_PAREN) ) {s = 65;}
+
+                        else if ( (LA61_32==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_32>=PACKAGE && LA61_32<=FUNCTION)||(LA61_32>=DOT && LA61_32<=GLOBAL)||LA61_32==COMMA||(LA61_32>=DECLARE && LA61_32<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_32);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 20 : 
+                        int LA61_56 = input.LA(1);
+
+                         
+                        int index61_56 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_56==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_56==ID) ) {s = 93;}
+
+                        else if ( (LA61_56==LEFT_PAREN) ) {s = 94;}
+
+                        else if ( ((LA61_56>=PACKAGE && LA61_56<=FUNCTION)||(LA61_56>=DOT && LA61_56<=GLOBAL)||LA61_56==COMMA||(LA61_56>=DECLARE && LA61_56<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_56);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 21 : 
+                        int LA61_60 = input.LA(1);
+
+                         
+                        int index61_60 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_60==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_60==ID) ) {s = 97;}
+
+                        else if ( (LA61_60==LEFT_PAREN) ) {s = 98;}
+
+                        else if ( ((LA61_60>=PACKAGE && LA61_60<=FUNCTION)||(LA61_60>=DOT && LA61_60<=GLOBAL)||LA61_60==COMMA||(LA61_60>=DECLARE && LA61_60<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_60);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 22 : 
+                        int LA61_39 = input.LA(1);
+
+                         
+                        int index61_39 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_39);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 23 : 
+                        int LA61_31 = input.LA(1);
+
+                         
+                        int index61_31 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_31);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 24 : 
+                        int LA61_30 = input.LA(1);
+
+                         
+                        int index61_30 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_30);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 25 : 
+                        int LA61_47 = input.LA(1);
+
+                         
+                        int index61_47 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_47);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 26 : 
+                        int LA61_53 = input.LA(1);
+
+                         
+                        int index61_53 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_53>=PACKAGE && LA61_53<=ID)||LA61_53==GLOBAL||(LA61_53>=QUERY && LA61_53<=ATTRIBUTES)||LA61_53==ENABLED||LA61_53==SALIENCE||(LA61_53>=DURATION && LA61_53<=DIALECT)||LA61_53==FROM||(LA61_53>=INIT && LA61_53<=RESULT)||(LA61_53>=CONTAINS && LA61_53<=MEMBEROF)||LA61_53==IN||(LA61_53>=THEN && LA61_53<=EVENT)) ) {s = 91;}
+
+                        else if ( (LA61_53==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_53==DOT||LA61_53==COMMA||(LA61_53>=DECLARE && LA61_53<=STRING)||(LA61_53>=DATE_EFFECTIVE && LA61_53<=DATE_EXPIRES)||LA61_53==BOOL||(LA61_53>=INT && LA61_53<=AGENDA_GROUP)||(LA61_53>=LOCK_ON_ACTIVE && LA61_53<=DOUBLE_AMPER)||(LA61_53>=EXISTS && LA61_53<=ACCUMULATE)||(LA61_53>=TIMEWINDOW && LA61_53<=ENTRY_POINT)||LA61_53==TILDE||(LA61_53>=FLOAT && LA61_53<=RIGHT_SQUARE)||(LA61_53>=EOL && LA61_53<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_53==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_53);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 27 : 
+                        int LA61_44 = input.LA(1);
+
+                         
+                        int index61_44 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_44);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 28 : 
+                        int LA61_41 = input.LA(1);
+
+                         
+                        int index61_41 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_41);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 29 : 
+                        int LA61_40 = input.LA(1);
+
+                         
+                        int index61_40 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_40);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 30 : 
+                        int LA61_50 = input.LA(1);
+
+                         
+                        int index61_50 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_50);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 31 : 
+                        int LA61_21 = input.LA(1);
+
+                         
+                        int index61_21 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_21);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 32 : 
+                        int LA61_5 = input.LA(1);
+
+                         
+                        int index61_5 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_5==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_5==EXISTS) ) {s = 20;}
+
+                        else if ( (LA61_5==LEFT_PAREN) ) {s = 21;}
+
+                        else if ( (LA61_5==NOT) ) {s = 22;}
+
+                        else if ( (LA61_5==EVAL) ) {s = 23;}
+
+                        else if ( (LA61_5==FORALL) ) {s = 24;}
+
+                        else if ( (LA61_5==ID) ) {s = 25;}
+
+                        else if ( ((LA61_5>=PACKAGE && LA61_5<=FUNCTION)||(LA61_5>=DOT && LA61_5<=GLOBAL)||LA61_5==COMMA||(LA61_5>=DECLARE && LA61_5<=FROM)||(LA61_5>=ACCUMULATE && LA61_5<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_5);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 33 : 
+                        int LA61_35 = input.LA(1);
+
+                         
+                        int index61_35 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_35);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 34 : 
+                        int LA61_10 = input.LA(1);
+
+                         
+                        int index61_10 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_10==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_10>=PACKAGE && LA61_10<=GLOBAL)||LA61_10==COMMA||(LA61_10>=DECLARE && LA61_10<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_10==LEFT_PAREN) ) {s = 30;}
+
+                         
+                        input.seek(index61_10);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 35 : 
+                        int LA61_59 = input.LA(1);
+
+                         
+                        int index61_59 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_59);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 36 : 
+                        int LA61_62 = input.LA(1);
+
+                         
+                        int index61_62 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_62);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 37 : 
+                        int LA61_64 = input.LA(1);
+
+                         
+                        int index61_64 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_64==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_64==DOT) ) {s = 101;}
+
+                        else if ( (LA61_64==LEFT_PAREN) ) {s = 102;}
+
+                        else if ( (LA61_64==LEFT_SQUARE) ) {s = 103;}
+
+                        else if ( ((LA61_64>=PACKAGE && LA61_64<=ID)||LA61_64==GLOBAL||LA61_64==COMMA||(LA61_64>=DECLARE && LA61_64<=NULL)||(LA61_64>=RIGHT_SQUARE && LA61_64<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_64);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 38 : 
+                        int LA61_33 = input.LA(1);
+
+                         
+                        int index61_33 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_33>=PACKAGE && LA61_33<=ID)||LA61_33==GLOBAL||(LA61_33>=QUERY && LA61_33<=ATTRIBUTES)||LA61_33==ENABLED||LA61_33==SALIENCE||(LA61_33>=DURATION && LA61_33<=DIALECT)||LA61_33==FROM||(LA61_33>=INIT && LA61_33<=RESULT)||(LA61_33>=CONTAINS && LA61_33<=MEMBEROF)||LA61_33==IN||(LA61_33>=THEN && LA61_33<=EVENT)) ) {s = 66;}
+
+                        else if ( (LA61_33==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_33==DOT||LA61_33==COMMA||(LA61_33>=DECLARE && LA61_33<=STRING)||(LA61_33>=DATE_EFFECTIVE && LA61_33<=DATE_EXPIRES)||LA61_33==BOOL||(LA61_33>=INT && LA61_33<=AGENDA_GROUP)||(LA61_33>=LOCK_ON_ACTIVE && LA61_33<=DOUBLE_AMPER)||(LA61_33>=EXISTS && LA61_33<=ACCUMULATE)||(LA61_33>=TIMEWINDOW && LA61_33<=ENTRY_POINT)||LA61_33==TILDE||(LA61_33>=FLOAT && LA61_33<=RIGHT_SQUARE)||(LA61_33>=EOL && LA61_33<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_33==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_33);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 39 : 
+                        int LA61_57 = input.LA(1);
+
+                         
+                        int index61_57 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_57>=PACKAGE && LA61_57<=ID)||LA61_57==GLOBAL||(LA61_57>=QUERY && LA61_57<=ATTRIBUTES)||LA61_57==ENABLED||LA61_57==SALIENCE||(LA61_57>=DURATION && LA61_57<=DIALECT)||LA61_57==FROM||(LA61_57>=INIT && LA61_57<=RESULT)||(LA61_57>=CONTAINS && LA61_57<=MEMBEROF)||LA61_57==IN||(LA61_57>=THEN && LA61_57<=EVENT)) ) {s = 95;}
+
+                        else if ( (LA61_57==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_57==DOT||LA61_57==COMMA||(LA61_57>=DECLARE && LA61_57<=STRING)||(LA61_57>=DATE_EFFECTIVE && LA61_57<=DATE_EXPIRES)||LA61_57==BOOL||(LA61_57>=INT && LA61_57<=AGENDA_GROUP)||(LA61_57>=LOCK_ON_ACTIVE && LA61_57<=DOUBLE_AMPER)||(LA61_57>=EXISTS && LA61_57<=ACCUMULATE)||(LA61_57>=TIMEWINDOW && LA61_57<=ENTRY_POINT)||LA61_57==TILDE||(LA61_57>=FLOAT && LA61_57<=RIGHT_SQUARE)||(LA61_57>=EOL && LA61_57<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_57==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_57);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 40 : 
+                        int LA61_61 = input.LA(1);
+
+                         
+                        int index61_61 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_61==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_61>=PACKAGE && LA61_61<=ID)||LA61_61==GLOBAL||(LA61_61>=QUERY && LA61_61<=ATTRIBUTES)||LA61_61==ENABLED||LA61_61==SALIENCE||(LA61_61>=DURATION && LA61_61<=DIALECT)||LA61_61==FROM||(LA61_61>=INIT && LA61_61<=RESULT)||(LA61_61>=CONTAINS && LA61_61<=MEMBEROF)||LA61_61==IN||(LA61_61>=THEN && LA61_61<=EVENT)) ) {s = 99;}
+
+                        else if ( (LA61_61==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                        else if ( (LA61_61==DOT||LA61_61==COMMA||(LA61_61>=DECLARE && LA61_61<=STRING)||(LA61_61>=DATE_EFFECTIVE && LA61_61<=DATE_EXPIRES)||LA61_61==BOOL||(LA61_61>=INT && LA61_61<=AGENDA_GROUP)||(LA61_61>=LOCK_ON_ACTIVE && LA61_61<=DOUBLE_AMPER)||(LA61_61>=EXISTS && LA61_61<=ACCUMULATE)||(LA61_61>=TIMEWINDOW && LA61_61<=ENTRY_POINT)||LA61_61==TILDE||(LA61_61>=FLOAT && LA61_61<=RIGHT_SQUARE)||(LA61_61>=EOL && LA61_61<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_61);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 41 : 
+                        int LA61_66 = input.LA(1);
+
+                         
+                        int index61_66 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_66==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_66==LEFT_SQUARE) ) {s = 34;}
+
+                        else if ( (LA61_66==LEFT_PAREN) ) {s = 35;}
+
+                        else if ( (LA61_66==DOT) ) {s = 33;}
+
+                        else if ( ((LA61_66>=PACKAGE && LA61_66<=ID)||LA61_66==GLOBAL||LA61_66==COMMA||(LA61_66>=DECLARE && LA61_66<=NULL)||(LA61_66>=RIGHT_SQUARE && LA61_66<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_66);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 42 : 
+                        int LA61_43 = input.LA(1);
+
+                         
+                        int index61_43 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_43>=PACKAGE && LA61_43<=ID)||LA61_43==GLOBAL||(LA61_43>=QUERY && LA61_43<=ATTRIBUTES)||LA61_43==ENABLED||LA61_43==SALIENCE||(LA61_43>=DURATION && LA61_43<=DIALECT)||LA61_43==FROM||(LA61_43>=INIT && LA61_43<=RESULT)||(LA61_43>=CONTAINS && LA61_43<=MEMBEROF)||LA61_43==IN||(LA61_43>=THEN && LA61_43<=EVENT)) ) {s = 79;}
+
+                        else if ( (LA61_43==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_43==DOT||LA61_43==COMMA||(LA61_43>=DECLARE && LA61_43<=STRING)||(LA61_43>=DATE_EFFECTIVE && LA61_43<=DATE_EXPIRES)||LA61_43==BOOL||(LA61_43>=INT && LA61_43<=AGENDA_GROUP)||(LA61_43>=LOCK_ON_ACTIVE && LA61_43<=DOUBLE_AMPER)||(LA61_43>=EXISTS && LA61_43<=ACCUMULATE)||(LA61_43>=TIMEWINDOW && LA61_43<=ENTRY_POINT)||LA61_43==TILDE||(LA61_43>=FLOAT && LA61_43<=RIGHT_SQUARE)||(LA61_43>=EOL && LA61_43<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_43==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_43);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 43 : 
+                        int LA61_45 = input.LA(1);
+
+                         
+                        int index61_45 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_45==RIGHT_SQUARE) ) {s = 80;}
+
+                        else if ( (LA61_45==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_45>=PACKAGE && LA61_45<=GLOBAL)||LA61_45==COMMA||(LA61_45>=DECLARE && LA61_45<=LEFT_SQUARE)||(LA61_45>=THEN && LA61_45<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_45==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_45);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 44 : 
+                        int LA61_18 = input.LA(1);
+
+                         
+                        int index61_18 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_18==LEFT_PAREN) ) {s = 41;}
+
+                        else if ( (LA61_18==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_18>=PACKAGE && LA61_18<=GLOBAL)||LA61_18==COMMA||(LA61_18>=DECLARE && LA61_18<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_18);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 45 : 
+                        int LA61_28 = input.LA(1);
+
+                         
+                        int index61_28 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_28);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 46 : 
+                        int LA61_15 = input.LA(1);
+
+                         
+                        int index61_15 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_15);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 47 : 
+                        int LA61_17 = input.LA(1);
+
+                         
+                        int index61_17 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_17==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_17>=PACKAGE && LA61_17<=GLOBAL)||LA61_17==COMMA||(LA61_17>=DECLARE && LA61_17<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_17==LEFT_PAREN) ) {s = 40;}
+
+                         
+                        input.seek(index61_17);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 48 : 
+                        int LA61_27 = input.LA(1);
+
+                         
+                        int index61_27 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_27);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 49 : 
+                        int LA61_38 = input.LA(1);
+
+                         
+                        int index61_38 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_38==79) ) {s = 73;}
+
+                        else if ( (LA61_38==DOT) ) {s = 74;}
+
+                        else if ( (LA61_38==LEFT_SQUARE) ) {s = 75;}
+
+                        else if ( (LA61_38==LEFT_PAREN) ) {s = 76;}
+
+                        else if ( (LA61_38==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_38>=PACKAGE && LA61_38<=ID)||LA61_38==GLOBAL||LA61_38==COMMA||(LA61_38>=DECLARE && LA61_38<=NULL)||(LA61_38>=RIGHT_SQUARE && LA61_38<=78)||(LA61_38>=80 && LA61_38<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_38);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 50 : 
+                        int LA61_36 = input.LA(1);
+
+                         
+                        int index61_36 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_36==79) ) {s = 69;}
+
+                        else if ( (LA61_36==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_36==DOT) ) {s = 70;}
+
+                        else if ( (LA61_36==LEFT_PAREN) ) {s = 71;}
+
+                        else if ( (LA61_36==LEFT_SQUARE) ) {s = 72;}
+
+                        else if ( ((LA61_36>=PACKAGE && LA61_36<=ID)||LA61_36==GLOBAL||LA61_36==COMMA||(LA61_36>=DECLARE && LA61_36<=NULL)||(LA61_36>=RIGHT_SQUARE && LA61_36<=78)||(LA61_36>=80 && LA61_36<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_36);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 51 : 
+                        int LA61_19 = input.LA(1);
+
+                         
+                        int index61_19 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_19==79) ) {s = 42;}
+
+                        else if ( (LA61_19==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_19==DOT) ) {s = 43;}
+
+                        else if ( (LA61_19==LEFT_PAREN) ) {s = 44;}
+
+                        else if ( (LA61_19==LEFT_SQUARE) ) {s = 45;}
+
+                        else if ( ((LA61_19>=PACKAGE && LA61_19<=ID)||LA61_19==GLOBAL||LA61_19==COMMA||(LA61_19>=DECLARE && LA61_19<=NULL)||(LA61_19>=RIGHT_SQUARE && LA61_19<=78)||(LA61_19>=80 && LA61_19<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_19);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 52 : 
+                        int LA61_55 = input.LA(1);
+
+                         
+                        int index61_55 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_55==RIGHT_SQUARE) ) {s = 92;}
+
+                        else if ( (LA61_55==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_55>=PACKAGE && LA61_55<=GLOBAL)||LA61_55==COMMA||(LA61_55>=DECLARE && LA61_55<=LEFT_SQUARE)||(LA61_55>=THEN && LA61_55<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_55==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_55);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 53 : 
+                        int LA61_65 = input.LA(1);
+
+                         
+                        int index61_65 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_65);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 54 : 
+                        int LA61_4 = input.LA(1);
+
+                         
+                        int index61_4 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_4==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_4==EXISTS) ) {s = 14;}
+
+                        else if ( (LA61_4==LEFT_PAREN) ) {s = 15;}
+
+                        else if ( (LA61_4==NOT) ) {s = 16;}
+
+                        else if ( (LA61_4==EVAL) ) {s = 17;}
+
+                        else if ( (LA61_4==FORALL) ) {s = 18;}
+
+                        else if ( (LA61_4==ID) ) {s = 19;}
+
+                        else if ( ((LA61_4>=PACKAGE && LA61_4<=FUNCTION)||(LA61_4>=DOT && LA61_4<=GLOBAL)||LA61_4==COMMA||(LA61_4>=DECLARE && LA61_4<=FROM)||(LA61_4>=ACCUMULATE && LA61_4<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_4);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 55 : 
+                        int LA61_24 = input.LA(1);
+
+                         
+                        int index61_24 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_24==LEFT_PAREN) ) {s = 51;}
+
+                        else if ( (LA61_24==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_24>=PACKAGE && LA61_24<=GLOBAL)||LA61_24==COMMA||(LA61_24>=DECLARE && LA61_24<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_24);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 56 : 
+                        int LA61_42 = input.LA(1);
+
+                         
+                        int index61_42 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_42==ID) ) {s = 77;}
+
+                        else if ( (LA61_42==LEFT_PAREN) ) {s = 78;}
+
+                        else if ( (LA61_42==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_42>=PACKAGE && LA61_42<=FUNCTION)||(LA61_42>=DOT && LA61_42<=GLOBAL)||LA61_42==COMMA||(LA61_42>=DECLARE && LA61_42<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_42);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 57 : 
+                        int LA61_14 = input.LA(1);
+
+                         
+                        int index61_14 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_14==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_14==ID) ) {s = 36;}
+
+                        else if ( (LA61_14==LEFT_PAREN) ) {s = 37;}
+
+                        else if ( ((LA61_14>=PACKAGE && LA61_14<=FUNCTION)||(LA61_14>=DOT && LA61_14<=GLOBAL)||LA61_14==COMMA||(LA61_14>=DECLARE && LA61_14<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_14);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 58 : 
+                        int LA61_20 = input.LA(1);
+
+                         
+                        int index61_20 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_20==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_20==ID) ) {s = 46;}
+
+                        else if ( (LA61_20==LEFT_PAREN) ) {s = 47;}
+
+                        else if ( ((LA61_20>=PACKAGE && LA61_20<=FUNCTION)||(LA61_20>=DOT && LA61_20<=GLOBAL)||LA61_20==COMMA||(LA61_20>=DECLARE && LA61_20<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_20);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 59 : 
+                        int LA61_52 = input.LA(1);
+
+                         
+                        int index61_52 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_52==ID) ) {s = 89;}
+
+                        else if ( (LA61_52==LEFT_PAREN) ) {s = 90;}
+
+                        else if ( (LA61_52==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_52>=PACKAGE && LA61_52<=FUNCTION)||(LA61_52>=DOT && LA61_52<=GLOBAL)||LA61_52==COMMA||(LA61_52>=DECLARE && LA61_52<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_52);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 60 : 
+                        int LA61_46 = input.LA(1);
+
+                         
+                        int index61_46 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_46==79) ) {s = 81;}
+
+                        else if ( (LA61_46==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_46==DOT) ) {s = 82;}
+
+                        else if ( (LA61_46==LEFT_PAREN) ) {s = 83;}
+
+                        else if ( (LA61_46==LEFT_SQUARE) ) {s = 84;}
+
+                        else if ( ((LA61_46>=PACKAGE && LA61_46<=ID)||LA61_46==GLOBAL||LA61_46==COMMA||(LA61_46>=DECLARE && LA61_46<=NULL)||(LA61_46>=RIGHT_SQUARE && LA61_46<=78)||(LA61_46>=80 && LA61_46<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_46);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 61 : 
+                        int LA61_25 = input.LA(1);
+
+                         
+                        int index61_25 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_25==79) ) {s = 52;}
+
+                        else if ( (LA61_25==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_25==DOT) ) {s = 53;}
+
+                        else if ( (LA61_25==LEFT_PAREN) ) {s = 54;}
+
+                        else if ( (LA61_25==LEFT_SQUARE) ) {s = 55;}
+
+                        else if ( ((LA61_25>=PACKAGE && LA61_25<=ID)||LA61_25==GLOBAL||LA61_25==COMMA||(LA61_25>=DECLARE && LA61_25<=NULL)||(LA61_25>=RIGHT_SQUARE && LA61_25<=78)||(LA61_25>=80 && LA61_25<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_25);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 62 : 
+                        int LA61_49 = input.LA(1);
+
+                         
+                        int index61_49 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_49==79) ) {s = 85;}
+
+                        else if ( (LA61_49==DOT) ) {s = 86;}
+
+                        else if ( (LA61_49==LEFT_SQUARE) ) {s = 87;}
+
+                        else if ( (LA61_49==LEFT_PAREN) ) {s = 88;}
+
+                        else if ( (LA61_49==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_49>=PACKAGE && LA61_49<=ID)||LA61_49==GLOBAL||LA61_49==COMMA||(LA61_49>=DECLARE && LA61_49<=NULL)||(LA61_49>=RIGHT_SQUARE && LA61_49<=78)||(LA61_49>=80 && LA61_49<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_49);
+                        if ( s>=0 ) return s;
+                        break;
+            }
+            if (backtracking>0) {failed=true; return -1;}
+            NoViableAltException nvae =
+                new NoViableAltException(getDescription(), 61, _s, input);
+            error(nvae);
+            throw nvae;
+        }
+    }
+    static final String DFA73_eotS =
+        "\23\uffff";
+    static final String DFA73_eofS =
+        "\23\uffff";
+    static final String DFA73_minS =
+        "\1\13\1\uffff\1\4\1\10\1\uffff\2\4\14\0";
+    static final String DFA73_maxS =
+        "\1\50\1\uffff\2\126\1\uffff\2\126\14\0";
+    static final String DFA73_acceptS =
+        "\1\uffff\1\2\2\uffff\1\1\16\uffff";
+    static final String DFA73_specialS =
+        "\23\uffff}>";
+    static final String[] DFA73_transitionS = {
+            "\2\1\31\uffff\1\2\1\uffff\1\1",
+            "",
+            "\4\1\1\uffff\1\1\1\12\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\5\1\6\1\7\1\10\1\11\1\4\1\3\4\uffff\2\1\16\uffff\6\4",
+            "\1\1\1\uffff\1\13\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "",
+            "\4\4\1\1\1\4\1\15\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\16\1\17\1\20\1\21\1\22"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\15\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\16\1\17\1\20\1\21\1\22"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA73_eot = DFA.unpackEncodedString(DFA73_eotS);
+    static final short[] DFA73_eof = DFA.unpackEncodedString(DFA73_eofS);
+    static final char[] DFA73_min = DFA.unpackEncodedStringToUnsignedChars(DFA73_minS);
+    static final char[] DFA73_max = DFA.unpackEncodedStringToUnsignedChars(DFA73_maxS);
+    static final short[] DFA73_accept = DFA.unpackEncodedString(DFA73_acceptS);
+    static final short[] DFA73_special = DFA.unpackEncodedString(DFA73_specialS);
+    static final short[][] DFA73_transition;
+
+    static {
+        int numStates = DFA73_transitionS.length;
+        DFA73_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA73_transition[i] = DFA.unpackEncodedString(DFA73_transitionS[i]);
+        }
+    }
+
+    class DFA73 extends DFA {
+
+        public DFA73(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 73;
+            this.eot = DFA73_eot;
+            this.eof = DFA73_eof;
+            this.min = DFA73_min;
+            this.max = DFA73_max;
+            this.accept = DFA73_accept;
+            this.special = DFA73_special;
+            this.transition = DFA73_transition;
+        }
+        public String getDescription() {
+            return "()* loopback of 1523:3: ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*";
+        }
+    }
+    static final String DFA74_eotS =
+        "\70\uffff";
+    static final String DFA74_eofS =
+        "\1\1\13\uffff\6\4\46\uffff";
+    static final String DFA74_minS =
+        "\1\13\1\uffff\1\4\1\10\1\uffff\7\4\1\10\6\4\1\10\2\4\42\0";
+    static final String DFA74_maxS =
+        "\1\50\1\uffff\2\126\1\uffff\7\126\1\77\5\102\4\126\42\0";
+    static final String DFA74_acceptS =
+        "\1\uffff\1\2\2\uffff\1\1\63\uffff";
+    static final String DFA74_specialS =
+        "\70\uffff}>";
+    static final String[] DFA74_transitionS = {
+            "\2\1\31\uffff\1\1\1\uffff\1\2",
+            "",
+            "\4\1\1\uffff\1\1\1\12\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\5\1\6\1\7\1\10\1\11\1\4\1\3\4\uffff\2\1\16\uffff\6\4",
+            "\1\1\1\uffff\1\13\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\1\1\uffff\1\1\1\31\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\24\1\25\1\26\1\27\1\30\1\4\1\23\4\uffff\2\1\16\uffff\6\4",
+            "\4\4\1\uffff\1\4\1\33\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5"+
+            "\uffff\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\34\1\35\1\36\1"+
+            "\37\1\40\1\1\1\32\2\4\2\uffff\2\4\16\uffff\6\1",
+            "\1\4\1\uffff\1\1\2\4\31\uffff\1\4\1\uffff\1\4\26\uffff\1\4",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\6\4\1\42\40\4\1\43\12\4\1\52\1\53\1\54\1\55\1\56\1\57\1\41"+
+            "\24\4\1\44\1\45\1\46\1\47\1\50\1\51",
+            "\1\1\1\uffff\1\60\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "\4\4\1\1\1\4\1\62\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\63\1\64\1\65\1\66\1\67"+
+            "\1\1\1\61\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\62\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\63\1\64\1\65\1\66\1\67"+
+            "\1\1\1\61\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA74_eot = DFA.unpackEncodedString(DFA74_eotS);
+    static final short[] DFA74_eof = DFA.unpackEncodedString(DFA74_eofS);
+    static final char[] DFA74_min = DFA.unpackEncodedStringToUnsignedChars(DFA74_minS);
+    static final char[] DFA74_max = DFA.unpackEncodedStringToUnsignedChars(DFA74_maxS);
+    static final short[] DFA74_accept = DFA.unpackEncodedString(DFA74_acceptS);
+    static final short[] DFA74_special = DFA.unpackEncodedString(DFA74_specialS);
+    static final short[][] DFA74_transition;
+
+    static {
+        int numStates = DFA74_transitionS.length;
+        DFA74_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA74_transition[i] = DFA.unpackEncodedString(DFA74_transitionS[i]);
+        }
+    }
+
+    class DFA74 extends DFA {
+
+        public DFA74(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 74;
+            this.eot = DFA74_eot;
+            this.eof = DFA74_eof;
+            this.min = DFA74_min;
+            this.max = DFA74_max;
+            this.accept = DFA74_accept;
+            this.special = DFA74_special;
+            this.transition = DFA74_transition;
+        }
+        public String getDescription() {
+            return "()* loopback of 1546:3: ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*";
+        }
+    }
+ 
+
+    public static final BitSet FOLLOW_77_in_opt_semicolon39 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_prolog_in_compilation_unit57 = new BitSet(new long[]{0x0000001FEB9A2260L});
+    public static final BitSet FOLLOW_statement_in_compilation_unit62 = new BitSet(new long[]{0x0000001FEB9A2260L});
+    public static final BitSet FOLLOW_EOF_in_compilation_unit67 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_package_statement_in_prolog96 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_attribute_in_statement121 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_import_statement_in_statement128 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_import_statement_in_statement134 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_global_in_statement140 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_in_statement146 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_template_in_statement160 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_in_statement169 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_query_in_statement181 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_declaration_in_statement196 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_PACKAGE_in_package_statement222 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_package_statement226 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_package_statement228 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IMPORT_in_import_statement259 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_import_name_in_import_statement282 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_import_statement285 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IMPORT_in_function_import_statement309 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_FUNCTION_in_function_import_statement311 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_import_name_in_function_import_statement334 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_function_import_statement337 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_import_name362 = new BitSet(new long[]{0x0000000000000102L,0x0000000000004000L});
+    public static final BitSet FOLLOW_DOT_in_import_name374 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_import_name378 = new BitSet(new long[]{0x0000000000000102L,0x0000000000004000L});
+    public static final BitSet FOLLOW_78_in_import_name402 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_GLOBAL_in_global436 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_global447 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_global458 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_global460 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FUNCTION_in_function485 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function489 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_function494 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_function503 = new BitSet(new long[]{0x17C7820C0A7E12F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function512 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_argument_in_function517 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_function531 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function535 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_argument_in_function540 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_function564 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_curly_chunk_in_function570 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_argument597 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_argument603 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_argument605 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_DECLARE_in_type_declaration645 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_type_declaration649 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_LEFT_CURLY_in_type_declaration694 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_type_decl_attribute_in_type_declaration720 = new BitSet(new long[]{0x0000000000008800L});
+    public static final BitSet FOLLOW_COMMA_in_type_declaration725 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_type_decl_attribute_in_type_declaration727 = new BitSet(new long[]{0x0000000000008800L});
+    public static final BitSet FOLLOW_RIGHT_CURLY_in_type_declaration749 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_type_decl_attribute785 = new BitSet(new long[]{0x17C7820C0A7F02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_STRING_in_type_decl_attribute808 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_dotted_name_in_type_decl_attribute849 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_QUERY_in_query922 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_query926 = new BitSet(new long[]{0x00003C0000040480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_query936 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_qualified_id_in_query971 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_query976 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_query997 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_qualified_id_in_query1001 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_query1006 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_query1056 = new BitSet(new long[]{0x00003C0000040480L});
+    public static final BitSet FOLLOW_normal_lhs_block_in_query1085 = new BitSet(new long[]{0x0000000000040000L});
+    public static final BitSet FOLLOW_END_in_query1090 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_query1092 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_TEMPLATE_in_template1120 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_template1124 = new BitSet(new long[]{0x0000000000000080L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template1126 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_template_slot_in_template1141 = new BitSet(new long[]{0x0000000000040080L});
+    public static final BitSet FOLLOW_END_in_template1156 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template1158 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_qualified_id_in_template_slot1204 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_template_slot1220 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template_slot1222 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_RULE_in_rule1253 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_rule1257 = new BitSet(new long[]{0x0000001FEBE00000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_attributes_in_rule1266 = new BitSet(new long[]{0x0000000000200000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_WHEN_in_rule1278 = new BitSet(new long[]{0x00003C0000000480L,0x0000000000008002L});
+    public static final BitSet FOLLOW_79_in_rule1280 = new BitSet(new long[]{0x00003C0000000480L,0x0000000000000002L});
+    public static final BitSet FOLLOW_normal_lhs_block_in_rule1291 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_rhs_chunk_in_rule1301 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ATTRIBUTES_in_rule_attributes1321 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_rule_attributes1323 = new BitSet(new long[]{0x0000001FEB800000L});
+    public static final BitSet FOLLOW_rule_attribute_in_rule_attributes1331 = new BitSet(new long[]{0x0000001FEB800802L});
+    public static final BitSet FOLLOW_COMMA_in_rule_attributes1338 = new BitSet(new long[]{0x0000001FEB800000L});
+    public static final BitSet FOLLOW_rule_attribute_in_rule_attributes1343 = new BitSet(new long[]{0x0000001FEB800802L});
+    public static final BitSet FOLLOW_salience_in_rule_attribute1380 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_no_loop_in_rule_attribute1388 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_agenda_group_in_rule_attribute1397 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_duration_in_rule_attribute1406 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_activation_group_in_rule_attribute1415 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_auto_focus_in_rule_attribute1423 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_date_effective_in_rule_attribute1431 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_date_expires_in_rule_attribute1439 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enabled_in_rule_attribute1447 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ruleflow_group_in_rule_attribute1455 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lock_on_active_in_rule_attribute1463 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_dialect_in_rule_attribute1470 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DATE_EFFECTIVE_in_date_effective1496 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_date_effective1498 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DATE_EXPIRES_in_date_expires1527 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_date_expires1529 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ENABLED_in_enabled1558 = new BitSet(new long[]{0x0000000004000000L});
+    public static final BitSet FOLLOW_BOOL_in_enabled1560 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_SALIENCE_in_salience1593 = new BitSet(new long[]{0x0000000010000400L});
+    public static final BitSet FOLLOW_INT_in_salience1604 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_salience1619 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NO_LOOP_in_no_loop1649 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_no_loop1662 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AUTO_FOCUS_in_auto_focus1697 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_auto_focus1710 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ACTIVATION_GROUP_in_activation_group1746 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_activation_group1748 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_RULEFLOW_GROUP_in_ruleflow_group1776 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_ruleflow_group1778 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AGENDA_GROUP_in_agenda_group1806 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_agenda_group1808 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DURATION_in_duration1836 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_INT_in_duration1838 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DIALECT_in_dialect1866 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_dialect1868 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LOCK_ON_ACTIVE_in_lock_on_active1900 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_lock_on_active1913 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_in_normal_lhs_block1952 = new BitSet(new long[]{0x00003C0000000482L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs1989 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_or2014 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_OR_in_lhs_or2016 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2029 = new BitSet(new long[]{0x00003C0000001480L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_or2040 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2058 = new BitSet(new long[]{0x0000006000000002L});
+    public static final BitSet FOLLOW_set_in_lhs_or2066 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2082 = new BitSet(new long[]{0x0000006000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_and2113 = new BitSet(new long[]{0x0000008000000000L});
+    public static final BitSet FOLLOW_AND_in_lhs_and2115 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2127 = new BitSet(new long[]{0x00003C0000001480L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_and2137 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2155 = new BitSet(new long[]{0x0000018000000002L});
+    public static final BitSet FOLLOW_set_in_lhs_and2163 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2179 = new BitSet(new long[]{0x0000018000000002L});
+    public static final BitSet FOLLOW_lhs_exist_in_lhs_unary2224 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_not_in_lhs_unary2242 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_eval_in_lhs_unary2261 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_forall_in_lhs_unary2280 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_unary2297 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_unary2301 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_unary2303 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_pattern_source_in_lhs_unary2314 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_lhs_unary2326 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_pattern_source2353 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_FROM_in_pattern_source2404 = new BitSet(new long[]{0x0020000000000000L});
+    public static final BitSet FOLLOW_entrypoint_statement_in_pattern_source2408 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FROM_in_pattern_source2428 = new BitSet(new long[]{0x17DFC20C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accumulate_statement_in_pattern_source2486 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_timewindow_statement_in_pattern_source2509 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_collect_statement_in_pattern_source2533 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_from_statement_in_pattern_source2570 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EXISTS_in_lhs_exist2612 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_exist2632 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_exist2636 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_exist2666 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_exist2716 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NOT_in_lhs_not2768 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_not2781 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_not2785 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_not2816 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_not2853 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_lhs_eval2899 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_lhs_eval2910 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FORALL_in_lhs_forall2936 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_forall2938 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_forall2942 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_forall2957 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_forall2973 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fact_binding_in_lhs_pattern3006 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fact_in_lhs_pattern3014 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_from_source_in_from_statement3041 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ACCUMULATE_in_accumulate_statement3078 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_accumulate_statement3088 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_accumulate_statement3092 = new BitSet(new long[]{0x0000800000000880L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3094 = new BitSet(new long[]{0x0000800000000080L});
+    public static final BitSet FOLLOW_INIT_in_accumulate_statement3112 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3125 = new BitSet(new long[]{0x0001000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3127 = new BitSet(new long[]{0x0001000000000000L});
+    public static final BitSet FOLLOW_ACTION_in_accumulate_statement3138 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3142 = new BitSet(new long[]{0x0006000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3144 = new BitSet(new long[]{0x0006000000000000L});
+    public static final BitSet FOLLOW_REVERSE_in_accumulate_statement3157 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3161 = new BitSet(new long[]{0x0004000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3163 = new BitSet(new long[]{0x0004000000000000L});
+    public static final BitSet FOLLOW_RESULT_in_accumulate_statement3180 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3184 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_ID_in_accumulate_statement3210 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3214 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_accumulate_statement3231 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_TIMEWINDOW_in_timewindow_statement3269 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_timewindow_statement3279 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_timewindow_statement3283 = new BitSet(new long[]{0x0000000010000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3285 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_INT_in_timewindow_statement3295 = new BitSet(new long[]{0x0000800000000880L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3297 = new BitSet(new long[]{0x0000800000000080L});
+    public static final BitSet FOLLOW_INIT_in_timewindow_statement3313 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3326 = new BitSet(new long[]{0x0001000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3328 = new BitSet(new long[]{0x0001000000000000L});
+    public static final BitSet FOLLOW_ACTION_in_timewindow_statement3339 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3343 = new BitSet(new long[]{0x0006000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3345 = new BitSet(new long[]{0x0006000000000000L});
+    public static final BitSet FOLLOW_REVERSE_in_timewindow_statement3358 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3362 = new BitSet(new long[]{0x0004000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3364 = new BitSet(new long[]{0x0004000000000000L});
+    public static final BitSet FOLLOW_RESULT_in_timewindow_statement3381 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3385 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_ID_in_timewindow_statement3410 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3414 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_timewindow_statement3431 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_from_source3461 = new BitSet(new long[]{0x0000000000000502L});
+    public static final BitSet FOLLOW_paren_chunk_in_from_source3489 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_expression_chain_in_from_source3502 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOT_in_expression_chain3533 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_expression_chain3537 = new BitSet(new long[]{0x8000000000000502L});
+    public static final BitSet FOLLOW_square_chunk_in_expression_chain3568 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_paren_chunk_in_expression_chain3601 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_expression_chain_in_expression_chain3616 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_COLLECT_in_collect_statement3667 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_collect_statement3677 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_pattern_source_in_collect_statement3681 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_collect_statement3683 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ENTRY_POINT_in_entrypoint_statement3720 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_entrypoint_statement3732 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_fact_binding3764 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_fact_binding3766 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3780 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_fact_binding3796 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3800 = new BitSet(new long[]{0x0000006000001000L});
+    public static final BitSet FOLLOW_set_in_fact_binding3813 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3825 = new BitSet(new long[]{0x0000006000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_fact_binding3843 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_qualified_id_in_fact3898 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_fact3908 = new BitSet(new long[]{0x17C7920C0A7E16F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_constraints_in_fact3920 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_fact3927 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EOF_in_fact3936 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_constraint_in_constraints3954 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_COMMA_in_constraints3961 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_constraint_in_constraints3970 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_or_constr_in_constraint4003 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_constr_in_or_constr4026 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_or_constr4034 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_and_constr_in_or_constr4043 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_unary_constr_in_and_constr4075 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_and_constr4083 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_unary_constr_in_and_constr4092 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_field_constraint_in_unary_constr4120 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_unary_constr4128 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_or_constr_in_unary_constr4130 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_unary_constr4133 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_unary_constr4139 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_predicate_in_unary_constr4141 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_field_constraint4180 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_field_constraint4182 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accessor_path_in_field_constraint4201 = new BitSet(new long[]{0x1FC0080000000402L,0x00000000007F0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_field_constraint4215 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_80_in_field_constraint4230 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_predicate_in_field_constraint4232 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_accessor_path_in_field_constraint4258 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_field_constraint4267 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective4314 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_or_restr_connective4338 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective4349 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_constraint_expression_in_and_restr_connective4381 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_and_restr_connective4401 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_constraint_expression_in_and_restr_connective4412 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_compound_operator_in_constraint_expression4449 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_simple_operator_in_constraint_expression4456 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_constraint_expression4464 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_constraint_expression4473 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_constraint_expression4478 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_81_in_simple_operator4509 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_82_in_simple_operator4517 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_83_in_simple_operator4525 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_84_in_simple_operator4533 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_85_in_simple_operator4541 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_86_in_simple_operator4549 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_CONTAINS_in_simple_operator4577 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4605 = new BitSet(new long[]{0x0040000000000000L});
+    public static final BitSet FOLLOW_CONTAINS_in_simple_operator4609 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_EXCLUDES_in_simple_operator4637 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_MATCHES_in_simple_operator4665 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_SOUNDSLIKE_in_simple_operator4693 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4721 = new BitSet(new long[]{0x0100000000000000L});
+    public static final BitSet FOLLOW_MATCHES_in_simple_operator4725 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_MEMBEROF_in_simple_operator4753 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4781 = new BitSet(new long[]{0x0400000000000000L});
+    public static final BitSet FOLLOW_MEMBEROF_in_simple_operator4785 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_TILDE_in_simple_operator4791 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_simple_operator4795 = new BitSet(new long[]{0xF7C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_square_chunk_in_simple_operator4799 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4808 = new BitSet(new long[]{0x0800000000000000L});
+    public static final BitSet FOLLOW_TILDE_in_simple_operator4810 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_simple_operator4814 = new BitSet(new long[]{0xF7C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_square_chunk_in_simple_operator4818 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_simple_operator4833 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IN_in_compound_operator4863 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_NOT_in_compound_operator4875 = new BitSet(new long[]{0x1000000000000000L});
+    public static final BitSet FOLLOW_IN_in_compound_operator4877 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_compound_operator4892 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_compound_operator4896 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_compound_operator4903 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_compound_operator4907 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_compound_operator4916 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_accessor_path_in_expression_value4950 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_constraint_in_expression_value4970 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_expression_value4984 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_literal_constraint5027 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_literal_constraint5038 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_literal_constraint5051 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_literal_constraint5062 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_literal_constraint5074 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_predicate5112 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_CURLY_in_curly_chunk5130 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_curly_chunk5134 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_curly_chunk_in_curly_chunk5143 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_CURLY_in_curly_chunk5148 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_paren_chunk5162 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_paren_chunk5166 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_paren_chunk_in_paren_chunk5175 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_paren_chunk5180 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_square_chunk5193 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_square_chunk5197 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_square_chunk_in_square_chunk5206 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_square_chunk5211 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_qualified_id5240 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_qualified_id5246 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_qualified_id5248 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_qualified_id5257 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_qualified_id5259 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_dotted_name5293 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_dotted_name5299 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_dotted_name5303 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_dotted_name5312 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_dotted_name5314 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_accessor_element_in_accessor_path5348 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_accessor_path5354 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accessor_element_in_accessor_path5358 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_identifier_in_accessor_element5396 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_square_chunk_in_accessor_element5403 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_THEN_in_rhs_chunk5424 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_rhs_chunk5432 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_END_in_rhs_chunk5456 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_rhs_chunk5458 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_name5492 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_name5500 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_set_in_identifier0 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EXISTS_in_synpred12216 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NOT_in_synpred22234 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_synpred32253 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FORALL_in_synpred42272 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_synpred52291 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FROM_in_synpred62397 = new BitSet(new long[]{0x0020000000000000L});
+    public static final BitSet FOLLOW_ENTRY_POINT_in_synpred62399 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_synpred103560 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_synpred113593 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_synpred124338 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_and_restr_connective_in_synpred124349 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_synpred134401 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_constraint_expression_in_synpred134412 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DrlDumper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DrlDumper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/DrlDumper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,528 @@
+package org.drools.lang;
+
+/*
+ * Author Jayaram C S
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PackageDescrDumper;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.util.ReflectiveVisitor;
+
+/**
+ * 
+ * @author <a href="mailto:jayaramcs at gmail.com">Author Jayaram C S</a>
+ *
+ */
+public class DrlDumper extends ReflectiveVisitor
+    implements
+    PackageDescrDumper {
+
+    private StringBuffer        drlDump;
+    private static final String eol          = System.getProperty( "line.separator" );
+    private String              template;
+    private boolean             needsBracket = false;
+
+    public synchronized String dump(final PackageDescr packageDescr) {
+        this.drlDump = new StringBuffer();
+        visitPackageDescr( packageDescr );
+        return this.drlDump.toString();
+    }
+
+    public String getTemplate() {
+        return this.template;
+    }
+
+    public void visitAndDescr(final AndDescr descr) {
+        this.template = new String();
+        if ( !descr.getDescrs().isEmpty() ) {
+            this.template = processDescrList( descr.getDescrs() );
+        } else {
+            this.template = "";
+        }
+    }
+    
+    private static Set needsQuotes = new HashSet();
+    static {
+        needsQuotes.add( "agenda-group" );
+        needsQuotes.add( "activation-group" );
+        needsQuotes.add( "ruleflow-group" );
+        needsQuotes.add( "date-effective" );
+        needsQuotes.add( "date-expires" );
+        needsQuotes.add( "dialect" );
+    }
+    
+
+    public void visitAttributeDescr(final AttributeDescr attributeDescr) {
+        this.template = new String();
+        final String name = attributeDescr.getName();
+        String value = null;
+                        
+        if ( needsQuotes.contains( name) ) {
+            // These attributes may need quotes around them, if they have spaces, so add anyway
+            value = "\"" + attributeDescr.getValue() + "\"";
+        } else {
+            value = attributeDescr.getValue();
+        }
+        this.template = "\t " + name + " " + value + DrlDumper.eol;
+    }
+
+    public void visitFieldConstraintDescr(final FieldConstraintDescr descr) {
+        if ( !descr.getRestrictions().isEmpty() ) {
+            this.template = descr.getFieldName() + " " + processFieldConstraint( descr.getRestriction(),
+                                                                                 false );
+        }
+    }
+
+    public void visitVariableRestrictionDescr(final VariableRestrictionDescr descr) {
+        this.template = new String();
+        this.template = descr.getEvaluator() + " " + descr.getIdentifier();
+    }
+
+    public void visitPatternDescr(final PatternDescr descr) {
+        StringBuffer buf = new StringBuffer();
+        buf.append( "\t\t" );
+        if ( descr.getIdentifier() != null ) {
+            buf.append(  descr.getIdentifier() );
+            buf.append( " : " );
+            
+        }
+        buf.append( descr.getObjectType() );
+        buf.append( "( " );
+        if ( !descr.getConstraint().getDescrs().isEmpty() ) {
+            buf.append( processColoumnConstraintList( descr.getConstraint().getDescrs() ) );
+        }
+        buf.append( " )" );
+        if( descr.getSource() != null ) {
+            buf.append( " from " );
+            this.template = buf.toString();
+            visit( descr.getSource() );
+            buf.append( this.template );
+        }
+        this.template = buf.toString();
+    }
+
+    public void visitEvalDescr(final EvalDescr descr) {
+        this.template = new String();
+        this.template = "\t\teval ( " + descr.getContent() + " )" + DrlDumper.eol;
+    }
+
+    public void visitExistsDescr(final ExistsDescr descr) {
+        this.template = new String();
+        if ( !descr.getDescrs().isEmpty() ) {
+            this.template = "\t\texists " + processDescrList( descr.getDescrs() ) + ";";
+        } else {
+            this.template = "";
+        }
+    }
+
+    public void visitCollectDescr(final CollectDescr descr) {
+        String tmpstr = new String();
+        tmpstr += " collect (";
+        visitPatternDescr( descr.getInputPattern() );
+        tmpstr += this.template.substring( 2 );
+        this.template = tmpstr + ");";
+    }
+
+    public void visitAccumulateDescr(final AccumulateDescr descr) {
+        String tmpstr = new String();
+        tmpstr += " accumulate (";
+        if ( descr.isSinglePattern() ) { 
+        	visitPatternDescr( descr.getInputPattern() );
+        } else {
+        	visit(descr.getInput());
+        }
+        tmpstr += this.template.substring( 2 );
+
+        if ( descr.isExternalFunction() ) {
+            tmpstr += "," + descr.getFunctionIdentifier() + "(" + descr.getExpression() + ")";
+        } else {
+            tmpstr += ", init(" + descr.getInitCode() + "), ";
+            tmpstr += "action(" + descr.getActionCode() + "), ";
+            if( descr.getReverseCode() != null ) {
+                tmpstr += " reverse(" + descr.getReverseCode() +"), ";
+            }
+            tmpstr += "result(" + descr.getResultCode() + ")";
+        }
+        this.template = tmpstr + ");";
+    }
+
+    public void visitFromDescr(final FromDescr descr) {
+        this.template = descr.getDataSource().toString();
+    }
+
+    public void visitForallDescr(final ForallDescr descr) {
+        String localstr = new String();
+        localstr += "\t\tforall ( ";
+        localstr += DrlDumper.eol;
+
+        for ( final Iterator ite = descr.getDescrs().iterator(); ite.hasNext(); ) {
+            Object obj = ite.next();
+            visit( obj );
+            localstr += this.template + DrlDumper.eol;
+        }
+
+        this.template = localstr;
+        this.template += "\t\t)";
+        this.template += DrlDumper.eol;
+    }
+
+    public void visitFieldBindingDescr(final FieldBindingDescr descr) {
+        this.template = new String();
+        this.template = descr.getIdentifier() + " : " + descr.getFieldName();
+    }
+
+    public void visitFunctionDescr(final FunctionDescr functionDescr) {
+        this.template = new String();
+        final String parameterTemplate = processParameters( functionDescr.getParameterNames(),
+                                                            functionDescr.getParameterTypes() );
+
+        this.template = "function " + functionDescr.getReturnType() + " " + functionDescr.getName() + "(" + parameterTemplate + "){" +
+
+        functionDescr.getText() + DrlDumper.eol + "}" + DrlDumper.eol;
+
+    }
+
+    public void visitLiteralRestrictionDescr(final LiteralRestrictionDescr descr) {
+        this.template = "";
+        String text = descr.getText();
+        if ( text == null || descr.getType() == LiteralRestrictionDescr.TYPE_NULL ) {
+            text = "null";
+        } else if( descr.getType() == LiteralRestrictionDescr.TYPE_NUMBER ) {
+            try {
+                Integer.parseInt( text );
+            } catch ( final NumberFormatException e ) {
+                text = "\"" + text + "\"";
+            }
+        } else if( descr.getType() == LiteralRestrictionDescr.TYPE_STRING ) {
+            text = "\"" + text + "\"";
+        }
+        this.template = descr.getEvaluator() + " " + text;
+    }
+
+    public void visitQualifiedIdentifierRestrictionDescr(final QualifiedIdentifierRestrictionDescr descr) {
+        this.template = descr.getEvaluator() + " " + descr.getText();
+    }
+
+    public void visitRestrictionConnectiveDescr(final RestrictionConnectiveDescr descr) {
+        String tmp = this.processFieldConstraint( descr,
+                                                  true );
+        this.template = tmp;
+    }
+
+    public void visitNotDescr(final NotDescr descr) {
+        this.template = new String();
+        if ( !descr.getDescrs().isEmpty() ) {
+            this.template = "\t   not ( " + processDescrList( descr.getDescrs() ) +")";
+        } else {
+            this.template = "";
+        }
+    }
+
+    public void visitOrDescr(final OrDescr descr) {
+        this.template = new String();
+        if ( !descr.getDescrs().isEmpty() ) {
+            this.template = processOrDescrList( descr.getDescrs() );
+        } else {
+            this.template = " ";
+        }
+    }
+
+    public void visitPackageDescr(final PackageDescr packageDescr) {
+        final String packageName = packageDescr.getName();
+        final String xmlString = "package " + packageName + ";" + DrlDumper.eol + DrlDumper.eol;
+
+        appendDrlDump( xmlString );
+        if ( packageDescr.getImports() != null ) {
+            appendDrlDump( processImportsList( packageDescr.getImports() ) );
+        }
+        if ( packageDescr.getGlobals() != null ) {
+            appendDrlDump( processGlobalsList( packageDescr.getGlobals() ) );
+        }
+        if ( packageDescr.getFunctionImports() != null ) {
+            appendDrlDump( processFunctionImportsList( packageDescr.getFunctionImports() ) );
+        }
+        if ( packageDescr.getFunctions() != null ) {
+            appendDrlDump( processFunctionsList( packageDescr.getFunctions() ) );
+        }
+        if ( packageDescr.getRules() != null ) {
+            appendDrlDump( processRules( packageDescr.getRules() ) );
+        }
+
+    }
+
+    public void visitPredicateDescr(final PredicateDescr descr) {
+        this.template = new String();
+        this.template = "eval( " + descr.getContent() + " )";
+
+    }
+
+    public void visitReturnValueRestrictionDescr(final ReturnValueRestrictionDescr descr) {
+        this.template = new String();
+        this.template = descr.getEvaluator() + " ( " + descr.getContent() + ")";
+    }
+
+    public void visitQueryDescr(final QueryDescr descr) {
+        this.template = new String();
+        this.template = "query \"" + descr.getName() + "\"" + processDescrList( descr.getLhs().getDescrs() )  + "end";
+    }
+    
+
+    private String processRules(final List rules) {
+        String ruleList = "";
+        Object ruleobj;
+        for ( final Iterator iterator = rules.iterator(); iterator.hasNext(); ) {
+        	ruleobj = iterator.next();
+        	if ( ruleobj instanceof QueryDescr ) {
+        		visitQueryDescr((QueryDescr) ruleobj);
+        		ruleList += this.template;
+        		break;
+        	}
+
+        	final RuleDescr ruleDescr = (RuleDescr) ruleobj;
+            String rule = "rule \"" + ruleDescr.getName() + "\" " + DrlDumper.eol;
+            final String attribute = processAttribute( ruleDescr.getAttributes() );
+            String lhs = "";
+            if ( !ruleDescr.getLhs().getDescrs().isEmpty() ) {
+                lhs = "\t when" + DrlDumper.eol + processDescrList( ruleDescr.getLhs().getDescrs() ) + DrlDumper.eol;
+            } else {
+
+                lhs = "\t when";
+            }
+
+            String rhs = (String) ruleDescr.getConsequence();
+            if ( rhs == null ) {
+                rhs = "\t then" + DrlDumper.eol + "\t";
+            } else {
+                rhs = "\t then" + DrlDumper.eol + ruleDescr.getConsequence();
+            }
+
+            rule += attribute;
+            rule += lhs;
+            rule += rhs;
+            rule += "end" + DrlDumper.eol;
+            ruleList += rule;
+        }
+
+        return ruleList + DrlDumper.eol;
+    }
+
+    private String processOrDescrList(final List descr) {
+        String descrString = "";
+        for ( final Iterator iterator = descr.iterator(); iterator.hasNext(); ) {
+            visit( iterator.next() );
+            descrString += this.template;
+            if ( descrString.endsWith( DrlDumper.eol ) ) {
+                descrString = descrString.substring( 0,
+                                                     descrString.indexOf( DrlDumper.eol ) );
+            }
+            descrString += " || ";
+        }
+        return descrString.substring( 0,
+                                      descrString.length() - 4 );
+    }
+
+    private String processColoumnConstraintList(final List descr) {
+        String descrString = "";
+        Object previous = null;
+        for ( final Iterator iterator = descr.iterator(); iterator.hasNext(); ) {
+
+            final Object temp = iterator.next();
+            visit( temp );
+
+            if ( previous == null ) {
+                descrString += this.template;
+            } else if ( previous instanceof FieldBindingDescr && !(temp instanceof FieldBindingDescr) && !(temp instanceof PredicateDescr) ) {
+                final FieldConstraintDescr tempDescr = (FieldConstraintDescr) temp;
+                final FieldBindingDescr previousDescr = (FieldBindingDescr) previous;
+                if ( tempDescr.getFieldName().equals( previousDescr.getFieldName() ) ) {
+                    // as its a binding followed by a field constraint we need to remove 
+                    // the extra field name                    
+                    descrString += this.template.substring( tempDescr.getFieldName().length() + 1 );
+                } else {
+                    descrString += " , " + this.template;
+                }
+            } else {
+                descrString += " , " + this.template;
+            }
+
+            previous = temp;
+
+        }
+        return descrString.substring( 0,
+                                      descrString.length() );
+    }
+
+    private String processFieldConstraint(final RestrictionConnectiveDescr restriction,
+                                          boolean addBrackets) {
+        String descrString = "";
+        String connective = "";
+        boolean bracketTmp = this.needsBracket;
+        this.needsBracket = restriction.getRestrictions().size() > 1;
+
+        if ( restriction.getConnective() == RestrictionConnectiveDescr.OR ) {
+            connective = " || ";
+        } else {
+            connective = " && ";
+        }
+        if ( addBrackets && bracketTmp ) {
+            descrString += "( ";
+        }
+        for ( final Iterator it = restriction.getRestrictions().iterator(); it.hasNext(); ) {
+            final Object temp = it.next();
+            visit( temp );
+            descrString += this.template;
+            if ( it.hasNext() ) {
+                descrString += connective;
+            }
+        }
+        if ( addBrackets && bracketTmp ) {
+            descrString += " )";
+        }
+        this.needsBracket = bracketTmp;
+        return descrString;
+    }
+
+    private String processDescrList(final List descr) {
+        String descrString = "";
+        for ( final Iterator ite = descr.iterator(); ite.hasNext(); ) {
+
+            Object obj = ite.next();
+
+            visit( obj );
+            descrString += this.template;
+
+            if ( obj.getClass().equals( PatternDescr.class ) || obj.getClass().equals( CollectDescr.class ) ) {
+                descrString += DrlDumper.eol;
+            } else if ( ite.hasNext() ) {
+                descrString += " && ";
+            }
+        }
+        return descrString;
+    }
+
+    private String processFunctionsList(final List functions) {
+        String functionList = "";
+
+        for ( final Iterator it = functions.iterator(); it.hasNext(); ) {
+            visit( it.next() );
+            functionList += this.template;
+        }
+
+        return functionList + DrlDumper.eol;
+    }
+
+    private String processAttribute(final List attributes) {
+
+        String attributeList = "";
+        for ( final Iterator it = attributes.iterator(); it.hasNext(); ) {
+            final AttributeDescr attributeDescr = (AttributeDescr) it.next();
+            visit( attributeDescr );
+            attributeList += this.template;
+        }
+        return attributeList;
+    }
+
+    private String processParameters(final List parameterNames,
+                                     final List parameterTypes) {
+        if ( parameterNames.isEmpty() ) {
+            return "";
+        }
+
+        String paramList = "";
+        int i = 0;
+        for ( final Iterator it = parameterNames.iterator(); it.hasNext(); i++ ) {
+            final String paramName = (String) it.next();
+            final String paramType = (String) parameterTypes.get( i );
+            final String paramTemplate = paramType + " " + paramName + ",";
+            paramList += paramTemplate;
+        }
+        paramList = paramList.substring( 0,
+                                         paramList.length() - 1 );
+        return paramList;
+    }
+
+    private String processGlobalsList(final List globals) {
+        String globalList = "";
+
+        for ( final Iterator it = globals.iterator(); it.hasNext(); ) {
+            final GlobalDescr global = (GlobalDescr) it.next();
+            final String identifier = global.getIdentifier();
+            final String type = global.getType();
+            final String globalTemplate = "global " + type + " " + identifier + ";" + DrlDumper.eol;
+            globalList += globalTemplate;
+        }
+
+        return globalList + DrlDumper.eol;
+    }
+    
+    private String processFunctionImportsList(final List imports) {
+        String importList = "";
+
+        for ( final Iterator it = imports.iterator(); it.hasNext(); ) {
+            final String importString = ((FunctionImportDescr) it.next()).getTarget();
+            final String importTemplate = "import function " + importString + ";" + DrlDumper.eol;
+            importList += importTemplate;
+        }
+        return importList + DrlDumper.eol;
+    }
+
+    private String processImportsList(final List imports) {
+        String importList = "";
+
+        for ( final Iterator it = imports.iterator(); it.hasNext(); ) {
+            final ImportDescr importDescr = (ImportDescr) it.next(); 
+            final String importTemplate = "import " + importDescr.getTarget() + ";" + DrlDumper.eol;
+            importList += importTemplate;
+        }
+        return importList + DrlDumper.eol;
+    }
+
+    private void appendDrlDump(final String temp) {
+        this.drlDump.append( temp );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Expander.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Expander.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Expander.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+package org.drools.lang;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import org.drools.lang.dsl.DSLMapping;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Expanders are extension points for expanding 
+ * expressions in DRL at parse time.
+ * This is just-in-time translation, or macro expansion, or
+ * whatever you want.
+ * 
+ * The important thing is that it happens at the last possible moment, 
+ * so any errors in expansion are included in the parsers errors.
+ * 
+ * Just-in-time expansions may include complex pre-compilers, 
+ * or just macros, and everything in between.
+ * 
+ * Expanders should ideally not make presumptions on any embedded semantic 
+ * language. For instance, java aware pre processing should be done in
+ * drools-java semantic module, not in the parser itself. Expanders should 
+ * be reusable across semantic languages. 
+ * 
+ * @author Michael Neale
+ *
+ */
+public interface Expander {
+
+    /**
+     * Expands (process) the expression Just-In-Time for the parser.
+     * If the source is not meant to be expanded, or if no
+     * appropriate match was found for expansion, it will echo back 
+     * the same expression.
+     * 
+     * @param drl the source code to be pre-processed
+     * @return source code after running pre-processors
+     */
+    public String expand(Reader drl) throws IOException;
+
+    /**
+     * Expands (process) the expression Just-In-Time for the parser.
+     * If the source is not meant to be expanded, or if no
+     * appropriate match was found for expansion, it will echo back 
+     * the same expression.
+     * 
+     * @param source the source code to be expanded
+     * @return source code after running pre-processors
+     */
+    public String expand(String source);
+
+    /**
+     * Add the new mapping to this expander.
+     * @param mapping
+     */
+    public void addDSLMapping(DSLMapping mapping);
+
+    /**
+     * Returns the list of errors from the last expansion made
+     * @return A list of <code>ExpanderException</code>
+     */
+    public List getErrors();
+
+    /**
+     * Returns true in case the last expansion had any errors
+     * @return
+     */
+    public boolean hasErrors();
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderException.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderException.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderException.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.lang;
+
+import org.drools.compiler.DroolsError;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ExpanderException extends DroolsError {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+
+    private String            message;
+    private int[]             line;
+
+    public ExpanderException(final String message,
+                             final int line) {
+        this.message = message;
+        this.line = new int[] { line };
+    }
+    
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    public String getMessage() {
+        return "[" + this.line[0] + "] " + this.message;
+    }
+    
+    public int getLine() {
+        return this.line[0];
+    }
+    
+    public String toString() { 
+        return this.getMessage();
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderResolver.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderResolver.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ExpanderResolver.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface ExpanderResolver {
+
+    Expander get(String name,
+                 String config);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/GeneralParseException.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/GeneralParseException.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/GeneralParseException.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,39 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.antlr.runtime.RecognitionException;
+
+public class GeneralParseException extends RecognitionException {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private String            message;
+
+    public GeneralParseException(final String message,
+                                 final int line) {
+        this.message = message;
+        this.line = line;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Location.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Location.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/Location.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on May 22, 2007
+ */
+package org.drools.lang;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A class to hold contextual information during DRL parsing
+ * 
+ * @author etirelli, krisv
+ */
+public class Location {
+    
+    public static final int LOCATION_UNKNOWN = 0;
+    
+    public static final int LOCATION_LHS_BEGIN_OF_CONDITION = 1;
+    public static final int LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS = 2;
+    public static final int LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR = 3;
+    public static final int LOCATION_LHS_BEGIN_OF_CONDITION_NOT = 4;
+    
+    public static final int LOCATION_LHS_INSIDE_CONDITION_START = 100;
+    public static final int LOCATION_LHS_INSIDE_CONDITION_OPERATOR = 101;
+    public static final int LOCATION_LHS_INSIDE_CONDITION_ARGUMENT = 102;
+    public static final int LOCATION_LHS_INSIDE_CONDITION_END = 103;
+
+    public static final int LOCATION_LHS_INSIDE_EVAL = 200;
+    
+    public static final int LOCATION_LHS_FROM = 300;
+    public static final int LOCATION_LHS_FROM_COLLECT = 301;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE = 302;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_INIT = 303;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_INIT_INSIDE = 304;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_ACTION = 305;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_ACTION_INSIDE = 306;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_REVERSE = 307;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_REVERSE_INSIDE = 308;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_RESULT = 309;
+    public static final int LOCATION_LHS_FROM_ACCUMULATE_RESULT_INSIDE = 310;
+    public static final int LOCATION_LHS_FROM_ENTRY_POINT = 311;
+    
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW = 401;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_WINDOWSIZE = 402;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_INIT = 403;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_INIT_INSIDE = 404;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_ACTION = 405;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_ACTION_INSIDE = 406;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_REVERSE = 407;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_REVERSE_INSIDE = 408;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_RESULT = 409;
+    public static final int LOCATION_LHS_FROM_TIMEWINDOW_RESULT_INSIDE = 410;  
+    
+    public static final int LOCATION_RHS = 1000;
+    public static final int LOCATION_RULE_HEADER = 2000;
+    
+    public static final String LOCATION_PROPERTY_CLASS_NAME = "ClassName";
+    public static final String LOCATION_PROPERTY_PROPERTY_NAME = "PropertyName";
+    public static final String LOCATION_PROPERTY_OPERATOR = "Operator";
+    public static final String LOCATION_EVAL_CONTENT = "EvalContent";
+    public static final String LOCATION_FROM_CONTENT = "FromContent";
+    public static final String LOCATION_PROPERTY_FROM_ACCUMULATE_INIT_CONTENT = "FromAccumulateInitContent";
+    public static final String LOCATION_PROPERTY_FROM_ACCUMULATE_ACTION_CONTENT = "FromAccumulateActionContent";
+    public static final String LOCATION_PROPERTY_FROM_ACCUMULATE_REVERSE_CONTENT = "FromAccumulateReverseContent";
+    public static final String LOCATION_PROPERTY_FROM_ACCUMULATE_RESULT_CONTENT = "FromAccumulateResultContent";
+    public static final String LOCATION_PROPERTY_FROM_ACCUMULATE_EXPRESSION_CONTENT = "FromAccumulateExpressionContent";
+    public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_INIT_CONTENT = "FromTimeWindowInitContent";
+    public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_ACTION_CONTENT = "FromTimeWindowActionContent";
+    public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_REVERSE_CONTENT = "FromTimeWindowReverseContent";
+    public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_RESULT_CONTENT = "FromTimeWindowResultContent";
+    public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_EXPRESSION_CONTENT = "FromTimeWindowExpressionContent";
+    //public static final String LOCATION_PROPERTY_FROM_TIMEWINDOW_WINDOWSIZE_CONTENT = "FromTimeWindowWindowSizeContent";
+    public static final String LOCATION_LHS_CONTENT = "LHSContent";
+    public static final String LOCATION_RHS_CONTENT = "RHSContent";
+    public static final String LOCATION_HEADER_CONTENT = "HeaderContent";
+    
+	private int type;
+	private Map properties = new HashMap();
+	
+	public Location(int type) {
+		this.type = type;
+	}
+	
+	public int getType() {
+		return type;
+	}
+	
+	public void setProperty(String name, Object value) {
+		properties.put(name, value);
+	}
+	
+	public Object getProperty(String name) {
+		return properties.get(name);
+	}
+	
+	public void setType(int type) {
+		this.type = type;
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/MVELDumper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/MVELDumper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/MVELDumper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,178 @@
+package org.drools.lang;
+
+/*
+ * Author Jayaram C S
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Iterator;
+
+import org.drools.base.evaluators.Operator;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.util.ReflectiveVisitor;
+
+/**
+ * 
+ * @author <a href="mailto:jayaramcs at gmail.com">Author Jayaram C S</a>
+ *
+ */
+public class MVELDumper extends ReflectiveVisitor {
+
+    private StringBuffer        mvelDump;
+    private static final String eol = System.getProperty( "line.separator" );
+    private String              template;
+    private String              fieldName;
+
+    public String dump(FieldConstraintDescr fieldConstr) {
+        mvelDump = new StringBuffer();
+        this.visit( fieldConstr );
+        return mvelDump.toString();
+    }
+
+    public void visitFieldConstraintDescr(final FieldConstraintDescr descr) {
+        if ( !descr.getRestrictions().isEmpty() ) {
+            this.fieldName = descr.getFieldName();
+            mvelDump.append( processFieldConstraint( descr.getRestriction() ) );
+        }
+    }
+
+    public void visitVariableRestrictionDescr(final VariableRestrictionDescr descr) {
+        this.template = processRestriction( descr.getEvaluator(), descr.isNegated(), descr.getIdentifier() );
+    }
+
+    public void visitFieldBindingDescr(final FieldBindingDescr descr) {
+        // do nothing
+    }
+
+    public void visitLiteralRestrictionDescr(final LiteralRestrictionDescr descr) {
+        String text = descr.getText();
+        if ( text == null || descr.getType() == LiteralRestrictionDescr.TYPE_NULL ) {
+            text = "null";
+        } else if( descr.getType() == LiteralRestrictionDescr.TYPE_NUMBER ) {
+            try {
+                Integer.parseInt( text );
+            } catch ( final NumberFormatException e ) {
+                text = "\"" + text + "\"";
+            }
+        } else if( descr.getType() == LiteralRestrictionDescr.TYPE_STRING ) {
+            text = "\"" + text + "\"";
+        }
+        this.template = processRestriction( descr.getEvaluator(), descr.isNegated(), text );
+    }
+
+    public void visitQualifiedIdentifierRestrictionDescr(final QualifiedIdentifierRestrictionDescr descr) {
+        this.template = processRestriction( descr.getEvaluator(), descr.isNegated(), descr.getText() );
+    }
+
+    public void visitRestrictionConnectiveDescr(final RestrictionConnectiveDescr descr) {
+        this.template = "( " + this.processFieldConstraint( descr ) + " )";
+    }
+
+    public void visitPredicateDescr(final PredicateDescr descr) {
+        this.template = "eval( " + descr.getContent() + " )";
+    }
+
+    public void visitReturnValueRestrictionDescr(final ReturnValueRestrictionDescr descr) {
+        this.template = processRestriction( descr.getEvaluator(), descr.isNegated(),  "( "+descr.getContent().toString()+" )" );
+    }
+
+    private String processFieldConstraint(final RestrictionConnectiveDescr restriction) {
+        String descrString = "";
+        String connective = null;
+
+        if ( restriction.getConnective() == RestrictionConnectiveDescr.OR ) {
+            connective = " || ";
+        } else {
+            connective = " && ";
+        }
+        for ( final Iterator it = restriction.getRestrictions().iterator(); it.hasNext(); ) {
+            final Object temp = it.next();
+            visit( temp );
+            descrString += this.template;
+            if ( it.hasNext() ) {
+                descrString += connective;
+            }
+        }
+        return descrString;
+    }
+
+    private String processRestriction(String evaluator,
+                                      boolean isNegated,
+                                      String value) {
+        Operator op = Operator.determineOperator( evaluator, isNegated );
+        if( op == Operator.determineOperator( "memberOf", false ) ) {
+            evaluator = "contains";
+            return evaluatorPrefix( evaluator ) + 
+                   value + " " + 
+                   evaluator( evaluator ) + " " + 
+                   this.fieldName + evaluatorSufix( evaluator );
+        } else if(op == Operator.determineOperator( "memberOf", true )) {
+            evaluator = "not contains";
+            return evaluatorPrefix( evaluator ) + 
+                   value + " " + 
+                   evaluator( evaluator ) + " " + 
+                   this.fieldName + evaluatorSufix( evaluator );
+        } else if(op == Operator.determineOperator( "excludes", false ) ) {
+            evaluator = "not contains";
+            return evaluatorPrefix( evaluator ) + 
+                   this.fieldName + " " + 
+                   evaluator( evaluator ) + " " + 
+                   value + evaluatorSufix( evaluator );
+        } else if(op == Operator.determineOperator( "matches", false )) {
+            evaluator = "~=";
+            return evaluatorPrefix( evaluator ) + 
+                   this.fieldName + " " + 
+                   evaluator( evaluator ) + " " + 
+                   value.replaceAll( "\\\\", "\\\\\\\\" ) + evaluatorSufix( evaluator );
+        } else if(op == Operator.determineOperator( "matches", true )) {
+            evaluator = "not ~=";
+            return evaluatorPrefix( evaluator ) + 
+                   this.fieldName + " " + 
+                   evaluator( evaluator ) + " " + 
+                   value.replaceAll( "\\\\", "\\\\\\\\" ) + evaluatorSufix( evaluator );
+        }
+        return evaluatorPrefix( evaluator ) + 
+               this.fieldName + " " + 
+               evaluator( evaluator ) + " " + 
+               value + evaluatorSufix( evaluator );
+    }
+
+    private String evaluatorPrefix(String evaluator) {
+        if ( evaluator.startsWith( "not" ) ) {
+            return "!( ";
+        }
+        return "";
+    }
+
+    private String evaluator(String evaluator) {
+        if ( evaluator.startsWith( "not" ) ) {
+            return evaluator.substring( 4 );
+        }
+        return evaluator;
+    }
+
+    private String evaluatorSufix(String evaluator) {
+        if ( evaluator.startsWith( "not" ) ) {
+            return " )";
+        }
+        return "";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ParseException.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ParseException.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/ParseException.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.RuntimeDroolsException;
+
+public class ParseException extends RuntimeDroolsException {
+
+    private static final long serialVersionUID = 400L;
+
+    private int               lineNumber;
+
+    private Throwable         cause;
+
+    /**
+     * Thrown if there is an exception related to parsing a line in a drl file.
+     * For more generic exception, a different exception class will be used.
+     */
+    public ParseException(final String message,
+                          final int lineNumber) {
+        super( message );
+        this.lineNumber = lineNumber;
+    }
+
+    /**
+     * Allows nesting of misc exceptions, yet preserving the line number
+     * that triggered the error.
+     */
+    public ParseException(final String message,
+                          final int lineNumber,
+                          final Throwable cause) {
+        super( message );
+        this.lineNumber = lineNumber;
+        this.cause = cause;
+    }
+
+    /**
+     * The line number on which the error occurred.
+     */
+    public int getLineNumber() {
+        return this.lineNumber;
+    }
+
+    /**
+     * This will print out a summary, including the line number. 
+     * It will also print out the cause message if applicable.
+     */
+    public String getMessage() {
+        if ( this.cause == null ) {
+            return super.getMessage() + " Line number: " + this.lineNumber;
+        } else {
+            return super.getMessage() + " Line number: " + this.lineNumber + ". Caused by: " + this.cause.getMessage();
+        }
+    }
+
+    public String toString() {
+        return getMessage();
+    }
+
+    public Throwable getCause() {
+        return this.cause;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccessorDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccessorDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccessorDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,60 @@
+package org.drools.lang.descr;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+public class AccessorDescr extends DeclarativeInvokerDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private String            variableName;
+    private LinkedList        invokers;
+
+    public AccessorDescr() {
+        this( null );
+    }
+
+    public AccessorDescr(final String rootVariableName) {
+        super();
+        this.variableName = rootVariableName;
+        this.invokers = new LinkedList();
+    }
+
+    public DeclarativeInvokerDescr[] getInvokersAsArray() {
+        return (DeclarativeInvokerDescr[]) this.invokers.toArray( new DeclarativeInvokerDescr[0] );
+    }
+
+    public List getInvokers() {
+        return this.invokers;
+    }
+
+    public void addInvoker(final DeclarativeInvokerDescr accessor) {
+        this.invokers.add( accessor );
+    }
+
+    public void addFirstInvoker(final DeclarativeInvokerDescr accessor) {
+        this.invokers.addFirst( accessor );
+    }
+
+    public String getVariableName() {
+        return this.variableName;
+    }
+
+    public void setVariableName(final String methodName) {
+        this.variableName = methodName;
+    }
+
+    public String toString() {
+        final StringBuffer buf = new StringBuffer();
+        buf.append( (this.variableName != null) ? this.variableName : "" );
+        for ( final Iterator it = this.invokers.iterator(); it.hasNext(); ) {
+            if ( buf.length() > 0 ) {
+                buf.append( "." );
+            }
+            buf.append( it.next().toString() );
+        }
+        return buf.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccumulateDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccumulateDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AccumulateDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * A descr class for accumulate node
+ */
+public class AccumulateDescr extends PatternSourceDescr
+    implements
+    ConditionalElementDescr,
+    PatternDestinationDescr,
+    MultiPatternDestinationDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private BaseDescr         input;
+    private String            initCode;
+    private String            actionCode;
+    private String            reverseCode;
+    private String            resultCode;
+    private String[]          declarations;
+    private String            className;
+    private boolean           externalFunction = false;
+    private String            functionIdentifier;
+    private String            expression;
+    
+    public int getLine() {
+        return this.input.getLine();
+    }
+
+    public String getClassName() {
+        return this.className;
+    }
+
+    public void setClassName(final String classMethodName) {
+        this.className = classMethodName;
+    }
+
+    public String[] getDeclarations() {
+        return this.declarations;
+    }
+
+    public void setDeclarations(final String[] declarations) {
+        this.declarations = declarations;
+    }
+
+    public String getActionCode() {
+        return this.actionCode;
+    }
+
+    public void setActionCode(final String actionCode) {
+        this.actionCode = actionCode;
+    }
+
+    public String getInitCode() {
+        return this.initCode;
+    }
+
+    public void setInitCode(final String initCode) {
+        this.initCode = initCode;
+    }
+
+    public String getResultCode() {
+        return this.resultCode;
+    }
+
+    public void setResultCode(final String resultCode) {
+        this.resultCode = resultCode;
+    }
+
+    public String toString() {
+        return "[Accumulate: input=" + this.input.toString() + "]";
+    }
+
+    public void addDescr(final BaseDescr patternDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    public List getDescrs() {
+        // nothing to do
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    public String getReverseCode() {
+        return reverseCode;
+    }
+
+    public void setReverseCode(String reverseCode) {
+        this.reverseCode = reverseCode;
+    }
+
+    public boolean isExternalFunction() {
+        return externalFunction;
+    }
+
+    public void setExternalFunction(boolean externalFunction) {
+        this.externalFunction = externalFunction;
+    }
+
+    public String getExpression() {
+        return expression;
+    }
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    public String getFunctionIdentifier() {
+        return functionIdentifier;
+    }
+
+    public void setFunctionIdentifier(String functionIdentifier) {
+        this.functionIdentifier = functionIdentifier;
+    }
+
+    public PatternDescr getInputPattern() {
+        if( isSinglePattern() ) {
+            return (PatternDescr) this.input;
+        }
+        return null;
+    }
+
+    public void setInputPattern(final PatternDescr inputPattern) {
+        this.input = inputPattern;
+    }
+
+    public BaseDescr getInput() {
+        return input;
+    }
+
+    public void setInput(BaseDescr input) {
+        this.input = input; 
+    }
+    
+    public boolean isSinglePattern() {
+        return this.input instanceof PatternDescr; 
+    }
+
+    public boolean isMultiPattern() {
+        return ! ( this.input instanceof PatternDescr ); 
+    }
+
+    public boolean hasValidInput() {
+        // TODO: need to check that there are no OR occurences 
+        return this.input != null;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ActionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ActionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ActionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools.lang.descr;
+
+public class ActionDescr extends BaseDescr {
+    private String text;
+    
+    public ActionDescr() {
+        
+    }
+    
+    public ActionDescr(String text) {
+        super();
+        this.text = text;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AndDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AndDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AndDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,66 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AndDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private List              descrs           = new ArrayList();
+
+    public AndDescr() {
+    }
+
+    public void addDescr(final BaseDescr baseDescr) {
+        this.descrs.add( baseDescr );
+    }
+
+    public void insertDescr(int index,
+                            final BaseDescr baseDescr) {
+        this.descrs.add( index,
+                         baseDescr );
+    }
+
+    public void insertBeforeLast(final Class clazz,
+                                 final BaseDescr baseDescr) {
+        for ( int i = this.descrs.size() - 1; i >= 0; i-- ) {
+            if ( clazz.isInstance( this.descrs.get( i ) ) ) {
+                insertDescr( i,
+                             baseDescr );
+                return;
+            }
+        }
+    }
+
+    public List getDescrs() {
+        return this.descrs;
+    }
+
+    public void addOrMerge(final BaseDescr baseDescr) {
+        if ( baseDescr instanceof AndDescr ) {
+            this.descrs.addAll( ((AndDescr) baseDescr).getDescrs() );
+        } else {
+            addDescr( baseDescr );
+        }
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AttributeDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AttributeDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/AttributeDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class AttributeDescr extends BaseDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private String            name;
+    private String            value;
+    
+    public AttributeDescr(final String name ) {
+        this.name = name;
+    }
+
+    public AttributeDescr(final String name,
+                          final String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+    
+    public void setValue(final String value) {
+        this.value = value;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/BaseDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/BaseDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/BaseDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+/**
+ * This is the super type for all pattern AST nodes.
+ */
+public class BaseDescr
+    implements
+    Serializable {
+
+    private static final long serialVersionUID = 400L;
+    private int               startCharacter   = -1;
+    private int               endCharacter     = -1;
+    private int               line             = -1;
+    private int               column           = -1;
+    private int               endLine          = -1;
+    private int               endColumn        = -1;
+    private String            text             = "";
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public void setLocation(final int line,
+                            final int column) {
+        this.line = line;
+        this.column = column;
+    }
+
+    public void setEndLocation(final int line,
+                               final int column) {
+        this.endLine = line;
+        this.endColumn = column;
+    }
+
+    public int getLine() {
+        return this.line;
+    }
+
+    public int getColumn() {
+        return this.column;
+    }
+
+    public int getEndLine() {
+        return this.endLine;
+    }
+
+    public int getEndColumn() {
+        return this.endColumn;
+    }
+
+    /**
+     * @return the endCharacter
+     */
+    public int getEndCharacter() {
+        return this.endCharacter;
+    }
+
+    /**
+     * @param endCharacter the endCharacter to set
+     */
+    public void setEndCharacter(final int endCharacter) {
+        this.endCharacter = endCharacter;
+    }
+
+    /**
+     * @return the startCharacter
+     */
+    public int getStartCharacter() {
+        return this.startCharacter;
+    }
+
+    /**
+     * @param startCharacter the startCharacter to set
+     */
+    public void setStartCharacter(final int startCharacter) {
+        this.startCharacter = startCharacter;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/CollectDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/CollectDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/CollectDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An AST class to describe "collect" conditional element
+ * 
+ * @author etirelli
+ *
+ */
+public class CollectDescr extends PatternSourceDescr
+    implements
+    ConditionalElementDescr,
+    PatternDestinationDescr
+    {
+
+    private static final long  serialVersionUID = 400L;
+
+    private PatternDescr       inputPattern;
+    private String             classMethodName;
+
+    public int getLine() {
+        return this.inputPattern.getLine();
+    }
+
+    public String getClassMethodName() {
+        return this.classMethodName;
+    }
+
+    public void setClassMethodName(final String classMethodName) {
+        this.classMethodName = classMethodName;
+    }
+
+    public String toString() {
+        return "[Collect: input=" + this.inputPattern.getIdentifier() + "; objectType=" + this.inputPattern.getObjectType() + "]";
+    }
+
+    public void addDescr(final BaseDescr patternDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }    
+
+    public List getDescrs() {
+        // nothing to do
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    public PatternDescr getInputPattern() {
+        return this.inputPattern;
+    }
+
+    public void setInputPattern(final PatternDescr inputPattern) {
+        this.inputPattern = inputPattern;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ConditionalElementDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ConditionalElementDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ConditionalElementDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+public interface ConditionalElementDescr {
+
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr );
+    
+    public void addDescr(BaseDescr baseDescr);
+    
+    public void addOrMerge(final BaseDescr baseDescr);
+    
+    public List getDescrs();
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DeclarativeInvokerDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DeclarativeInvokerDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DeclarativeInvokerDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools.lang.descr;
+
+/**
+ * This is the parent class function/method calls.
+ */
+public class DeclarativeInvokerDescr extends BaseDescr {
+    private static final long serialVersionUID = 400L;
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DescrFactory.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DescrFactory.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/DescrFactory.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,75 @@
+package org.drools.lang.descr;
+
+/**
+ * This is the factory for ALL descriptors (eventually).
+ * This will be tied in a with a package builder session, so it can add in context information for 
+ * validation when parsing.
+ * 
+ * @author Michael Neale
+ *
+ */
+public class DescrFactory {
+
+    public PackageDescr createPackage(final String packageName) {
+        return new PackageDescr( packageName );
+    }
+
+    public GlobalDescr createGlobal() {
+        return new GlobalDescr();
+    }
+
+    public FromDescr createFrom() {
+        return new FromDescr();
+    }
+
+    public AccumulateDescr createAccumulate() {
+        return new AccumulateDescr();
+    }
+    
+    public TimeWindowDescr createTimeWindow() {
+        return new TimeWindowDescr();
+    }
+
+    public CollectDescr createCollect() {
+        return new CollectDescr();
+    }
+
+    public ForallDescr createForall() {
+        return new ForallDescr();
+    }
+
+    public ImportDescr createImport() {
+        return new ImportDescr();
+    }
+
+    public FunctionImportDescr createFunctionImport() {
+        return new FunctionImportDescr();
+    }
+
+    public QueryDescr createQuery(final String queryName) {
+        return new QueryDescr( queryName,
+                               "" );
+    }
+
+    public FunctionDescr createFunction(final String functionName,
+                                        final String returnType) {
+        return new FunctionDescr( functionName,
+                                  returnType );
+    }
+
+    public FactTemplateDescr createFactTemplate(final String templateName) {
+        return new FactTemplateDescr( templateName );
+    }
+
+    public FieldTemplateDescr createFieldTemplate() {
+        return new FieldTemplateDescr();
+    }
+
+    public EntryPointDescr createEntryPoint() {
+        return new EntryPointDescr();
+    }
+    
+    public TypeDeclarationDescr createTypeDeclaration() {
+        return new TypeDeclarationDescr();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EntryPointDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EntryPointDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EntryPointDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Dec 13, 2007
+ */
+package org.drools.lang.descr;
+
+/**
+ * An entry point descriptor for facts. This is part of the
+ * support to multi-stream concurrent event assertion.
+ * 
+ * @author etirelli
+ */
+public class EntryPointDescr extends PatternSourceDescr {
+
+    private static final long serialVersionUID = 1765353532342L;
+    
+    public EntryPointDescr() {
+    }
+    
+    public EntryPointDescr( String id ) {
+        this.setText( id );
+    }
+    
+    public void setEntryId( String id ) {
+        this.setText( id );
+    }
+    
+    public String getEntryId() {
+        return this.getText();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvalDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvalDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvalDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public class EvalDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+
+    private Object            content;
+
+    private String[]          declarations;
+
+    private String            classMethodName;
+
+    public EvalDescr() {
+    }
+
+    public EvalDescr(final Object content) {
+        this.content = content;
+    }
+
+    public Object getContent() {
+        return this.content;
+    }
+
+    public void setContent(final Object content) {
+        this.content = content;
+    }
+
+    public String getClassMethodName() {
+        return this.classMethodName;
+    }
+
+    public void setClassMethodName(final String classMethodName) {
+        this.classMethodName = classMethodName;
+    }
+
+    public void setDeclarations(final String[] declarations) {
+        this.declarations = declarations;
+    }
+
+    public String[] getDeclarations() {
+        return this.declarations;
+    }
+
+    public List getDescrs() {
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addDescr(final BaseDescr baseDescr) {
+        throw new UnsupportedOperationException("Can't add descriptors to "+this.getClass().getName());        
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }    
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        throw new UnsupportedOperationException("Can't add descriptors to "+this.getClass().getName());        
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvaluatorBasedRestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvaluatorBasedRestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/EvaluatorBasedRestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Dec 1, 2007
+ */
+package org.drools.lang.descr;
+
+/**
+ * This is a super class for all restrictions that are based on
+ * evaluators.
+ * 
+ * @author etirelli
+ */
+public class EvaluatorBasedRestrictionDescr extends RestrictionDescr {
+
+    private static final long serialVersionUID = -9051550222783766557L;
+
+    private String            evaluator;
+    private boolean           negated;
+    private String            parameterText;
+
+    /**
+     * Creates a new EvaluatorBasedRestriction
+     * 
+     * @param evaluator the evaluator ID to be used in this restriction
+     * @param isNegated true if the evaluator is boolean negated
+     * @param parameterText the parameter text, in case there is any. null otherwise.
+     */
+    public EvaluatorBasedRestrictionDescr(final String evaluator,
+                                          final boolean isNegated,
+                                          final String parameterText) {
+        this.evaluator = evaluator;
+        this.negated = isNegated;
+        this.parameterText = parameterText;
+
+    }
+
+    /**
+     * Returns the evaluator ID for this restriction
+     * @return
+     */
+    public String getEvaluator() {
+        return this.evaluator;
+    }
+
+    /**
+     * Returns true if this evaluator is boolean negated.
+     * Example: "contains" is boolean negated if you want to check the elements that are not contained ("not contains")
+     * 
+     * @return the negated
+     */
+    public boolean isNegated() {
+        return negated;
+    }
+
+    /**
+     * In case there is any parameter text, this method returns it. Returns null otherwise.
+     * A parameter text is evaluator parameters like "after[1,10]". In the previous example,
+     * the parameter text will be "1,10".
+     * 
+     * @return the parameterText
+     */
+    public String getParameterText() {
+        return parameterText;
+    }
+    
+    public String toString() {
+        return ( this.isNegated() ? "not " : "" ) + this.getEvaluator() + ( this.getParameterText() != null ? "["+this.getParameterText()+"]" : "");
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ExistsDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ExistsDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ExistsDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,59 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExistsDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private final List        descrs           = new ArrayList( 1 );
+
+    public ExistsDescr() {
+    }
+
+    public ExistsDescr(final BaseDescr baseDescr) {
+        addDescr( baseDescr );
+    }
+
+    public void addDescr(final BaseDescr baseDescr) {
+        this.descrs.add( baseDescr );
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }    
+
+    public List getDescrs() {
+        return this.descrs;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        if( baseDescr instanceof ExistsDescr ) {
+            this.descrs.addAll( ((ExistsDescr)baseDescr).getDescrs() ); 
+        } else {
+            this.descrs.add( baseDescr );        
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FactTemplateDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FactTemplateDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FactTemplateDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+package org.drools.lang.descr;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FactTemplateDescr extends BaseDescr {
+    private static final long serialVersionUID = 400L;
+
+    String                    name;
+    List                      fields           = new ArrayList( 1 );
+
+    public FactTemplateDescr(final String name) {
+        this.name = name;
+    }
+
+    public void addFieldTemplate(final FieldTemplateDescr fieldTemplate) {
+        this.fields.add( fieldTemplate );
+    }
+
+    public List getFields() {
+        return this.fields;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldAccessDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldAccessDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldAccessDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.lang.descr;
+
+/**
+ * This represents direct field access.
+ * Not a whole lot different from what you can do with the method access,
+ * but in this case it is just a field by name (same as in a pattern).
+ *
+ *
+ * eg: foo.bar
+ */
+public class FieldAccessDescr extends DeclarativeInvokerDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private String            fieldName;
+    private String            argument;
+
+    public FieldAccessDescr(final String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public FieldAccessDescr(final String fieldName,
+                            final String argument) {
+        this.fieldName = fieldName;
+        this.argument = argument;
+    }
+
+    public String getFieldName() {
+        return this.fieldName;
+    }
+
+    public void setFieldName(final String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public String getArgument() {
+        return this.argument;
+    }
+
+    public void setArgument(final String argument) {
+        this.argument = argument;
+    }
+
+    public String toString() {
+        return this.fieldName + ((this.argument != null) ? this.argument : "");
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldBindingDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldBindingDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldBindingDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,58 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class FieldBindingDescr extends BaseDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private String            fieldName;
+    private String            identifier;
+
+    public FieldBindingDescr() {
+        this( null,
+              null );
+    }
+
+    public FieldBindingDescr(final String fieldName,
+                             final String identifier) {
+        this.fieldName = fieldName;
+        this.identifier = identifier;
+    }
+
+    public void setFieldName(final String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public void setIdentifier(final String identifier) {
+        this.identifier = identifier;
+    }
+
+    public String getFieldName() {
+        return this.fieldName;
+    }
+
+    public String getIdentifier() {
+        return this.identifier;
+    }
+
+    public String toString() {
+        return "[FieldBinding: field=" + this.fieldName + "; identifier=" + this.identifier + "]";
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldConstraintDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldConstraintDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldConstraintDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,52 @@
+package org.drools.lang.descr;
+
+import java.util.List;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This represents a literal node in the rule language. This is
+ * a constraint on a single field of a pattern. 
+ * The "text" contains the content, which may also be an enumeration. 
+ */
+public class FieldConstraintDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+    private String            fieldName;
+    private RestrictionConnectiveDescr restriction     = new RestrictionConnectiveDescr( RestrictionConnectiveDescr.AND );
+
+    public FieldConstraintDescr(final String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public String getFieldName() {
+        return this.fieldName;
+    }
+
+    public void addRestriction(final RestrictionDescr restriction) {
+        this.restriction.addRestriction( restriction );
+    }
+
+    public List getRestrictions() {
+        return this.restriction.getRestrictions();
+    }
+    
+    public RestrictionConnectiveDescr getRestriction() {
+        return this.restriction;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldTemplateDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldTemplateDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FieldTemplateDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+package org.drools.lang.descr;
+
+public class FieldTemplateDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+    private String            name;
+    private String            classType;
+
+    public FieldTemplateDescr() {
+        this( null,
+              null );
+    }
+
+    public FieldTemplateDescr(final String name,
+                              final String type) {
+        super();
+        this.name = name;
+        this.classType = type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getClassType() {
+        return this.classType;
+    }
+
+    /**
+     * @param classType the classType to set
+     */
+    public void setClassType(final String classType) {
+        this.classType = classType;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ForallDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ForallDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ForallDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author etirelli
+ *
+ */
+public class ForallDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+
+    private static final long   serialVersionUID = 400L;
+
+    private static final String BASE_IDENTIFIER  = "$__forallBaseIdentifier";
+
+    private List<BaseDescr>     patterns;
+
+    public ForallDescr() {
+        this.patterns = new ArrayList<BaseDescr>( 2 );
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.lang.descr.ConditionalElementDescr#addDescr(org.drools.lang.descr.BaseDescr)
+     */
+    public void addDescr(final BaseDescr baseDescr) {
+        // cast to make sure we are adding a pattern descriptor
+        this.patterns.add( baseDescr );
+    }
+
+    public void insertBeforeLast(final Class clazz,
+                                 final BaseDescr baseDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.lang.descr.ConditionalElementDescr#getDescrs()
+     */
+    public List getDescrs() {
+        return this.patterns;
+    }
+
+    /**
+     * Returns the base pattern from the forall CE
+     * @return
+     */
+    public PatternDescr getBasePattern() {
+        if ( this.patterns.size() > 1 ) {
+            return (PatternDescr) this.patterns.get( 0 );
+        } else if ( this.patterns.size() == 1 ) {
+            // in case there is only one pattern, we do a rewrite, so:
+            // forall( Cheese( type == "stilton" ) )
+            // becomes
+            // forall( BASE_IDENTIFIER : Cheese() Cheese( this == BASE_IDENTIFIER, type == "stilton" ) )
+            PatternDescr original = (PatternDescr) this.patterns.get( 0 );
+            PatternDescr base = (PatternDescr) original.clone();
+            base.getDescrs().clear();
+            base.setIdentifier( BASE_IDENTIFIER );
+            return base;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the remaining patterns from the forall CE
+     * @return
+     */
+    public List getRemainingPatterns() {
+        if ( this.patterns.size() > 1 ) {
+            return this.patterns.subList( 1,
+                                          this.patterns.size() );
+        } else if ( this.patterns.size() == 1 ) {
+            // in case there is only one pattern, we do a rewrite, so:
+            // forall( Cheese( type == "stilton" ) )
+            // becomes
+            // forall( BASE_IDENTIFIER : Cheese() Cheese( this == BASE_IDENTIFIER, type == "stilton" ) )
+            PatternDescr original = (PatternDescr) this.patterns.get( 0 );
+            PatternDescr remaining = (PatternDescr) original.clone();
+            VariableRestrictionDescr restr = new VariableRestrictionDescr( "==",
+                                                                           false,
+                                                                           null,
+                                                                           BASE_IDENTIFIER );
+            FieldConstraintDescr constr = new FieldConstraintDescr( "this" );
+            constr.addRestriction( restr );
+            remaining.addConstraint( constr );
+            return Collections.singletonList( remaining );
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        this.patterns.add( baseDescr );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FromDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FromDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FromDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,39 @@
+package org.drools.lang.descr;
+
+import java.util.Collections;
+import java.util.List;
+
+public class FromDescr extends PatternSourceDescr
+    implements
+    ConditionalElementDescr
+    {
+
+    private static final long serialVersionUID = 400L;
+    private DeclarativeInvokerDescr dataSource;
+
+    public DeclarativeInvokerDescr getDataSource() {
+        return this.dataSource;
+    }
+
+    public void setDataSource(final DeclarativeInvokerDescr dataSource) {
+        this.dataSource = dataSource;
+    }
+
+    public void addDescr(final BaseDescr baseDescr) {
+        throw new UnsupportedOperationException("Can't add descriptors to "+this.getClass().getName());        
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }    
+
+    public List getDescrs() {
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        throw new UnsupportedOperationException("Can't add descriptors to "+this.getClass().getName());        
+    }
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionCallDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionCallDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionCallDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+package org.drools.lang.descr;
+
+/** This represents a function call - as in calling a Drools function. 
+ * eg: functionName(argument list)
+ */
+public class FunctionCallDescr extends DeclarativeInvokerDescr {
+
+    private static final long serialVersionUID = 400L;
+    private String name;
+    private String arguments;
+
+    public FunctionCallDescr(final String name) {
+        this.name = name;
+    }
+
+    public String getArguments() {
+        return this.arguments;
+    }
+
+    public void setArguments(final String arguments) {
+        this.arguments = arguments;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String toString() {
+        return this.name + this.arguments;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,97 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class FunctionDescr extends BaseDescr {
+    private static final long serialVersionUID = 400L;
+
+    private final String      name;
+    private final String      returnType;
+
+    private List              parameterTypes   = Collections.EMPTY_LIST;
+    private List              parameterNames   = Collections.EMPTY_LIST;
+
+    private String            text;
+
+    private int               offset;
+
+    private String            className;
+
+    public FunctionDescr(final String name,
+                         final String returnType) {
+        this.name = name;
+        this.returnType = returnType;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getClassName() {
+        return this.className;
+    }
+
+    public void setClassName(final String className) {
+        this.className = className;
+    }
+
+    public List getParameterNames() {
+        return this.parameterNames;
+    }
+
+    public List getParameterTypes() {
+        return this.parameterTypes;
+    }
+
+    public void addParameter(final String type,
+                             final String name) {
+        if ( this.parameterTypes == Collections.EMPTY_LIST ) {
+            this.parameterTypes = new ArrayList();
+        }
+        this.parameterTypes.add( type );
+
+        if ( this.parameterNames == Collections.EMPTY_LIST ) {
+            this.parameterNames = new ArrayList();
+        }
+        this.parameterNames.add( name );
+    }
+
+    public String getReturnType() {
+        return this.returnType;
+    }
+
+    public void setText(final String text) {
+        this.text = text;
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    public int getOffset() {
+        return this.offset;
+    }
+
+    public void setOffset(final int offset) {
+        this.offset = offset;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionImportDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionImportDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/FunctionImportDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+/**
+ * A descriptor for imported static functions
+ * 
+ * @author etirelli
+ */
+public class FunctionImportDescr extends ImportDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    public FunctionImportDescr() {
+    }
+
+    public String toString() {
+        return "import function " + this.getTarget();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/GlobalDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/GlobalDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/GlobalDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+/**
+ * A descriptor class for globals.
+ * 
+ * @author etirelli
+ */
+public class GlobalDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private String            identifier;
+    private String            type;
+
+    public GlobalDescr() {
+        this( null,
+              null );
+    }
+
+    public GlobalDescr(final String identifier,
+                       final String type) {
+        this.identifier = identifier;
+        this.type = type;
+    }
+
+    /**
+     * @return the identifier
+     */
+    public String getIdentifier() {
+        return this.identifier;
+    }
+
+    /**
+     * @param identifier the identifier to set
+     */
+    public void setIdentifier(final String identifier) {
+        this.identifier = identifier;
+    }
+
+    /**
+     * @return the type
+     */
+    public String getType() {
+        return this.type;
+    }
+
+    /**
+     * @param type the type to set
+     */
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ImportDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ImportDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ImportDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+/**
+ * @author etirelli
+ *
+ */
+public class ImportDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+    private String            target;
+
+    public ImportDescr() {
+        this( null );
+    }
+
+    public ImportDescr(final String clazzName) {
+        this.target = clazzName;
+    }
+
+    public String getTarget() {
+        return this.target;
+    }
+
+    public void setTarget(final String clazzName) {
+        this.target = clazzName;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((this.target == null) ? 0 : this.target.hashCode());
+        result = PRIME * result + this.getStartCharacter();
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final ImportDescr other = (ImportDescr) obj;
+        if ( this.target == null ) {
+            if ( other.target != null ) {
+                return false;
+            }
+        } else if ( !this.target.equals( other.target ) ) {
+            return false;
+        }
+        return this.getStartCharacter() == other.getStartCharacter();
+    }
+
+    public String toString() {
+        return "import " + this.target;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/LiteralRestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/LiteralRestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/LiteralRestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,94 @@
+package org.drools.lang.descr;
+
+import java.text.DecimalFormat;
+import java.text.ParseException;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This represents a literal node in the rule language. This is
+ * a constraint on a single field of a pattern. 
+ * The "text" contains the content. 
+ */
+public class LiteralRestrictionDescr extends EvaluatorBasedRestrictionDescr {
+    public static final int   TYPE_NULL        = 1;
+    public static final int   TYPE_NUMBER      = 2;
+    public static final int   TYPE_STRING      = 3;
+    public static final int   TYPE_BOOLEAN     = 4;
+
+    private static final long serialVersionUID = 400L;
+    private int               type;
+
+    public LiteralRestrictionDescr(final String evaluator,
+                                   final String text) {
+        this( evaluator,
+              false,
+              null,
+              text,
+              TYPE_STRING );// default type is string if not specified
+    }
+
+    public LiteralRestrictionDescr(final String evaluator,
+                                   final boolean isNegated,
+                                   final String text) {
+        this( evaluator,
+              isNegated,
+              null,
+              text,
+              TYPE_STRING );// default type is string if not specified
+    }
+
+    public LiteralRestrictionDescr(final String evaluator,
+                                   final boolean isNegated,
+                                   final String parameterText,
+                                   final String text,
+                                   final int type) {
+        super( evaluator,
+               isNegated,
+               parameterText );
+        this.setText( text );
+        this.type = type;
+    }
+
+    public String toString() {
+        return "[LiteralRestriction: " + super.toString() + " " + this.getText() + "]";
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public Object getValue() {
+        switch ( this.type ) {
+            case TYPE_NUMBER :
+                try {
+                    return DecimalFormat.getInstance().parse( this.getText() );
+                } catch ( ParseException e ) {
+                    // return String anyway
+                    return this.getText();
+                }
+            case TYPE_BOOLEAN :
+                return Boolean.valueOf( this.getText() );
+            default :
+                return this.getText();
+        }
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MethodAccessDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MethodAccessDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MethodAccessDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.lang.descr;
+
+/**
+ * 
+ * This represents a method call.
+ * As in:
+ * 
+ * variableName.methodName(argument list)
+ *
+ */
+public class MethodAccessDescr extends DeclarativeInvokerDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private String            methodName;
+    private String            arguments;
+
+    public MethodAccessDescr(final String methodName) {
+        this.methodName = methodName;
+    }
+
+    public MethodAccessDescr(final String methodName,
+                             final String arguments) {
+        this.methodName = methodName;
+        this.arguments = arguments;
+    }
+
+    public String getArguments() {
+        return this.arguments;
+    }
+
+    public void setArguments(final String arguments) {
+        this.arguments = arguments;
+    }
+
+    public String getMethodName() {
+        return this.methodName;
+    }
+
+    public void setMethodName(final String methodName) {
+        this.methodName = methodName;
+    }
+
+    public String toString() {
+        return this.methodName + this.arguments;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MultiPatternDestinationDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MultiPatternDestinationDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/MultiPatternDestinationDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 25, 2007
+ */package org.drools.lang.descr;
+
+/**
+ * An interface to represent pattern destinations
+ * 
+ * @author fernandomeyer
+ */
+public interface MultiPatternDestinationDescr {
+
+    public BaseDescr getInput();
+    public void setInput(BaseDescr input);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/NotDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/NotDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/NotDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,59 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class NotDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private final List        descrs           = new ArrayList( 1 );
+
+    public NotDescr() {
+    }
+
+    public NotDescr(final BaseDescr descr) {
+        addDescr( descr );
+    }
+
+    public void addDescr(final BaseDescr baseDescr) {
+        this.descrs.add( baseDescr );
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }    
+
+    public List getDescrs() {
+        return this.descrs;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        if( baseDescr instanceof NotDescr ) {
+            this.descrs.addAll( ((NotDescr)baseDescr).getDescrs() ); 
+        } else {
+            this.descrs.add( baseDescr );        
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/OrDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/OrDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/OrDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,67 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class OrDescr extends BaseDescr
+    implements
+    ConditionalElementDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private List              descrs           = new ArrayList();
+
+    public OrDescr() {
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) {        
+        if(clazz.isInstance( baseDescr )) {
+            for ( int i = this.descrs.size()-1; i >= 0; i-- ) {
+                if ( this.descrs.get( i ) instanceof FieldConstraintDescr ) {
+                    insertDescr( i-1, baseDescr );
+                    return;
+                }                
+            }
+        }        
+    }
+    
+    public void insertDescr(int index, final BaseDescr baseDescr) {
+        this.descrs.add( index, baseDescr );
+    }    
+
+    public void addDescr(final BaseDescr baseDescr) {
+        this.descrs.add( baseDescr );
+    }
+
+
+    public List getDescrs() {
+        return this.descrs;
+    }
+
+    public void addOrMerge(final BaseDescr baseDescr) {
+        if( baseDescr instanceof OrDescr ) {
+            this.descrs.addAll( ((OrDescr)baseDescr).getDescrs() );
+        } else {
+            this.descrs.add( baseDescr );
+        }
+    }
+    
+    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,161 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+public class PackageDescr extends BaseDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private final String      name;
+    private final String      documentation;
+
+    private List              imports          = Collections.EMPTY_LIST;
+    private List              functionImports  = Collections.EMPTY_LIST;
+    private List              attributes       = Collections.EMPTY_LIST;
+    private List              globals          = Collections.EMPTY_LIST;
+    private List              factTemplates    = Collections.EMPTY_LIST;
+    private List              functions        = Collections.EMPTY_LIST;
+    private List              rules            = Collections.EMPTY_LIST;
+    private List<TypeDeclarationDescr> typeDeclarations     = Collections.emptyList();
+
+    public PackageDescr(final String name) {
+        this( name,
+              "" );
+    }
+
+    public PackageDescr(final String name,
+                        final String documentation) {
+        this.name = name;
+        this.documentation = documentation;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getDocumentation() {
+        return this.documentation;
+    }
+
+    public void addImport(final ImportDescr importEntry) {
+        if ( this.imports == Collections.EMPTY_LIST ) {
+            this.imports = new ArrayList();
+        }
+        this.imports.add( importEntry );
+    }
+
+    public List getImports() {
+        return this.imports;
+    }
+
+    public void addFunctionImport(final FunctionImportDescr importFunction) {
+        if ( this.functionImports == Collections.EMPTY_LIST ) {
+            this.functionImports = new ArrayList();
+        }
+        this.functionImports.add( importFunction );
+    }
+
+    public List getFunctionImports() {
+        return this.functionImports;
+    }
+
+    public void addGlobal(final GlobalDescr global) {
+        if ( this.globals == Collections.EMPTY_LIST ) {
+            this.globals = new ArrayList();
+        }
+        this.globals.add( global );
+    }
+
+    public List getGlobals() {
+        return this.globals;
+    }
+
+    public void addAttribute(final AttributeDescr attribute) {
+        if ( this.attributes == Collections.EMPTY_LIST ) {
+            this.attributes = new ArrayList();
+        }
+        this.attributes.add( attribute );
+    }
+
+    public List getAttributes() {
+        return this.attributes;
+    }
+
+    public void addFactTemplate(final FactTemplateDescr factTemplate) {
+        if ( this.factTemplates == Collections.EMPTY_LIST ) {
+            this.factTemplates = new ArrayList( 1 );
+        }
+        this.factTemplates.add( factTemplate );
+    }
+
+    public List getFactTemplates() {
+        return this.factTemplates;
+    }
+
+    public void addFunction(final FunctionDescr function) {
+        if ( this.functions == Collections.EMPTY_LIST ) {
+            this.functions = new ArrayList( 1 );
+        }
+        this.functions.add( function );
+    }
+
+    public List getFunctions() {
+        return this.functions;
+    }
+
+    public void addRule(final RuleDescr rule) {
+        if ( this.rules == Collections.EMPTY_LIST ) {
+            this.rules = new ArrayList( 1 );
+        }
+        for ( Iterator iter = attributes.iterator(); iter.hasNext(); ) {
+            AttributeDescr at = (AttributeDescr) iter.next();
+            boolean overridden = false;
+            //check for attr in rule
+            for ( Iterator iterator = rule.getAttributes().iterator(); iterator.hasNext(); ) {
+                AttributeDescr ruleAt = (AttributeDescr) iterator.next();
+                if (ruleAt.getName().equals( at.getName() )) {
+                    overridden = true;
+                }
+            }
+            if (!overridden) {
+                rule.addAttribute( at );
+            }            
+        }
+        this.rules.add( rule );
+    }
+
+    public List getRules() {
+        return this.rules;
+    }
+
+    public void addTypeDeclaration(TypeDeclarationDescr declaration) {
+        if ( this.typeDeclarations == Collections.EMPTY_LIST ) {
+            this.typeDeclarations = new ArrayList<TypeDeclarationDescr>();
+        }
+        this.typeDeclarations.add( declaration );
+    }
+    
+    public List<TypeDeclarationDescr> getTypeDeclarations() {
+        return this.typeDeclarations;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescrDumper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescrDumper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PackageDescrDumper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+package org.drools.lang.descr;
+
+public interface PackageDescrDumper {
+    public String dump(final PackageDescr packageDescr);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,138 @@
+package org.drools.lang.descr;
+
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+public class PatternDescr extends BaseDescr implements Cloneable {
+    /**
+     * 
+     */
+    private static final long       serialVersionUID = 400L;
+    private String                  objectType;
+    private String                  identifier;
+    private ConditionalElementDescr constraint          = new AndDescr();
+    private int                     leftParentCharacter  = -1;
+    private int                     rightParentCharacter = -1;
+    private PatternSourceDescr      source;
+
+    public PatternDescr() {
+        this( null,
+              null );
+    }
+
+    public PatternDescr(final String objectType) {
+        this( objectType,
+              null );
+    }
+
+    public PatternDescr(final String objectType,
+                        final String identifier) {
+        this.objectType = objectType;
+        this.identifier = identifier;
+    }
+
+    public void setIdentifier(final String identifier) {
+        this.identifier = identifier;
+    }
+
+    public void setObjectType(final String objectType) {
+        this.objectType = objectType;
+    }
+
+    public String getObjectType() {
+        return this.objectType;
+    }
+
+    public String getIdentifier() {
+        return this.identifier;
+    }
+
+    public List getDescrs() {
+        return this.constraint.getDescrs();
+    }
+    
+    public void addConstraint( BaseDescr base ) {
+        this.constraint.addDescr( base );
+    }
+    
+    public ConditionalElementDescr getConstraint() {
+        return this.constraint;
+    }
+    
+    public boolean isInternalFact() {
+        return this.getSource() != null && this.getSource() instanceof CollectDescr;
+    }
+
+    public String toString() {
+        return "[Pattern: id=" + this.identifier + "; objectType=" + this.objectType + "]";
+    }
+
+    /**
+     * @return the leftParentCharacter
+     */
+    public int getLeftParentCharacter() {
+        return this.leftParentCharacter;
+    }
+
+    /**
+     * @param leftParentCharacter the leftParentCharacter to set
+     */
+    public void setLeftParentCharacter(final int leftParentCharacter) {
+        this.leftParentCharacter = leftParentCharacter;
+    }
+
+    /**
+     * @return the rightParentCharacter
+     */
+    public int getRightParentCharacter() {
+        return this.rightParentCharacter;
+    }
+
+    /**
+     * @param rightParentCharacter the rightParentCharacter to set
+     */
+    public void setRightParentCharacter(final int rightParentCharacter) {
+        this.rightParentCharacter = rightParentCharacter;
+    }
+
+    public PatternSourceDescr getSource() {
+        return source;
+    }
+
+    public void setSource(PatternSourceDescr source) {
+        this.source = source;
+    }
+    
+    public Object clone() {
+        PatternDescr clone = new PatternDescr( this.objectType, this.identifier );
+        clone.setLeftParentCharacter( this.leftParentCharacter );
+        clone.setRightParentCharacter( this.rightParentCharacter );
+        clone.setSource( this.source );
+        clone.setStartCharacter( this.getStartCharacter() );
+        clone.setEndCharacter( this.getEndCharacter() );
+        clone.setLocation( this.getLine(), this.getColumn() );
+        clone.setEndLocation( this.getEndLine(), this.getEndColumn() );
+        clone.setText( this.getText() );
+        for( Iterator it = this.getDescrs().iterator(); it.hasNext(); ) {
+            clone.addConstraint( (BaseDescr) it.next() );
+        }
+        return clone;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDestinationDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDestinationDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternDestinationDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 25, 2007
+ */package org.drools.lang.descr;
+
+/**
+ * An interface to represent pattern destinations
+ * 
+ * @author fernandomeyer
+ */
+public interface PatternDestinationDescr {
+
+    public PatternDescr getInputPattern();
+    public void setInputPattern(PatternDescr patternDescr);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternSourceDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternSourceDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PatternSourceDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 25, 2007
+ */
+package org.drools.lang.descr;
+
+/**
+ * A common base class for all descriptor classes that represent a pattern sources
+ *  
+ * @author etirelli
+ */
+public class PatternSourceDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PredicateDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PredicateDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/PredicateDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,60 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class PredicateDescr extends RestrictionDescr {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private Object            content;
+
+    private String[]          declarations;
+
+    private String            classMethodName;
+
+    public PredicateDescr(final Object text) {
+        this.content = text;
+    }
+
+    public PredicateDescr() {
+    }
+
+    public String getClassMethodName() {
+        return this.classMethodName;
+    }
+
+    public void setClassMethodName(final String classMethodName) {
+        this.classMethodName = classMethodName;
+    }
+
+    public Object getContent() {
+        return this.content;
+    }
+
+    public void setContent(final Object text) {
+        this.content = text;
+    }
+
+    public void setDeclarations(final String[] declarations) {
+        this.declarations = declarations;
+    }
+
+    public String[] getDeclarations() {
+        return this.declarations;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ProcessDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ProcessDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ProcessDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.lang.descr;
+
+public class ProcessDescr extends BaseDescr {
+    private String name;
+    private String className;
+
+    
+    public ProcessDescr() {
+        
+    }
+    
+    public ProcessDescr(String name) {
+        super();
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }        
+    
+    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QualifiedIdentifierRestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QualifiedIdentifierRestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QualifiedIdentifierRestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,42 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This represents a qualified identifier, like enums or subfield
+ * access in variables like "$p.name". This is a constraint on a single 
+ * field of a pattern. 
+ * The "text" contains the content. 
+ */
+public class QualifiedIdentifierRestrictionDescr extends EvaluatorBasedRestrictionDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    public QualifiedIdentifierRestrictionDescr(final String evaluator,
+                                               final boolean isNegated,
+                                               final String parameterText,
+                                               final String text) {
+        super( evaluator,
+               isNegated,
+               parameterText );
+        this.setText( text );
+    }
+
+    public String toString() {
+        return "[QualifiedIndentifierRestr: " + super.toString() + " " + this.getText() + " ]";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QueryDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QueryDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/QueryDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,65 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class QueryDescr extends RuleDescr {
+    private String[] params;
+    private String[] types;
+    
+    private static final String[] EMPTY_PARAMS = new String[0];
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+
+    public QueryDescr(final String name) {
+        this( name,
+              "" );
+        this.params = EMPTY_PARAMS;        
+    }      
+
+    public QueryDescr(final String ruleName,
+                      final String documentation) {
+        super( ruleName,
+               documentation );
+        this.params = EMPTY_PARAMS;         
+    }
+    
+    public QueryDescr(final String ruleName,
+                      final String documentation, 
+                      final String[] params) {
+        super( ruleName,
+               documentation );
+        this.params = params;         
+    }
+    
+    public void setParameters(String[] params) {
+        this.params = params;
+    }
+    
+    public String[] getParameters() {
+        return this.params;
+    }
+    
+    public void setParameterTypes(String[] types) {
+        this.types = types;
+    }
+    
+    public String[] getParameterTypes() {
+        return this.types;
+    }    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/Restriction.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/Restriction.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/Restriction.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Restriction extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionConnectiveDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionConnectiveDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionConnectiveDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,86 @@
+package org.drools.lang.descr;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is used to connect restrictions together for a single field
+ * eg:
+ * 	age < 40 & > 30 
+ *
+ */
+public class RestrictionConnectiveDescr extends RestrictionDescr {
+
+    private static final long                     serialVersionUID = 400L;
+
+    public final static RestrictionConnectiveType AND              = RestrictionConnectiveType.AND;
+    public final static RestrictionConnectiveType OR               = RestrictionConnectiveType.OR;
+
+    private RestrictionConnectiveType             connective;
+    private List<RestrictionDescr>                restrictions;
+
+    public RestrictionConnectiveDescr(final RestrictionConnectiveType connective) {
+        super();
+        this.connective = connective;
+        this.restrictions = Collections.emptyList();
+    }
+
+    public RestrictionConnectiveType getConnective() {
+        return this.connective;
+    }
+
+    public void addRestriction(RestrictionDescr restriction) {
+        if ( this.restrictions == Collections.EMPTY_LIST ) {
+            this.restrictions = new ArrayList<RestrictionDescr>();
+        }
+        this.restrictions.add( restriction );
+    }
+
+    public void addOrMerge(RestrictionDescr restriction) {
+        if ( (restriction instanceof RestrictionConnectiveDescr) && ((RestrictionConnectiveDescr) restriction).connective == this.connective ) {
+            if ( this.restrictions == Collections.EMPTY_LIST ) {
+                this.restrictions = new ArrayList<RestrictionDescr>();
+            }
+            this.restrictions.addAll( ((RestrictionConnectiveDescr) restriction).getRestrictions() );
+        } else {
+            this.addRestriction( restriction );
+        }
+    }
+
+    public List<RestrictionDescr> getRestrictions() {
+        return this.restrictions;
+    }
+
+    public String toString() {
+        final StringBuffer buf = new StringBuffer();
+        buf.append( "( " );
+        for ( Iterator it = this.restrictions.iterator(); it.hasNext(); ) {
+            buf.append( it.next().toString() );
+            if ( it.hasNext() ) {
+                buf.append( this.connective.toString() );
+            }
+        }
+        buf.append( "  )" );
+        return buf.toString();
+    }
+
+    /**
+     * The connective types that can be used for a restriction
+     * 
+     * @author etirelli
+     */
+    public static enum RestrictionConnectiveType {
+        AND {
+            public String toString() {
+                return "&&";
+            }
+        },
+        OR {
+            public String toString() {
+                return "||";
+            }
+        };
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This represents a literal node in the rule language. This is
+ * a constraint on a single field of a pattern. 
+ * The "text" contains the content, which may also be an enumeration. 
+ */
+public class RestrictionDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,85 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ReturnValueRestrictionDescr extends EvaluatorBasedRestrictionDescr {
+
+    private static final long serialVersionUID = 400L;
+    private Object            content;
+    private String[]          declarations;
+    private String            classMethodName;
+
+    public ReturnValueRestrictionDescr(final String evaluator ) {
+        super( evaluator,
+               false,
+               null );
+    }
+
+    public ReturnValueRestrictionDescr(final String evaluator, 
+                                       final Object content ) {
+        super( evaluator,
+               false,
+               null );
+        this.content = content;
+    }
+
+    public ReturnValueRestrictionDescr(final String evaluator, 
+                                       final boolean isNegated,
+                                       final String parameterText ) {
+        super( evaluator,
+               isNegated,
+               parameterText );
+    }
+
+    public ReturnValueRestrictionDescr(final String evaluator,
+                                       final boolean isNegated,
+                                       final String parameterText, 
+                                       final Object content) {
+        super( evaluator,
+               isNegated,
+               parameterText );
+        this.content = content;
+    }
+
+    public String getClassMethodName() {
+        return this.classMethodName;
+    }
+
+    public void setClassMethodName(final String classMethodName) {
+        this.classMethodName = classMethodName;
+    }
+
+    public Object getContent() {
+        return this.content;
+    }
+
+    public void setContent(final String text) {
+        this.content = text;
+    }
+
+    public void setDeclarations(final String[] declarations) {
+        this.declarations = declarations;
+    }
+
+    public String[] getDeclarations() {
+        return this.declarations;
+    }
+
+    public String toString() {
+        return "[ReturnValue: " + super.toString() + " " + this.content + "]";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RuleDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RuleDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/RuleDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,131 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.drools.compiler.Dialect;
+
+public class RuleDescr extends BaseDescr {
+
+    private static final long serialVersionUID = 400L;
+    private String            name;
+    private String            documentation;
+
+    private AndDescr          lhs;
+    private Object            consequence;
+    private int               consequenceLine;
+    private int               consequencePattern;
+    private int               offset;
+    private List              attributes       = Collections.EMPTY_LIST;
+    private String            salience;
+
+    private String            className;
+
+
+    public RuleDescr(final String name) {
+        this( name,
+              "" );
+    }
+
+
+    public RuleDescr(final String ruleName,
+                     final String documentation) {
+        this.name = ruleName;
+        this.documentation = documentation;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getSalience() {
+        return salience;
+    }
+
+    public void setSalience(String salience) {
+        this.salience = salience;
+    }
+
+    public String getClassName() {
+        return this.className;
+    }
+
+    public void setClassName(final String className) {
+        this.className = className;
+    }
+
+    public String getDocumentation() {
+        return this.documentation;
+    }
+
+    public List getAttributes() {
+        return this.attributes;
+    }
+
+    public void addAttribute(final AttributeDescr attribute) {
+        if ( this.attributes == Collections.EMPTY_LIST ) {
+            this.attributes = new ArrayList();
+        }
+        this.attributes.add( attribute );
+    }
+
+    public void setAttributes(final List attributes) {
+        this.attributes = new ArrayList( attributes );
+    }
+
+    public AndDescr getLhs() {
+        return this.lhs;
+    }
+
+    public void setLhs(final AndDescr lhs) {
+        this.lhs = lhs;
+    }
+
+    public Object getConsequence() {
+        return this.consequence;
+    }
+
+    public void setConsequence(final Object consequence) {
+        this.consequence = consequence;
+    }
+
+    public void setConsequenceLocation(final int line,
+                                       final int pattern) {
+        this.consequenceLine = line;
+        this.consequencePattern = pattern;
+    }
+
+    public void setConsequenceOffset(final int offset) {
+        this.offset = offset;
+    }
+
+    public int getConsequenceOffset() {
+        return this.offset;
+    }
+
+    public int getConsequenceLine() {
+        return this.consequenceLine;
+    }
+
+    public int getConsequencePattern() {
+        return this.consequencePattern;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TimeWindowDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TimeWindowDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TimeWindowDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.descr;
+
+public class TimeWindowDescr extends AccumulateDescr{
+
+	private static final long serialVersionUID = -726422237446800791L;
+	
+	private String windowSize;
+	
+    public String getWindowSize() {
+        return this.windowSize;
+    }
+
+    public void setWindowSize(final String windowSize) {
+        this.windowSize = windowSize;
+    }
+	
+	
+}
+
+/**
+ * A descr class for accumulate node
+ *//*
+public class TimeWindowDescr extends PatternSourceDescr
+    implements
+    ConditionalElementDescr,
+    PatternDestinationDescr,
+    MultiPatternDestinationDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    private BaseDescr         input;
+    private String			  windowSize;
+    private String            initCode;
+    private String            actionCode;
+    private String            reverseCode;
+    private String            resultCode;
+    private String[]          declarations;
+    private String            className;
+    private boolean           externalFunction = false;
+    private String            functionIdentifier;
+    private String            expression;
+    
+    public int getLine() {
+        return this.input.getLine();
+    }
+
+    public String getClassName() {
+        return this.className;
+    }
+
+    public void setClassName(final String classMethodName) {
+        this.className = classMethodName;
+    }
+
+    public String[] getDeclarations() {
+        return this.declarations;
+    }
+
+    public void setDeclarations(final String[] declarations) {
+        this.declarations = declarations;
+    }
+
+    public String getWindowSize() {
+        return this.windowSize;
+    }
+
+    public void setWindowSize(final String windowSize) {
+        this.windowSize = windowSize;
+    }
+    
+    public String getActionCode() {
+        return this.actionCode;
+    }
+
+    public void setActionCode(final String actionCode) {
+        this.actionCode = actionCode;
+    }
+
+    public String getInitCode() {
+        return this.initCode;
+    }
+
+    public void setInitCode(final String initCode) {
+        this.initCode = initCode;
+    }
+
+    public String getResultCode() {
+        return this.resultCode;
+    }
+
+    public void setResultCode(final String resultCode) {
+        this.resultCode = resultCode;
+    }
+
+    public String toString() {
+        return "[Accumulate: input=" + this.input.toString() + "]";
+    }
+
+    public void addDescr(final BaseDescr patternDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+    
+    public void insertBeforeLast(final Class clazz ,final BaseDescr baseDescr ) { 
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    public List getDescrs() {
+        // nothing to do
+        return Collections.EMPTY_LIST;
+    }
+
+    public void addOrMerge(BaseDescr baseDescr) {
+        throw new UnsupportedOperationException( "Can't add descriptors to " + this.getClass().getName() );
+    }
+
+    public String getReverseCode() {
+        return reverseCode;
+    }
+
+    public void setReverseCode(String reverseCode) {
+        this.reverseCode = reverseCode;
+    }
+
+    public boolean isExternalFunction() {
+        return externalFunction;
+    }
+
+    public void setExternalFunction(boolean externalFunction) {
+        //this.externalFunction = externalFunction;
+    	this.externalFunction = false;
+    }
+
+    public String getExpression() {
+        return expression;
+    }
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    public String getFunctionIdentifier() {
+        return functionIdentifier;
+    }
+
+    public void setFunctionIdentifier(String functionIdentifier) {
+        this.functionIdentifier = functionIdentifier;
+    }
+
+    public PatternDescr getInputPattern() {
+        if( isSinglePattern() ) {
+            return (PatternDescr) this.input;
+        }
+        return null;
+    }
+
+    public void setInputPattern(final PatternDescr inputPattern) {
+        this.input = inputPattern;
+    }
+
+    public BaseDescr getInput() {
+        return input;
+    }
+
+    public void setInput(BaseDescr input) {
+        this.input = input; 
+    }
+    
+    public boolean isSinglePattern() {
+        return this.input instanceof PatternDescr; 
+    }
+
+    public boolean isMultiPattern() {
+        return ! ( this.input instanceof PatternDescr ); 
+    }
+
+    public boolean hasValidInput() {
+        // TODO: need to check that there are no OR occurences 
+        return this.input != null;
+    }
+}
+*/
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,106 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2008 Red Hat
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TypeDeclarationDescr extends BaseDescr {
+    
+    /**
+     * The attribute key used to define what role the type assumes (fact, event)
+     */
+    public static final String ATTR_ROLE = "role";
+    /**
+     * The attribute key used to define what is the clock strategy used for that type
+     */
+    public static final String ATTR_CLOCK_STRATEGY = "clock_strategy";
+    /**
+     * The attribute key used to define what is the attribute to read the timestamp from
+     */
+    public static final String ATTR_TIMESTAMP = "timestamp_attribute";
+    /**
+     * The attribute key used to define what is the attribute to read the duration from
+     */
+    public static final String ATTR_DURATION = "duration_attribute";
+    /**
+     * The attribute key used to define what is the class name that implements the type
+     */
+    public static final String ATTR_CLASS = "class";
+    /**
+     * The attribute key used to define what is the template name that implements the type
+     */
+    public static final String ATTR_TEMPLATE = "template";
+    
+
+    private static final long   serialVersionUID = 400L;
+    private String              typeName;
+    private Map<String, String> attributes;
+
+    public TypeDeclarationDescr() {
+        this(null);
+    }
+    
+    public TypeDeclarationDescr(final String typeName) {
+        this.typeName = typeName;
+        this.attributes = new HashMap<String, String>();
+    }
+
+    /**
+     * @return the identifier
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @param identifier the identifier to set
+     */
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+    
+    /**
+     * Adds a new attribute
+     * @param attr
+     * @param value
+     */
+    public void addAttribute( String attr, String value ) {
+        this.attributes.put( attr, value );
+    }
+    
+    /**
+     * Returns an attribute value or null if it is not defined
+     * @param attr
+     * @return
+     */
+    public String getAttribute( String attr ) {
+        return this.attributes.get( attr );
+    }
+
+    /**
+     * Returns the attribute map
+     * @return
+     */
+    public Map<String, String> getAttributes() {
+        return this.attributes;
+    }
+
+    public String toString() {
+        return "TypeDeclaration[ "+this.getTypeName()+" ]";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/VariableRestrictionDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/VariableRestrictionDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/descr/VariableRestrictionDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,49 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class VariableRestrictionDescr extends EvaluatorBasedRestrictionDescr {
+
+    private static final long serialVersionUID = 400L;
+
+    public VariableRestrictionDescr(final String evaluator,
+                                    final String identifier ) {
+        super( evaluator,
+               false,
+               null );
+        this.setText( identifier );
+    }
+
+    public VariableRestrictionDescr(final String evaluator,
+                                    final boolean isNegated,
+                                    final String parameterText,
+                                    final String identifier ) {
+        super( evaluator,
+               isNegated,
+               parameterText );
+        this.setText( identifier );
+    }
+
+    public String getIdentifier() {
+        return this.getText();
+    }
+    
+    public String toString() {
+        return "[VariableRestriction: " + super.toString() + " " + this.getText() + " ]";
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMapping.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMapping.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMapping.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import java.util.List;
+
+import org.drools.lang.dsl.DSLMappingEntry.Section;
+
+/**
+ * An interface that represents a DSL Mapping 
+ * 
+ * @author etirelli
+ */
+public interface DSLMapping {
+
+    /**
+     * Returns the string identifier for this mapping
+     * @return
+     */
+    public String getIdentifier();
+
+    /**
+     * Sets the identifier for this mapping
+     * @param identifier
+     */
+    public void setIdentifier(String identifier);
+
+    /**
+     * Returns a String description of this mapping
+     * @return
+     */
+    public String getDescription();
+
+    /**
+     * Sets the description for this mapping
+     * @param description
+     */
+    public void setDescription(String description);
+
+    /**
+     * Returns the list of entries in this mapping
+     * @return
+     */
+    public List getEntries();
+
+    /**
+     * Add one entry to the list of the entries
+     * @param entry
+     */
+    public void addEntry(DSLMappingEntry entry);
+
+    /**
+     * Adds all entries in the given list to this DSL Mapping
+     * @param entries
+     */
+    public void addEntries(List entries);
+
+    /**
+     * Removes the given entry from the list of entries
+     * @param entry
+     */
+    public void removeEntry(DSLMappingEntry entry);
+
+    /**
+     * Returns the list of mappings for the given section 
+     * @param section
+     * @return
+     */
+    public List getEntries(Section section);
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingEntry.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingEntry.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingEntry.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,378 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * A single entry in a DSL mapping file
+ * 
+ * @author etirelli
+ */
+public interface DSLMappingEntry {
+
+    public static final Section  KEYWORD        = new KeywordSection();
+    public static final Section  CONDITION      = new ConditionSection();
+    public static final Section  CONSEQUENCE    = new ConsequenceSection();
+    public static final Section  ANY            = new AnySection();
+    public static final MetaData EMPTY_METADATA = new DefaultDSLEntryMetaData( "" );
+
+    /**
+     * Returns the section this mapping entry refers to
+     * 
+     * @return
+     */
+    public DSLMappingEntry.Section getSection();
+
+    /**
+     * Returns the meta data info about this mapping entry
+     * 
+     * @return
+     */
+    public DSLMappingEntry.MetaData getMetaData();
+
+    /**
+     * Returns the key of this mapping, i.e., the source
+     * that needs to be translated
+     * 
+     * @return
+     */
+    public String getMappingKey();
+
+    /**
+     * Returns the result of the translation
+     * 
+     * @return
+     */
+    public String getMappingValue();
+
+    /**
+     * Returns the compiled pattern based on the given MappingKey
+     * @return the keyPattern
+     */
+    public Pattern getKeyPattern();
+
+    /**
+     * Returns the transformed mapping value using place holders for variables 
+     * @return the valuePattern
+     */
+    public String getValuePattern();
+
+    /**
+     * Returns the list of variables found in the given pattern key
+     * @return the variables
+     */
+    public Map getVariables();
+
+    /**
+     * @param key the key to set
+     */
+    public void setMappingKey(String key);
+
+    /**
+     * @param section the section to set
+     */
+    public void setSection(Section section);
+
+    /**
+     * @param value the value to set
+     */
+    public void setMappingValue(String value);
+
+    /**
+     * @param metadata the metadata to set
+     */
+    public void setMetaData(MetaData metadata);
+
+    /**
+     * Returns a list of errors found in this mapping
+     * @return
+     */
+    public List getErrors();
+
+    /**
+     * An inner interface for DSL mapping sections
+     * @author etirelli
+     *
+     */
+    public static interface Section
+        extends
+        Comparable {
+        public String getSymbol();
+    }
+
+    /**
+     * An inner interface to represent any metadata
+     * associated with this entry. It is obviously
+     * implementation dependent.
+     * 
+     * @author etirelli
+     *
+     */
+    public static interface MetaData
+        extends
+        Comparable {
+        public String toString();
+
+        public String getMetaData();
+    }
+
+    /**
+     * The keyword section, to allow mapping of keywords
+     * 
+     * @author etirelli
+     */
+    public static class KeywordSection
+        implements
+        Section {
+        private static final String symbol = "[keyword]";
+
+        private KeywordSection() {
+        }
+
+        public String getSymbol() {
+            return symbol;
+        }
+
+        public String toString() {
+            return symbol;
+        }
+
+        public int hashCode() {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
+            return result;
+        }
+
+        public boolean equals(final Object obj) {
+            if ( this == obj ) {
+                return true;
+            }
+            if ( obj == null ) {
+                return false;
+            }
+            if ( getClass() != obj.getClass() ) {
+                return false;
+            }
+            final KeywordSection other = (KeywordSection) obj;
+            if ( symbol == null ) {
+                if ( other.getSymbol() != null ) {
+                    return false;
+                }
+            } else if ( !symbol.equals( other.getSymbol() ) ) {
+                return false;
+            }
+            return true;
+        }
+
+        public int compareTo(final Object arg0) {
+            return this.toString().compareTo( arg0.toString() );
+        }
+    }
+
+    /**
+     * The condition section, to allow mapping of the conditions
+     * 
+     * @author etirelli
+     */
+    public static class ConditionSection
+        implements
+        Section {
+        private static final String symbol = "[condition]";
+
+        private ConditionSection() {
+        }
+
+        public String getSymbol() {
+            return symbol;
+        }
+
+        public String toString() {
+            return symbol;
+        }
+
+        public int hashCode() {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
+            return result;
+        }
+
+        public boolean equals(final Object obj) {
+            if ( this == obj ) {
+                return true;
+            }
+            if ( obj == null ) {
+                return false;
+            }
+            if ( getClass() != obj.getClass() ) {
+                return false;
+            }
+            final KeywordSection other = (KeywordSection) obj;
+            if ( symbol == null ) {
+                if ( other.getSymbol() != null ) {
+                    return false;
+                }
+            } else if ( !symbol.equals( other.getSymbol() ) ) {
+                return false;
+            }
+            return true;
+        }
+
+        public int compareTo(final Object arg0) {
+            return this.toString().compareTo( arg0.toString() );
+        }
+    }
+
+    /**
+     * The consequence section to allow the mapping 
+     * of consequence elements
+     * 
+     * @author etirelli
+     */
+    public static class ConsequenceSection
+        implements
+        Section {
+        private static final String symbol = "[consequence]";
+
+        private ConsequenceSection() {
+        }
+
+        public String getSymbol() {
+            return symbol;
+        }
+
+        public String toString() {
+            return symbol;
+        }
+
+        public int hashCode() {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
+            return result;
+        }
+
+        public boolean equals(final Object obj) {
+            if ( this == obj ) {
+                return true;
+            }
+            if ( obj == null ) {
+                return false;
+            }
+            if ( getClass() != obj.getClass() ) {
+                return false;
+            }
+            final KeywordSection other = (KeywordSection) obj;
+            if ( symbol == null ) {
+                if ( other.getSymbol() != null ) {
+                    return false;
+                }
+            } else if ( !symbol.equals( other.getSymbol() ) ) {
+                return false;
+            }
+            return true;
+        }
+
+        public int compareTo(final Object arg0) {
+            return this.toString().compareTo( arg0.toString() );
+        }
+    }
+
+    /**
+     * An element to indicate the mapping should be applicable
+     * to any section
+     *  
+     * @author etirelli
+     */
+    public static class AnySection
+        implements
+        Section {
+
+        private static final String symbol = "[*]";
+
+        private AnySection() {
+        }
+
+        public String getSymbol() {
+            return symbol;
+        }
+
+        public String toString() {
+            return symbol;
+        }
+
+        public int hashCode() {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
+            return result;
+        }
+
+        public boolean equals(final Object obj) {
+            if ( this == obj ) {
+                return true;
+            }
+            if ( obj == null ) {
+                return false;
+            }
+            if ( getClass() != obj.getClass() ) {
+                return false;
+            }
+            final KeywordSection other = (KeywordSection) obj;
+            if ( symbol == null ) {
+                if ( other.getSymbol() != null ) {
+                    return false;
+                }
+            } else if ( !symbol.equals( other.getSymbol() ) ) {
+                return false;
+            }
+            return true;
+        }
+
+        public int compareTo(final Object arg0) {
+            return this.toString().compareTo( arg0.toString() );
+        }
+    }
+
+    public static class DefaultDSLEntryMetaData
+        implements
+        DSLMappingEntry.MetaData {
+
+        private String metadata;
+
+        public DefaultDSLEntryMetaData(final String metadata) {
+            this.metadata = metadata;
+        }
+
+        public String getMetaData() {
+            return this.metadata;
+        }
+
+        public String toString() {
+            return (this.metadata == null) ? "" : this.metadata;
+        }
+
+        public int compareTo(final Object arg0) {
+            return this.toString().compareTo( arg0.toString() );
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingFile.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingFile.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingFile.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.drools.lang.dsl.DSLMappingEntry.DefaultDSLEntryMetaData;
+
+/**
+ * A helper class that handles a DSL Mapping file
+ * @author etirelli
+ */
+public class DSLMappingFile {
+
+    // the following pattern will be used to parse dsl mapping entries in the DSL file.
+    // It is capable of parsing entries that follows the pattern:
+    // [<section>][<metadata>]?<key>=<value>
+    private static final Pattern pattern     = Pattern.compile( "((\\[[^\\[]*\\])\\s*(\\[([^\\[]*)\\])?)?\\s*((\\\\=|[^=])*)=(.*)" );
+    private static final String  KEYWORD     = "[keyword]";
+    private static final String  CONDITION   = "[condition]";
+    private static final String  CONSEQUENCE = "[consequence]";
+    //private static final String  ANY         = "[*]";
+    private static final String  WHEN        = "[when]";
+    private static final String  THEN        = "[then]";
+
+    private DSLMapping           mapping;
+    private List                 errors;
+
+    public DSLMappingFile() {
+        this.mapping = new DefaultDSLMapping();
+        this.errors = Collections.EMPTY_LIST;
+    }
+
+    /**
+     * Returns the DSL mapping loaded from this file
+     * @return
+     */
+    public DSLMapping getMapping() {
+        return this.mapping;
+    }
+
+    /**
+     * Sets the 
+     * @param mapping
+     */
+    public void setMapping(final DSLMapping mapping) {
+        this.mapping = mapping;
+    }
+
+    /**
+     * Returns the list of parsing errors
+     * @return
+     */
+    public List getErrors() {
+        return Collections.unmodifiableList( this.errors );
+    }
+
+    /**
+     * Parses the file. Throws IOException in case there is any problem
+     * reading the file;
+     * 
+     * @return true in case no error was found parsing the file. false 
+     *         otherwise. Use getErrors() to check for the actual errors.
+     */
+    public boolean parseAndLoad(final Reader dsl) throws IOException {
+        String line = null;
+        int linecounter = 0;
+        final BufferedReader dslFileReader = new BufferedReader( dsl );
+        this.mapping = new DefaultDSLMapping();
+        this.errors = new LinkedList();
+        //Note: Use a string builder for 1.5 targets
+        StringBuffer sb = new StringBuffer();
+        boolean spacesAllowed = true;
+        while ( (line = dslFileReader.readLine()) != null ) {
+            linecounter++;
+            String trimmedline = line.trim(); //this can be more efficient, get rid of trim(), iterate-- over last chars only.
+            if ( spacesAllowed ) { //prevents that the break of some line be mixed with comments or empty lines
+                if ( trimmedline.length() == 0 ) {
+                    // empty line in DSL: [\t ]*\n
+                    continue;
+                }
+                if ( trimmedline.startsWith( "#" ) ) {
+                    // comment line in DSL: # bla bla \n
+                    continue;
+                }
+            }
+            //else, add the chars in the buffer, we'll see about that in a sec
+            sb.append( trimmedline );
+            if ( sb.charAt( sb.length() - 1 ) == '\\' ) {
+                sb.append( ' ' ); //put a space, don't be ridiculous
+                spacesAllowed = false;
+                continue;
+            }
+            //reinit the buffer, no matter what, but keep the accumulated chars
+            String lineToParse = sb.toString();
+            spacesAllowed = true;
+            sb = new StringBuffer();
+            final Matcher mat = pattern.matcher( lineToParse );
+            // - END - 
+            if ( mat.matches() ) {
+                final String sectionStr = mat.group( 2 );
+                final String metadataStr = mat.group( 4 );
+                final String key = mat.group( 5 ).replaceAll( "\\\\=",
+                                                              "=" );
+                final String value = mat.group( 7 );
+
+                DSLMappingEntry.Section section = DSLMappingEntry.ANY;
+                if ( KEYWORD.equals( sectionStr ) ) {
+                    section = DSLMappingEntry.KEYWORD;
+                } else if ( CONDITION.equals( sectionStr ) || WHEN.equals( sectionStr ) ) {
+                    section = DSLMappingEntry.CONDITION;
+                } else if ( CONSEQUENCE.equals( sectionStr ) || THEN.equals( sectionStr ) ) {
+                    section = DSLMappingEntry.CONSEQUENCE;
+                }
+
+                DSLMappingEntry.MetaData metadata;
+                if ( metadataStr == null || metadataStr.length() == 0 ) {
+                    metadata = DSLMappingEntry.EMPTY_METADATA;
+                } else {
+                    metadata = new DefaultDSLEntryMetaData( metadataStr );
+                }
+
+                final DSLMappingEntry entry = new DefaultDSLMappingEntry( section,
+                                                                          metadata,
+                                                                          key,
+                                                                          value );
+
+                this.mapping.addEntry( entry );
+            } else { // it is for sure an error !
+                final String error = "Error parsing mapping entry: " + line;
+                final DSLMappingParseException exception = new DSLMappingParseException( error,
+                                                                                         linecounter );
+                this.errors.add( exception );
+            }
+        }
+        return this.errors.isEmpty();
+    }
+
+    /**
+     * Saves current mapping into a DSL mapping file
+     * @param out
+     * @throws IOException
+     */
+    public void saveMapping(final Writer out) throws IOException {
+        for ( final Iterator it = this.mapping.getEntries().iterator(); it.hasNext(); ) {
+            out.write( it.next().toString() );
+            out.write( "\n" );
+        }
+    }
+
+    /**
+     * Saves the given mapping into a DSL mapping file
+     * 
+     * @param out
+     * @param mapping
+     * @throws IOException
+     */
+    public static void saveMapping(final Writer out,
+                                   final DSLMapping mapping) throws IOException {
+        for ( final Iterator it = mapping.getEntries().iterator(); it.hasNext(); ) {
+            out.write( it.next().toString() );
+            out.write( "\n" );
+        }
+    }
+
+    /**
+     * Method to return the current mapping as a String object
+     * @return
+     */
+    public String dumpFile() {
+        final StringBuffer buf = new StringBuffer();
+        for ( final Iterator it = this.mapping.getEntries().iterator(); it.hasNext(); ) {
+            buf.append( it.next() );
+            buf.append( "\n" );
+        }
+        return buf.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingParseException.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingParseException.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DSLMappingParseException.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+/**
+ * @author etirelli
+ *
+ */
+public class DSLMappingParseException extends Exception {
+    private static final long serialVersionUID = 400L;
+
+    public String             message;
+    public int                line;
+
+    public DSLMappingParseException(final String message,
+                                    final int line) {
+        this.message = message;
+        this.line = line;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+    public int getLine() {
+        return this.line;
+    }
+
+    public String toString() {
+        return "[ line " + this.line + " ]" + this.message;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMapping.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMapping.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMapping.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.drools.lang.dsl.DSLMappingEntry.Section;
+
+/**
+ * This is a default implementation of the DSL Mapping interface
+ * capable of storing a list of DSLMappingEntries and managing it.
+ * 
+ * @author etirelli
+ */
+public class DefaultDSLMapping
+    implements
+    DSLMapping {
+
+    private String identifier;
+    private String description;
+    private List   entries;
+
+    public DefaultDSLMapping() {
+        this( "" );
+    }
+
+    public DefaultDSLMapping(final String identifier) {
+        this.identifier = identifier;
+        this.entries = new LinkedList();
+    }
+
+    /**
+     * Add one entry to the list of the entries
+     * @param entry
+     */
+    public void addEntry(final DSLMappingEntry entry) {
+        this.entries.add( entry );
+    }
+
+    /**
+     * Adds all entries in the given list to this DSL Mapping
+     * @param entries
+     */
+    public void addEntries(final List entries) {
+        this.entries.addAll( entries );
+    }
+
+    /**
+     * Returns an unmodifiable list of entries
+     */
+    public List getEntries() {
+        return Collections.unmodifiableList( this.entries );
+    }
+
+    /**
+     * Returns the list of mappings for the given section 
+     * @param section
+     * @return
+     */
+    public List getEntries(final Section section) {
+        final List list = new LinkedList();
+        for ( final Iterator it = this.entries.iterator(); it.hasNext(); ) {
+            final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+            if ( entry.getSection().equals( section ) ) {
+                list.add( entry );
+            }
+        }
+        return list;
+    }
+
+    /**
+     * Returns the identifier for this mapping
+     */
+    public String getIdentifier() {
+        return this.identifier;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void removeEntry(final DSLMappingEntry entry) {
+        this.entries.remove( entry );
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String getDescription() {
+        return this.description;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void setIdentifier(final String identifier) {
+        this.identifier = identifier;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMappingEntry.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMappingEntry.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultDSLMappingEntry.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A default implementation for the DSL Mapping Entry interface
+ * 
+ * @author etirelli
+ */
+public class DefaultDSLMappingEntry
+    implements
+    DSLMappingEntry {
+
+    private Section      section;
+    private MetaData     metadata;
+    private String       key;
+    private String       value;
+
+    private Map          variables = Collections.EMPTY_MAP;
+
+    private Pattern      keyPattern;
+    private String       valuePattern;
+
+    // following pattern is used to extract all variables names and positions from a mapping.
+    // Example: for the following String:
+    //
+    // {This} is a {pattern} considered pretty \{{easy}\} by most \{people\}. What do you {say}
+    // 
+    // it will return variables:
+    // This, pattern, easy, say
+    //
+    static final Pattern VAR_FINDER = Pattern.compile( "(^|[^\\\\])\\{([(\\\\\\{)|[^\\{]]*?)\\}",
+                                                      Pattern.MULTILINE | Pattern.DOTALL );
+    
+    // following pattern is used to find all the non-escaped parenthesis in the input key
+    // to correctly calculate the variables offset
+    private static final Pattern PAREN_FINDER = Pattern.compile( "(^\\(|[^\\\\]\\(|\\G\\()" );
+
+    public DefaultDSLMappingEntry() {
+        this( DSLMappingEntry.ANY,
+              DSLMappingEntry.EMPTY_METADATA,
+              null,
+              null );
+    }
+
+    public DefaultDSLMappingEntry(final Section section,
+                                  final MetaData metadata,
+                                  final String key,
+                                  final String value) {
+        this.section = section;
+        this.metadata = metadata;
+        this.setMappingKey( key );
+        this.setMappingValue( value );
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public Section getSection() {
+        return this.section;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public DSLMappingEntry.MetaData getMetaData() {
+        return this.metadata;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String getMappingKey() {
+        return this.key;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String getMappingValue() {
+        return this.value;
+    }
+
+    /**
+     * @param key the key to set
+     */
+    public void setMappingKey(String key) {
+    	if (key != null) {
+    		key = key.trim();
+    	}
+        this.key = key;
+
+        if ( key != null ) {
+            int substr = 0;
+            // escape '$' to avoid errors
+            final String escapedKey = key.replaceAll( "\\$",
+                                                "\\\\\\$" );
+            final Matcher m = VAR_FINDER.matcher( escapedKey );
+            // retrieving variables list and creating key pattern 
+            final StringBuffer buf = new StringBuffer();
+
+            int counter = 1;
+            if ( !key.startsWith( "^" ) ) {
+                // making it start with a space char or a line start
+                buf.append( "(\\W|^)" );
+                substr += buf.length();
+                counter++;
+            }
+
+            int lastMatch = 0;
+            while ( m.find() ) {
+                if ( this.variables == Collections.EMPTY_MAP ) {
+                    this.variables = new HashMap( 2 );
+                }
+                
+                // calculating and fixing variable offset 
+                String before = escapedKey.substring( lastMatch, Math.max( m.start(), lastMatch) );
+                lastMatch = m.end()+1;
+                Matcher m2 = PAREN_FINDER.matcher( before );
+                while( m2.find() ) {
+                    counter++;
+                }
+                
+                // creating capture group for variable
+                this.variables.put( m.group( 2 ),
+                                    new Integer( counter++ ) );
+                m.appendReplacement( buf,
+                                     m.group( 1 ) + "(.*?)" );
+            }
+            m.appendTail( buf );
+
+            // if pattern ends with a variable, append a line end to avoid multiple line matching
+            if ( buf.toString().endsWith( "(.*?)" ) ) {
+                buf.append( "$" );
+            } else {
+                buf.append( "(\\W|$)" );
+            }
+
+            // setting the key pattern and making it space insensitive
+            String pat = buf.toString();
+            if ( pat.substring( substr ).trim().startsWith( "-" ) && (!pat.substring( substr ).trim().startsWith( "-\\s*" )) ) {
+                pat = pat.substring( 0,
+                                     pat.indexOf( '-' ) + 1 ) + "\\s*" + pat.substring( pat.indexOf( '-' ) + 1 ).trim();
+            }
+            pat = pat.replaceAll( "\\s+",
+                                  "\\\\s+" );
+            this.keyPattern = Pattern.compile( pat,
+                                               Pattern.DOTALL | Pattern.MULTILINE );
+
+        } else {
+            this.keyPattern = null;
+        }
+        // update value mapping
+        this.setMappingValue( this.value );
+    }
+
+    /**
+     * @param section the section to set
+     */
+    public void setSection(final Section section) {
+        this.section = section;
+    }
+
+    /**
+     * @param value the value to set
+     */
+    public void setMappingValue(final String value) {
+        this.valuePattern = value;
+        this.value = value;
+        if ( value != null ) {
+            this.valuePattern = this.valuePattern.replaceAll( "\\\\n",
+                                                              "\n" ).replaceAll( "\\$",
+                                                                                 "\\\\\\$" );
+            for ( final Iterator it = this.variables.entrySet().iterator(); it.hasNext(); ) {
+                final Map.Entry entry = (Map.Entry) it.next();
+                final String var = (String) entry.getKey();
+                final int pos = ((Integer) entry.getValue()).intValue();
+
+                this.valuePattern = this.valuePattern.replaceAll( "\\{" + var + "\\}",
+                                                                  "\\$" + pos );
+            }
+        }
+    }
+
+    /**
+     * @param metadata the metadata to set
+     */
+    public void setMetaData(final MetaData metadata) {
+        this.metadata = metadata;
+    }
+
+    /**
+     * @return the keyPattern
+     */
+    public Pattern getKeyPattern() {
+        return this.keyPattern;
+    }
+
+    /**
+     * @return the valuePattern
+     */
+    public String getValuePattern() {
+        return this.valuePattern;
+    }
+
+    /**
+     * @return the variables
+     */
+    public Map getVariables() {
+        return this.variables;
+    }
+
+    public String toPatternString() {
+        return this.section + "[" + this.metadata + "]" + this.keyPattern.pattern() + "=" + this.valuePattern;
+    }
+
+    public String toString() {
+        return this.section + "[" + this.metadata + "]" + this.key + "=" + this.value;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((this.key == null) ? 0 : this.key.hashCode());
+        result = PRIME * result + ((this.metadata == null) ? 0 : this.metadata.hashCode());
+        result = PRIME * result + ((this.section == null) ? 0 : this.section.hashCode());
+        result = PRIME * result + ((this.value == null) ? 0 : this.value.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final DefaultDSLMappingEntry other = (DefaultDSLMappingEntry) obj;
+        if ( this.key == null ) {
+            if ( other.key != null ) {
+                return false;
+            }
+        } else if ( !this.key.equals( other.key ) ) {
+            return false;
+        }
+        if ( this.metadata == null ) {
+            if ( other.metadata != null ) {
+                return false;
+            }
+        } else if ( !this.metadata.equals( other.metadata ) ) {
+            return false;
+        }
+        if ( this.section == null ) {
+            if ( other.section != null ) {
+                return false;
+            }
+        } else if ( !this.section.equals( other.section ) ) {
+            return false;
+        }
+        if ( this.value == null ) {
+            if ( other.value != null ) {
+                return false;
+            }
+        } else if ( !this.value.equals( other.value ) ) {
+            return false;
+        }
+        return true;
+    }
+
+    public List getErrors() {
+        // TODO Need to implement validation here
+        return Collections.EMPTY_LIST;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpander.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpander.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpander.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,348 @@
+package org.drools.lang.dsl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.drools.compiler.DroolsError;
+import org.drools.lang.Expander;
+import org.drools.lang.ExpanderException;
+
+/** 
+ * The default expander uses String templates to provide pseudo natural language,
+ * as well as general DSLs.
+ * 
+ * For most people, this should do the job just fine. 
+ */
+public class DefaultExpander
+    implements
+    Expander {
+
+    // Be EXTREMELLY careful if you decide to change bellow regexp's
+    //
+    // bellow regexp is used to find and parse rule parts: header, LHS, RHS, trailer, etc
+    private static final String  rulesExpr    = "(^\\s*rule.*?$.*?^\\s*when.*?)$(.*?)(^\\s*then.*?$)(.*?)(^\\s*end)";
+    // bellow regexp is used to find and parse query parts: header, condition, trailer
+    private static final String  queryExpr    = "(^\\s*query.*?)$(.*?)(^\\s*end)";
+
+    // bellow we combine and compile above expressions into a pattern object
+    private static final Pattern finder       = Pattern.compile( "(" + rulesExpr + "|" + queryExpr + ")",
+                                                                 Pattern.DOTALL | Pattern.MULTILINE );
+    // bellow pattern is used to find a pattern's constraint list
+    private static final Pattern patternFinder = Pattern.compile( "\\((.*?)\\)" );
+
+    private final Map                  mappings     = new HashMap();
+    private final List                 keywords     = new LinkedList();
+    private final List                 condition    = new LinkedList();
+    private final List                 consequence  = new LinkedList();
+    private final List                 cleanup      = new LinkedList();
+
+    private List                 errors       = Collections.EMPTY_LIST;
+
+    /**
+     * Creates a new DefaultExpander
+     */
+    public DefaultExpander() {
+        this.cleanup.add( new DefaultDSLMappingEntry( DSLMappingEntry.KEYWORD,
+                                                      null,
+                                                      "expander {name}",
+                                                      "" ) );
+    }
+
+    /**
+     * Add the new mapping to this expander.
+     * @param mapping
+     */
+    public void addDSLMapping(final DSLMapping mapping) {
+        this.mappings.put( mapping.getIdentifier(),
+                           mapping );
+        for ( final Iterator it = mapping.getEntries().iterator(); it.hasNext(); ) {
+            final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+            if ( entry.getSection() == DSLMappingEntry.KEYWORD ) {
+                this.keywords.add( entry );
+            } else if ( entry.getSection() == DSLMappingEntry.CONDITION ) {
+                this.condition.add( entry );
+            } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) {
+                this.consequence.add( entry );
+            } else {
+                // if any, then add to them both condition and consequence
+                this.condition.add( entry );
+                this.consequence.add( entry );
+            }
+        }
+    }
+
+    /**
+     * @inheritDoc
+     * @throws IOException 
+     */
+    public String expand(final Reader drlReader) throws IOException {
+        return this.expand( this.loadDrlFile( drlReader ) );
+    }
+
+    /**
+     * @inheritDoc
+     * @throws IOException 
+     */
+    public String expand(String drl) {
+        drl = expandKeywords( drl );
+        drl = cleanupExpressions( drl );
+        final StringBuffer buf = expandConstructions( drl );
+        return buf.toString();
+    }
+
+    /**
+     * Expand constructions like rules and queries
+     * 
+     * @param drl
+     * @return
+     */
+    private StringBuffer expandConstructions(final String drl) {
+        // parse and expand specific areas
+        final Matcher m = finder.matcher( drl );
+        
+        
+        
+        final StringBuffer buf = new StringBuffer();
+        while ( m.find() ) {
+            final StringBuffer expanded = new StringBuffer();
+            final String constr = m.group( 1 ).trim();
+            if ( constr.startsWith( "rule" ) ) {
+                // match rule
+                String headerFragment = m.group( 2 );
+                expanded.append( headerFragment ); // adding rule header and attributes
+                String lhsFragment = m.group( 3 );
+                expanded.append( this.expandLHS( lhsFragment, countNewlines( headerFragment ) + 1 ) ); // adding expanded LHS
+                String thenFragment = m.group( 4 ); 
+                
+                expanded.append( thenFragment ); // adding "then" header
+                expanded.append( this.expandRHS( m.group( 5 ), countNewlines( headerFragment + lhsFragment + thenFragment ) + 1 ) ); // adding expanded RHS
+                expanded.append( m.group( 6 ) ); // adding rule trailer
+                expanded.append( "\n" );
+            } else if ( constr.startsWith( "query" ) ) {
+                // match query
+                String fragment = m.group( 7 );
+                expanded.append( fragment ); // adding query header and attributes
+                expanded.append( this.expandLHS( m.group( 8 ), countNewlines( fragment ) + 1 ) ); // adding expanded LHS
+                expanded.append( m.group( 9 ) ); // adding query trailer
+                expanded.append( "\n" );
+            } else {
+                // strange behavior
+                this.addError( new ExpanderException( "Unable to expand statement: " + constr,
+                                                      0 ) );
+            }
+            m.appendReplacement( buf,
+                                 expanded.toString().replaceAll( "\\$",
+                                                                 "\\\\\\$" ) );
+        }
+        m.appendTail( buf );
+        return buf;
+    }
+
+    private int countNewlines(final String drl) {
+        char[] cs = drl.toCharArray();
+        int count = 0;
+        for ( int i = 0; i < cs.length; i++ ) {
+            { if (cs[i] == '\n') count++; }
+        }
+        return count;
+    }
+
+    /**
+     * Clean up constructions that exists only in the unexpanded code
+     * 
+     * @param drl
+     * @return
+     */
+    private String cleanupExpressions(String drl) {
+        // execute cleanup
+        for ( final Iterator it = this.cleanup.iterator(); it.hasNext(); ) {
+            final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+            drl = entry.getKeyPattern().matcher( drl ).replaceAll( entry.getValuePattern() );
+        }
+        return drl;
+    }
+
+    /**
+     * Expand all configured keywords
+     * 
+     * @param drl
+     * @return
+     */
+    private String expandKeywords(String drl) {
+        // apply all keywords templates
+        for ( final Iterator it = this.keywords.iterator(); it.hasNext(); ) {
+            final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+            drl = entry.getKeyPattern().matcher( drl ).replaceAll( entry.getValuePattern() );
+        }
+        return drl;
+    }
+
+    /**
+     * Expand LHS for a construction
+     * @param lhs
+     * @param lineOffset 
+     * @return
+     */
+    private String expandLHS(final String lhs, int lineOffset) {
+        final StringBuffer buf = new StringBuffer();
+        final String[] lines = lhs.split( "\n" ); // since we assembled the string, we know line breaks are \n
+        final String[] expanded = new String[lines.length]; // buffer for expanded lines
+        int lastExpanded = -1;
+        int lastPattern = -1;
+        for ( int i = 0; i < lines.length; i++ ) {
+            final String trimmed = lines[i].trim();
+            expanded[++lastExpanded] = lines[i];
+
+            if ( trimmed.length() == 0 || trimmed.startsWith( "#" ) || trimmed.startsWith( "//" ) ) { // comments
+                // do nothing
+            } else if ( trimmed.startsWith( ">" ) ) { // passthrough code
+                // simply remove the passthrough mark character
+                expanded[lastExpanded] = lines[i].replaceFirst( ">",
+                                                                " " );
+            } else { // regular expansion
+                // expand the expression
+                for ( final Iterator it = this.condition.iterator(); it.hasNext(); ) {
+                    final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+                    expanded[lastExpanded] = entry.getKeyPattern().matcher( expanded[lastExpanded] ).replaceAll( entry.getValuePattern() );
+                }
+
+                // do we need to report errors for that?
+                if ( lines[i].equals( expanded[lastExpanded] ) ) {
+                    // report error
+                    this.addError( new ExpanderException( "Unable to expand: " + lines[i].replaceAll( "[\n\r]", "" ).trim(),
+                                                          i + lineOffset ) );
+                }
+                // but if the original starts with a "-", it means we need to add it
+                // as a constraint to the previous pattern
+                if ( trimmed.startsWith( "-" ) && (!lines[i].equals( expanded[lastExpanded] )) ) {
+                    int lastMatchStart = -1;
+                    int lastMatchEnd = -1;
+                    String constraints = "";
+                    if ( lastPattern >= 0 ) {
+                        final Matcher m2 = patternFinder.matcher( expanded[lastPattern] );
+                        while ( m2.find() ) {
+                            lastMatchStart = m2.start();
+                            lastMatchEnd = m2.end();
+                            constraints = m2.group( 1 ).trim();
+                        }
+                    }
+                    if ( lastMatchStart > -1 ) {
+                        // rebuilding previous pattern structure
+                        expanded[lastPattern] = expanded[lastPattern].substring( 0,
+                                                                               lastMatchStart ) + "( " + constraints + ((constraints.length() == 0) ? "" : ", ") + expanded[lastExpanded].trim() + " )" + expanded[lastPattern].substring( lastMatchEnd );
+                    } else {
+                        // error, pattern not found to add constraint to
+                        // TODO: can we report character position?
+                        this.addError( new ExpanderException( "No pattern was found to add the constraint to: " + lines[i].trim(),
+                                                              i + lineOffset ) );
+                    }
+                    lastExpanded--;
+                } else {
+                    lastPattern = lastExpanded;
+                }
+            }
+        }
+        for ( int i = 0; i <= lastExpanded; i++ ) {
+            buf.append( expanded[i] );
+            buf.append( "\n" );
+        }
+
+        return buf.toString();
+    }
+
+    /**
+     * Expand RHS for rules
+     * 
+     * @param lhs
+     * @return
+     */
+    private String expandRHS(final String lhs, int lineOffset) {
+        final StringBuffer buf = new StringBuffer();
+        final String[] lines = lhs.split( "\n" ); // since we assembled the string, we know line breaks are \n
+        for ( int i = 0; i < lines.length; i++ ) {
+            final String trimmed = lines[i].trim();
+
+            if ( trimmed.length() == 0 || trimmed.startsWith( "#" ) || trimmed.startsWith( "//" ) ) { // comments
+                buf.append( lines[i] );
+            } else if ( trimmed.startsWith( ">" ) ) { // passthrough code
+                buf.append( lines[i].replaceFirst( ">",
+                                                   "" ) );
+            } else { // regular expansions
+                String expanded = lines[i];
+                for ( final Iterator it = this.consequence.iterator(); it.hasNext(); ) {
+                    final DSLMappingEntry entry = (DSLMappingEntry) it.next();
+                    expanded = entry.getKeyPattern().matcher( expanded ).replaceAll( entry.getValuePattern() );
+                }
+                buf.append( expanded );
+                // do we need to report errors for that?
+                if ( lines[i].equals( expanded ) ) {
+                    // report error
+                    this.addError( new ExpanderException( "Unable to expand: " + lines[i],
+                                                          i + lineOffset ) );
+                }
+            }
+            buf.append( "\n" );
+        }
+
+        return buf.toString();
+    }
+
+    // Reads the stream into a String
+    private String loadDrlFile(final Reader drl) throws IOException {
+        final StringBuffer buf = new StringBuffer();
+        final BufferedReader input = new BufferedReader( drl );
+        String line = null;
+        while ( (line = input.readLine()) != null ) {
+            buf.append( line );
+            buf.append( "\n" );
+        }
+        return buf.toString();
+    }
+
+    private void addError(final DroolsError error) {
+        if ( this.errors == Collections.EMPTY_LIST ) {
+            this.errors = new LinkedList();
+        }
+        this.errors.add( error );
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public List getErrors() {
+        return this.errors;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean hasErrors() {
+        return !this.errors.isEmpty();
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpanderResolver.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpanderResolver.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/DefaultExpanderResolver.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+package org.drools.lang.dsl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.lang.Expander;
+import org.drools.lang.ExpanderResolver;
+
+/**
+ * The default expander resolver will provide instances of the DefaultExpander.
+ * The DefaultExpander uses templates to provide DSL and pseudo
+ * natural language support.
+ * 
+ * @author Michael Neale
+ */
+public class DefaultExpanderResolver
+    implements
+    ExpanderResolver {
+
+    private final Map expanders = new HashMap();
+
+    /**
+     * Create an empty resolver, which you will then
+     * call addExpander multiple times, to map a specific expander
+     * with a name that will be found in the drl after the expander keyword.
+     */
+    public DefaultExpanderResolver() {
+    }
+
+    /**
+     * This will load up a DSL from the reader specified.
+     * This will make the expander available to any parser 
+     * regardless of name.
+     * 
+     * The DSL expander will be the default expander.
+     * 
+     * This is the constructor most people should use.
+     */
+    public DefaultExpanderResolver(final Reader reader) throws IOException {
+        final DSLMappingFile file = new DSLMappingFile();
+        if ( file.parseAndLoad( reader ) ) {
+            final Expander expander = new DefaultExpander();
+            expander.addDSLMapping( file.getMapping() );
+            this.expanders.put( "*",
+                                expander );
+        } else {
+            throw new RuntimeDroolsException( "Error parsing and loading DSL file." + file.getErrors() );
+        }
+    }
+
+    /**
+     * Add an expander with the given name, which will be used
+     * by looking for the "expander" keyword in the DRL.
+     * 
+     * If a default expander is installed, it will always be returned
+     * if none matching the given name can be found.
+     * 
+     * You don't need to use this unless you have multiple expanders/DSLs
+     * involved when compiling multiple rule packages at the same time.
+     * If you don't know what that sentence means, you probably don't need to use this method.
+     */
+    public void addExpander(final String name,
+                            final Expander expander) {
+        this.expanders.put( name,
+                            expander );
+    }
+
+    public Expander get(final String name,
+                        final String config) {
+        if ( this.expanders.containsKey( name ) ) {
+            return (Expander) this.expanders.get( name );
+        } else {
+            final Expander exp = (Expander) this.expanders.get( "*" );
+            if ( exp == null ) {
+                throw new IllegalArgumentException( "Unable to provide an expander for " + name + " or a default expander." );
+            }
+            return exp;
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/MappingError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/MappingError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/lang/dsl/MappingError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.lang.dsl;
+
+import org.drools.compiler.DroolsError;
+
+/**
+ * MappingError
+ * A class to represent errors found in a DSL mapping 
+ *
+ * @author <a href="mailto:tirelli at post.com">Edson Tirelli</a>
+ *
+ * Created: 11/04/2006
+ */
+public class MappingError extends DroolsError {
+    public static final int TEMPLATE_UNKNOWN       = 0;
+    public static final int TEMPLATE_NATURAL       = 1;
+    public static final int TEMPLATE_TARGET        = 2;
+
+    public static final int ERROR_UNUSED_TOKEN     = 21;
+    public static final int ERROR_UNDECLARED_TOKEN = 22;
+    public static final int ERROR_INVALID_TOKEN    = 23;
+    public static final int ERROR_UNMATCHED_BRACES = 24;
+
+    private final int       errorCode;
+    private final int       template;
+    private final int       offset;
+    private final String    token;
+    private String          templateText;
+    private final int[]     line;
+
+    public MappingError(final int errorCode,
+                        final int template,
+                        final int offset,
+                        final String token,
+                        final String templateText,
+                        final int line ) {
+        this.errorCode = errorCode;
+        this.template = template;
+        this.token = token;
+        this.offset = offset;
+        this.templateText = templateText;
+        this.line = new int[] { line };
+    }
+
+    /**
+     * Returns this error code
+     * @return
+     */
+    public int getErrorCode() {
+        return this.errorCode;
+    }
+    
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    /**
+     * @return the offset
+     */
+    public int getOffset() {
+        return this.offset;
+    }
+
+    /**
+     * @return the template
+     */
+    public int getTemplate() {
+        return this.template;
+    }
+
+    /**
+     * @return the original content.
+     */
+    public String getTemplateText() {
+        return this.templateText;
+    }
+
+    /**
+     * @inheritDoc 
+     *
+     * @see org.drools.compiler.DroolsError#getMessage()
+     */
+    public String getMessage() {
+        switch ( this.errorCode ) {
+            case ERROR_UNUSED_TOKEN :
+                return "Warning, the token " + this.token + " not used in the mapping.";
+            case ERROR_UNDECLARED_TOKEN :
+                return "Warning, the token " + this.token + " not found in the expression. (May not be a problem).";
+            case ERROR_INVALID_TOKEN :
+                return "Invalid token declaration at offset " + this.offset + ": " + this.token;
+            case ERROR_UNMATCHED_BRACES :
+                return "Unexpected } found at offset " + this.offset;
+            default :
+                return "Unkown error at offset: " + this.offset;
+        }
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ActionNodeBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ActionNodeBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ActionNodeBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools.process.builder;
+
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.process.core.Process;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.node.ActionNode;
+
+public class ActionNodeBuilder
+    implements
+    ProcessNodeBuilder {
+
+    public void build(Process process,
+                           ProcessDescr processDescr,
+                           ProcessBuildContext context,
+                           Node node) {
+        ActionNode actionNode = ( ActionNode ) node;
+        DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
+        ActionDescr actionDescr = new ActionDescr();
+        actionDescr.setText( action.getConsequence() );   
+        
+        Dialect dialect = context.getDialectRegistry().getDialect( action.getDialect() );            
+        
+        dialect.getActionBuilder().build( context, actionNode, actionDescr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.process.builder;
+
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.process.core.Process;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.workflow.core.Node;
+
+
+public interface ProcessNodeBuilder {
+    public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+package org.drools.process.builder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.Split;
+
+public class ProcessNodeBuilderRegistry {
+    private Map<Class< ? extends Node>, ProcessNodeBuilder> registry;
+
+    public ProcessNodeBuilderRegistry() {
+        this.registry = new HashMap<Class< ? extends Node>, ProcessNodeBuilder>();
+
+        register( ActionNode.class,
+                  new ActionNodeBuilder() );
+        register( Split.class,
+                  new SplitNodeBuilder() );
+    }
+
+    public void register(Class< ? extends Node> cls,
+                         ProcessNodeBuilder builder) {
+        this.registry.put( cls,
+                           builder );
+    }
+
+    public ProcessNodeBuilder getNodeBuilder(Node node) {
+        return this.registry.get( node.getClass() );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/SplitNodeBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/SplitNodeBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/SplitNodeBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,65 @@
+package org.drools.process.builder;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.process.core.Process;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConstraintImpl;
+import org.drools.workflow.core.node.Split;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+import org.drools.workflow.instance.impl.RuleConstraintEvaluator;
+
+public class SplitNodeBuilder
+    implements
+    ProcessNodeBuilder {
+
+    public void build(Process process,
+                           ProcessDescr processDescr,
+                           ProcessBuildContext context,
+                           Node node) {
+        Split splitNode = ( Split ) node;
+        
+        if ( splitNode.getType() == Split.TYPE_AND ) {
+            // we only process or/xor
+            return;
+        }
+        // we need to clone the map, so we can update the original while iterating.
+        Map map = new HashMap( splitNode.getConstraints() );
+        for ( Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
+            Entry entry = (Entry) it.next();
+            Connection connection = (Connection) entry.getKey();
+            ConstraintImpl constraint = (ConstraintImpl) entry.getValue();
+            
+            if ( "rule".equals( constraint.getType() )) {
+                RuleConstraintEvaluator ruleConstraint = new RuleConstraintEvaluator();
+                ruleConstraint.setDialect( constraint.getDialect() );
+                ruleConstraint.setName( constraint.getName() );
+                ruleConstraint.setPriority( constraint.getPriority() );
+                ruleConstraint.setPriority( constraint.getPriority() );
+                splitNode.setConstraint( connection, ruleConstraint );
+            } else if ( "code".equals( constraint.getType() ) ) {
+                ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator();
+                returnValueConstraint.setDialect( constraint.getDialect() );
+                returnValueConstraint.setName( constraint.getName() );
+                returnValueConstraint.setPriority( constraint.getPriority() );
+                returnValueConstraint.setPriority( constraint.getPriority() );
+                splitNode.setConstraint( connection, returnValueConstraint );            
+                
+                ReturnValueDescr returnValueDescr = new ReturnValueDescr();
+                returnValueDescr.setText( constraint.getConstraint() );
+                
+                Dialect dialect = context.getDialectRegistry().getDialect( constraint.getDialect() );                               
+                dialect.getReturnValueEvaluatorBuilder().build( context, returnValueConstraint, returnValueDescr );
+            }
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/process/builder/processNodeBuilder.conf
===================================================================

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/AccumulateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/AccumulateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/AccumulateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.rule.builder;
+
+/**
+ * A markup interface for AccumulateBuilders
+ * @author etirelli
+ *
+ */
+public interface AccumulateBuilder extends RuleConditionBuilder {
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ActionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ActionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ActionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.rule.builder;
+
+import org.drools.lang.descr.ActionDescr;
+import org.drools.workflow.core.node.ActionNode;
+
+public interface ActionBuilder {
+
+    public void build(final PackageBuildContext context,
+                      final ActionNode actionNode,
+                      final ActionDescr actionDescr);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/CollectBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/CollectBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/CollectBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.rule.Collect;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+
+/**
+ * @author etirelli
+ *
+ */
+public class CollectBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr,
+                                    final Pattern prefixPattern) {
+
+        final CollectDescr collectDescr = (CollectDescr) descr;
+        final PatternBuilder patternBuilder = (PatternBuilder) context.getDialect().getBuilder( PatternDescr.class );
+        final Pattern sourcePattern = (Pattern) patternBuilder.build( context,
+                                                                      collectDescr.getInputPattern() );
+
+        if ( sourcePattern == null ) {
+            return null;
+        }
+
+        final String className = "collect" + context.getNextId();
+        collectDescr.setClassMethodName( className );
+        
+        Pattern resultPattern = (Pattern) context.getBuildStack().peek();
+
+        final Collect collect = new Collect( sourcePattern,
+                                             resultPattern );
+        return collect;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ConsequenceBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ConsequenceBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ConsequenceBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools.rule.builder;
+
+public interface ConsequenceBuilder {
+
+    public void build(final RuleBuildContext context);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/EntryPointBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/EntryPointBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/EntryPointBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools.rule.builder;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.EntryPointDescr;
+import org.drools.rule.EntryPoint;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+
+/**
+ * A class capable of building entry point instances
+ * 
+ * @author etirelli
+ *
+ */
+public class EntryPointBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(RuleBuildContext context,
+                                      BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(RuleBuildContext context,
+                                      BaseDescr descr,
+                                      Pattern prefixPattern) {
+        final EntryPointDescr entryDescr = (EntryPointDescr) descr;
+
+        return new EntryPoint( entryDescr.getEntryId() );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ForallBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ForallBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ForallBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import java.util.Iterator;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.rule.Forall;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+
+/**
+ * @author etirelli
+ *
+ */
+public class ForallBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr,
+                                    final Pattern prefixPattern) {
+        final ForallDescr forallDescr = (ForallDescr) descr;
+
+        final PatternBuilder patternBuilder = (PatternBuilder) context.getDialect().getBuilder( PatternDescr.class );
+        final Pattern basePattern = (Pattern) patternBuilder.build( context,
+                                                                    forallDescr.getBasePattern() );
+
+        if ( basePattern == null ) {
+            return null;
+        }
+
+        final Forall forall = new Forall( basePattern );
+
+        // adding the newly created forall CE to the build stack
+        // this is necessary in case of local declaration usage
+        context.getBuildStack().push( forall );
+
+        for ( final Iterator it = forallDescr.getRemainingPatterns().iterator(); it.hasNext(); ) {
+            final Pattern anotherPattern = (Pattern) patternBuilder.build( context,
+                                                                           (PatternDescr) it.next() );
+            forall.addRemainingPattern( anotherPattern );
+        }
+
+        // poping the forall
+        context.getBuildStack().pop();
+
+        return forall;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FromBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FromBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FromBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.rule.builder;
+
+/**
+ * A markup interface for FromBuilders
+ * 
+ * @author etirelli
+ *
+ */
+public interface FromBuilder extends RuleConditionBuilder {
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FunctionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FunctionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/FunctionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+package org.drools.rule.builder;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+import java.util.Map;
+
+import org.drools.base.TypeResolver;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.rule.Package;
+
+public interface FunctionBuilder {
+    public String build(final Package pkg,
+                        final FunctionDescr functionDescr,
+                        final TypeResolver typeResolver,
+                        final Map lineMappings,
+                        final List errors);
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/GroupElementBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/GroupElementBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/GroupElementBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import java.util.Iterator;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.rule.GroupElement;
+import org.drools.rule.GroupElementFactory;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+
+/**
+ * @author etirelli
+ *
+ */
+public class GroupElementBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr,
+                                    final Pattern prefixPattern) {
+        final ConditionalElementDescr cedescr = (ConditionalElementDescr) descr;
+
+        final GroupElement ge = newGroupElementFor( cedescr.getClass() );
+        context.getBuildStack().push( ge );
+
+        if ( prefixPattern != null ) {
+            ge.addChild( prefixPattern );
+        }
+
+        // iterate over child descriptors
+        for ( final Iterator it = cedescr.getDescrs().iterator(); it.hasNext(); ) {
+            // gets child to build
+            final BaseDescr child = (BaseDescr) it.next();
+
+            // gets corresponding builder
+            final RuleConditionBuilder builder = context.getDialect().getBuilder( child.getClass() );
+
+            if ( builder != null ) {
+                final RuleConditionElement element = builder.build( context,
+                                                                    child );
+                // in case there is a problem with the building,
+                // builder will return null. Ex: ClassNotFound for the pattern type
+                if ( element != null ) {
+                    ge.addChild( element );
+                }
+            } else {
+                throw new RuntimeDroolsException( "BUG: no builder found for descriptor class " + child.getClass() );
+            }
+
+        }
+
+        context.getBuildStack().pop();
+
+        return ge;
+    }
+
+    private GroupElement newGroupElementFor(final Class descr) {
+        if ( AndDescr.class.isAssignableFrom( descr ) ) {
+            return GroupElementFactory.newAndInstance();
+        } else if ( OrDescr.class.isAssignableFrom( descr ) ) {
+            return GroupElementFactory.newOrInstance();
+        } else if ( NotDescr.class.isAssignableFrom( descr ) ) {
+            return GroupElementFactory.newNotInstance();
+        } else if ( ExistsDescr.class.isAssignableFrom( descr ) ) {
+            return GroupElementFactory.newExistsInstance();
+        } else {
+            throw new RuntimeDroolsException( "BUG: Not able to create a group element for descriptor: " + descr.getName() );
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PackageBuildContext.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PackageBuildContext.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PackageBuildContext.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Dialectable;
+import org.drools.rule.Package;
+
+/**
+ * A context for the current build
+ * 
+ * @author etirelli
+ */
+public class PackageBuildContext {
+
+    // current package
+    private Package                     pkg;        
+
+    // configuration
+    private PackageBuilderConfiguration configuration;
+    
+    // the contianer descr
+    private BaseDescr                   parentDescr;    
+
+    // errors found when building the current context
+    private List                        errors;
+
+    // list of generated methods
+    private List                        methods;
+
+    // map<String invokerClassName, String invokerCode> of generated invokers
+    private Map                         invokers;
+
+    // map<String invokerClassName, ConditionalElement ce> of generated invoker lookups
+    private Map                         invokerLookups;
+
+    // map<String invokerClassName, BaseDescr descr> of descriptor lookups
+    private Map                         descrLookups;
+
+    // a simple counter for generated names
+    private int                         counter;
+
+    private DialectRegistry             dialectRegistry;
+
+    private Dialect                     dialect;    
+    
+    public PackageBuildContext() {
+        
+    }
+
+    /**
+     * Default constructor
+     */
+    public void init(final PackageBuilderConfiguration configuration,
+                               final Package pkg,
+                               final BaseDescr parentDescr,
+                               final DialectRegistry dialectRegistry,
+                               final Dialect defaultDialect,
+                               final Dialectable component) {
+        this.configuration = configuration;
+        this.pkg = pkg;
+        
+        this.parentDescr = parentDescr;
+
+        this.methods = new ArrayList();
+        this.invokers = new HashMap();
+        this.invokerLookups = new HashMap();
+        this.descrLookups = new HashMap();
+        this.errors = new ArrayList();
+
+        this.dialectRegistry = dialectRegistry;
+        this.dialect = (component != null && component.getDialect() != null) ? this.dialectRegistry.getDialect( component.getDialect() ) : defaultDialect;
+    }
+    
+    public BaseDescr getParentDescr() {
+        return this.parentDescr;
+    }
+
+    public Dialect getDialect() {
+        return dialect;
+    }
+
+    /**
+     * Allows the change of the current dialect in the context
+     */
+    public void setDialect(Dialect dialect) {
+        this.dialect = dialect;
+    }
+
+    public Dialect getDialect(String dialectName) {
+        return (Dialect) this.dialectRegistry.getDialect( dialectName );
+    }
+    
+    public DialectRegistry getDialectRegistry() {
+        return this.dialectRegistry;
+    }
+
+    /**
+     * Returns the list of errors found while building the current context
+     * @return
+     */
+    public List getErrors() {
+        return this.errors;
+    }
+
+    /**
+     * Returns the current package being built
+     * @return
+     */
+    public Package getPkg() {
+        return this.pkg;
+    }
+
+    /**
+     * Returns the Map<String invokerClassName, BaseDescr descr> of descriptor lookups
+     * @return
+     */
+    public Map getDescrLookups() {
+        return this.descrLookups;
+    }
+
+    public void setDescrLookups(final Map descrLookups) {
+        this.descrLookups = descrLookups;
+    }
+
+    /**
+     * Returns the Map<String invokerClassName, ConditionalElement ce> of generated invoker lookups
+     * @return
+     */
+    public Map getInvokerLookups() {
+        return this.invokerLookups;
+    }
+
+    public void setInvokerLookups(final Map invokerLookups) {
+        this.invokerLookups = invokerLookups;
+    }
+
+    /**
+     * Returns the Map<String invokerClassName, String invokerCode> of generated invokers
+     * @return
+     */
+    public Map getInvokers() {
+        return this.invokers;
+    }
+
+    public void setInvokers(final Map invokers) {
+        this.invokers = invokers;
+    }
+
+    /**
+     * Returns the list of generated methods
+     * @return
+     */
+    public List getMethods() {
+        return this.methods;
+    }
+
+    public void setMethods(final List methods) {
+        this.methods = methods;
+    }
+
+    /**
+     * Returns current counter value for generated method names
+     * @return
+     */
+    public int getCurrentId() {
+        return this.counter;
+    }
+
+    public int getNextId() {
+        return this.counter++;
+    }
+    
+    public PackageBuilderConfiguration getConfiguration() {
+        return configuration;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PatternBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PatternBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PatternBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,882 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.base.ClassObjectType;
+import org.drools.base.FieldFactory;
+import org.drools.base.ValueType;
+import org.drools.base.evaluators.EvaluatorDefinition;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.facttemplates.FactTemplate;
+import org.drools.facttemplates.FactTemplateFieldExtractor;
+import org.drools.facttemplates.FactTemplateObjectType;
+import org.drools.lang.MVELDumper;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.RestrictionDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.rule.AbstractCompositeConstraint;
+import org.drools.rule.AbstractCompositeRestriction;
+import org.drools.rule.AndCompositeRestriction;
+import org.drools.rule.AndConstraint;
+import org.drools.rule.Declaration;
+import org.drools.rule.LiteralConstraint;
+import org.drools.rule.LiteralRestriction;
+import org.drools.rule.MultiRestrictionFieldConstraint;
+import org.drools.rule.OrCompositeRestriction;
+import org.drools.rule.OrConstraint;
+import org.drools.rule.Pattern;
+import org.drools.rule.PatternSource;
+import org.drools.rule.PredicateConstraint;
+import org.drools.rule.ReturnValueConstraint;
+import org.drools.rule.ReturnValueRestriction;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.VariableConstraint;
+import org.drools.rule.VariableRestriction;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.spi.Constraint;
+import org.drools.spi.Evaluator;
+import org.drools.spi.FieldExtractor;
+import org.drools.spi.FieldValue;
+import org.drools.spi.ObjectType;
+import org.drools.spi.Restriction;
+
+/**
+ * A builder for patterns
+ * 
+ * @author etirelli
+ */
+public class PatternBuilder
+    implements
+    RuleConditionBuilder {
+
+    public PatternBuilder() {
+    }
+
+    public RuleConditionElement build(RuleBuildContext context,
+                                      BaseDescr descr) {
+        return this.build( context,
+                           descr,
+                           null );
+    }
+
+    /**
+     * Build a pattern for the given descriptor in the current 
+     * context and using the given utils object
+     * 
+     * @param context
+     * @param utils
+     * @param patternDescr
+     * @return
+     */
+    public RuleConditionElement build(RuleBuildContext context,
+                                      BaseDescr descr,
+                                      Pattern prefixPattern) {
+
+        final PatternDescr patternDescr = (PatternDescr) descr;
+
+        if ( patternDescr.getObjectType() == null || patternDescr.getObjectType().equals( "" ) ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          patternDescr,
+                                                          null,
+                                                          "ObjectType not correctly defined" ) );
+            return null;
+        }
+
+        ObjectType objectType = null;
+
+        final FactTemplate factTemplate = context.getPkg().getFactTemplate( patternDescr.getObjectType() );
+
+        if ( factTemplate != null ) {
+            objectType = new FactTemplateObjectType( factTemplate );
+        } else {
+            try {
+                final Class userProvidedClass = context.getDialect().getTypeResolver().resolveType( patternDescr.getObjectType() );
+                final boolean isEvent = context.getPkg().isEvent( userProvidedClass );
+                objectType = new ClassObjectType( userProvidedClass,
+                                                  isEvent );
+            } catch ( final ClassNotFoundException e ) {
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              patternDescr,
+                                                              null,
+                                                              "Unable to resolve ObjectType '" + patternDescr.getObjectType() + "'" ) );
+                return null;
+            }
+        }
+
+        Pattern pattern;
+        if ( patternDescr.getIdentifier() != null && !patternDescr.getIdentifier().equals( "" ) ) {
+
+            if ( context.getDeclarationResolver().isDuplicated( patternDescr.getIdentifier() ) ) {
+                // This declaration already  exists, so throw an Exception
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              patternDescr,
+                                                              null,
+                                                              "Duplicate declaration for variable '" + patternDescr.getIdentifier() + "' in the rule '" + context.getRule().getName() + "'" ) );
+            }
+
+            pattern = new Pattern( context.getNextPatternId(),
+                                   0, // offset is 0 by default
+                                   objectType,
+                                   patternDescr.getIdentifier(),
+                                   patternDescr.isInternalFact() );
+        } else {
+            pattern = new Pattern( context.getNextPatternId(),
+                                   0, // offset is 0 by default
+                                   objectType,
+                                   null );
+        }
+        // adding the newly created pattern to the build stack
+        // this is necessary in case of local declaration usage
+        context.getBuildStack().push( pattern );
+
+        for ( final Iterator it = patternDescr.getDescrs().iterator(); it.hasNext(); ) {
+            final Object object = it.next();
+            buildConstraint( context,
+                             pattern,
+                             object,
+                             null );
+        }
+
+        if ( patternDescr.getSource() != null ) {
+            // we have a pattern source, so build it
+            RuleConditionBuilder builder = context.getDialect().getBuilder( patternDescr.getSource().getClass() );
+
+            PatternSource source = (PatternSource) builder.build( context,
+                                                                  patternDescr.getSource() );
+
+            pattern.setSource( source );
+        }
+
+        // poping the pattern
+        context.getBuildStack().pop();
+
+        return pattern;
+    }
+
+    private void buildConstraint(final RuleBuildContext context,
+                                 final Pattern pattern,
+                                 final Object constraint,
+                                 final AbstractCompositeConstraint container) {
+        if ( constraint instanceof FieldBindingDescr ) {
+            build( context,
+                   pattern,
+                   (FieldBindingDescr) constraint );
+        } else if ( constraint instanceof FieldConstraintDescr ) {
+            build( context,
+                   pattern,
+                   (FieldConstraintDescr) constraint,
+                   container );
+        } else if ( constraint instanceof PredicateDescr ) {
+            build( context,
+                   pattern,
+                   (PredicateDescr) constraint,
+                   container );
+        } else if ( constraint instanceof AndDescr ) {
+            AndConstraint and = new AndConstraint();
+            for ( Iterator it = ((AndDescr) constraint).getDescrs().iterator(); it.hasNext(); ) {
+                this.buildConstraint( context,
+                                      pattern,
+                                      it.next(),
+                                      and );
+            }
+            if ( container == null ) {
+                pattern.addConstraint( and );
+            } else {
+                container.addConstraint( and );
+            }
+        } else if ( constraint instanceof OrDescr ) {
+            OrConstraint or = new OrConstraint();
+            for ( Iterator it = ((OrDescr) constraint).getDescrs().iterator(); it.hasNext(); ) {
+                this.buildConstraint( context,
+                                      pattern,
+                                      it.next(),
+                                      or );
+            }
+            if ( container == null ) {
+                pattern.addConstraint( or );
+            } else {
+                container.addConstraint( or );
+            }
+        } else {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          (BaseDescr) constraint,
+                                                          null,
+                                                          "This is a bug: unable to build constraint descriptor: '" + constraint + "' in rule '" + context.getRule().getName() + "'" ) );
+        }
+    }
+
+    private void build(final RuleBuildContext context,
+                       final Pattern pattern,
+                       final FieldConstraintDescr fieldConstraintDescr,
+                       final AbstractCompositeConstraint container) {
+        String fieldName = fieldConstraintDescr.getFieldName();
+
+        if ( fieldName.indexOf( '[' ) > -1 ) {
+            rewriteToEval( context,
+                           pattern,
+                           fieldConstraintDescr,
+                           container );
+
+            // after building the predicate, we are done, so return
+            return;
+        }
+
+        if ( fieldName.indexOf( '.' ) > -1 ) {
+            // we have a composite field name
+            String[] identifiers = fieldName.split( "\\." );
+            if ( identifiers.length == 2 && ((pattern.getDeclaration() != null && identifiers[0].equals( pattern.getDeclaration().getIdentifier() )) || ("this".equals( identifiers[0] ))) ) {
+                // we have a self reference, so, it is fine to do direct access
+                fieldName = identifiers[1];
+            } else {
+                rewriteToEval( context,
+                               pattern,
+                               fieldConstraintDescr,
+                               container );
+
+                // after building the predicate, we are done, so return
+                return;
+            }
+        }
+
+        // if it is not a complex expression, just build a simple field constraint
+        final FieldExtractor extractor = getFieldExtractor( context,
+                                                            fieldConstraintDescr,
+                                                            pattern.getObjectType(),
+                                                            fieldName,
+                                                            false );
+        if ( extractor == null ) {
+            if ( fieldConstraintDescr.getFieldName().startsWith( "this." ) ) {
+                // it may still be MVEL special syntax, like map key syntax, so try eval
+                rewriteToEval( context,
+                               pattern,
+                               fieldConstraintDescr,
+                               container );
+
+                // after building the predicate, we are done, so return
+                return;
+            } else {
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              fieldConstraintDescr,
+                                                              null,
+                                                              "Unable to create Field Extractor for '" + fieldName + "' of '" + pattern.getObjectType().toString() + "' in rule '" + context.getRule().getName() + "'" ) );
+                return;
+            }
+        }
+
+        Restriction restriction = createRestriction( context,
+                                                     pattern,
+                                                     fieldConstraintDescr,
+                                                     fieldConstraintDescr.getRestriction(),
+                                                     extractor );
+
+        if ( restriction == null ) {
+            // error was already logged during restriction creation failure
+            return;
+        }
+
+        Constraint constraint = null;
+        if ( restriction instanceof AbstractCompositeRestriction ) {
+            constraint = new MultiRestrictionFieldConstraint( extractor,
+                                                              restriction );
+        } else if ( restriction instanceof LiteralRestriction ) {
+            constraint = new LiteralConstraint( extractor,
+                                                (LiteralRestriction) restriction );
+        } else if ( restriction instanceof VariableRestriction ) {
+            constraint = new VariableConstraint( extractor,
+                                                 (VariableRestriction) restriction );
+        } else if ( restriction instanceof ReturnValueRestriction ) {
+            constraint = new ReturnValueConstraint( extractor,
+                                                    (ReturnValueRestriction) restriction );
+        } else {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          fieldConstraintDescr,
+                                                          null,
+                                                          "This is a bug: Unkown restriction type '" + restriction.getClass() + "' for pattern '" + pattern.getObjectType().toString() + "' in rule '" + context.getRule().getName() + "'" ) );
+        }
+
+        if ( container == null ) {
+            pattern.addConstraint( constraint );
+        } else {
+            container.addConstraint( constraint );
+        }
+    }
+
+    private void rewriteToEval(final RuleBuildContext context,
+                               final Pattern pattern,
+                               final FieldConstraintDescr fieldConstraintDescr,
+                               final AbstractCompositeConstraint container) {
+        // it is a complex expression, so we need to turn it into an MVEL predicate
+        Dialect dialect = context.getDialect();
+        // switch to MVEL dialect
+        MVELDialect mvelDialect = (MVELDialect) context.getDialect( "mvel" );
+        boolean strictMode = mvelDialect.isStrictMode();
+        mvelDialect.setStrictMode( false );
+
+        context.setDialect( mvelDialect );
+
+        PredicateDescr predicateDescr = new PredicateDescr();
+        MVELDumper dumper = new MVELDumper();
+        predicateDescr.setContent( dumper.dump( fieldConstraintDescr ) );
+
+        build( context,
+               pattern,
+               predicateDescr,
+               container );
+
+        mvelDialect.setStrictMode( strictMode );
+        // fall back to original dialect
+        context.setDialect( dialect );
+    }
+
+    private Restriction createRestriction(final RuleBuildContext context,
+                                          final Pattern pattern,
+                                          final FieldConstraintDescr fieldConstraintDescr,
+                                          final RestrictionConnectiveDescr top,
+                                          final FieldExtractor extractor) {
+        Restriction[] restrictions = new Restriction[top.getRestrictions().size()];
+        int index = 0;
+
+        for ( Iterator it = top.getRestrictions().iterator(); it.hasNext(); ) {
+            RestrictionDescr restrictionDescr = (RestrictionDescr) it.next();
+
+            if ( restrictionDescr instanceof RestrictionConnectiveDescr ) {
+                restrictions[index++] = this.createRestriction( context,
+                                                                pattern,
+                                                                fieldConstraintDescr,
+                                                                (RestrictionConnectiveDescr) restrictionDescr,
+                                                                extractor );
+
+            } else {
+                restrictions[index] = buildRestriction( context,
+                                                        pattern,
+                                                        extractor,
+                                                        fieldConstraintDescr,
+                                                        restrictionDescr );
+                if ( restrictions[index] == null ) {
+                    context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                                  fieldConstraintDescr,
+                                                                  null,
+                                                                  "Unable to create restriction '" + restrictionDescr.toString() + "' for field '" + fieldConstraintDescr.getFieldName() + "' in the rule '" + context.getRule().getName() + "'" ) );
+                }
+                index++;
+            }
+        }
+
+        if ( restrictions.length > 1 ) {
+            AbstractCompositeRestriction composite = null;
+            if ( top.getConnective() == RestrictionConnectiveDescr.AND ) {
+                composite = new AndCompositeRestriction( restrictions );
+            } else if ( top.getConnective() == RestrictionConnectiveDescr.OR ) {
+                composite = new OrCompositeRestriction( restrictions );
+            } else {
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              fieldConstraintDescr,
+                                                              null,
+                                                              "This is a bug: Impossible to create a composite restriction for connective: " + top.getConnective() + "' for field '" + fieldConstraintDescr.getFieldName() + "' in the rule '"
+                                                                      + context.getRule().getName() + "'" ) );
+            }
+
+            return composite;
+        } else if ( restrictions.length == 1 ) {
+            return restrictions[0];
+        }
+        context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                      fieldConstraintDescr,
+                                                      null,
+                                                      "This is a bug: trying to create a restriction for an empty restriction list for field '" + fieldConstraintDescr.getFieldName() + "' in the rule '" + context.getRule().getName() + "'" ) );
+        return null;
+    }
+
+    private void build(final RuleBuildContext context,
+                       final Pattern pattern,
+                       final FieldBindingDescr fieldBindingDescr) {
+
+        if ( context.getDeclarationResolver().isDuplicated( fieldBindingDescr.getIdentifier() ) ) {
+            // This declaration already  exists, so throw an Exception
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          fieldBindingDescr,
+                                                          null,
+                                                          "Duplicate declaration for variable '" + fieldBindingDescr.getIdentifier() + "' in the rule '" + context.getRule().getName() + "'" ) );
+            return;
+        }
+
+        final FieldExtractor extractor = getFieldExtractor( context,
+                                                            fieldBindingDescr,
+                                                            pattern.getObjectType(),
+                                                            fieldBindingDescr.getFieldName(),
+                                                            true );
+        if ( extractor == null ) {
+            return;
+        }
+
+        pattern.addDeclaration( fieldBindingDescr.getIdentifier(),
+                                extractor );
+    }
+
+    private void build(final RuleBuildContext context,
+                       final Pattern pattern,
+                       final PredicateDescr predicateDescr,
+                       final AbstractCompositeConstraint container) {
+
+        final Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                        predicateDescr,
+                                                                                        predicateDescr.getContent(),
+                                                                                        new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+        if ( analysis == null ) {
+            // something bad happened
+            return;
+        }
+
+        // this will return an array with 2 lists
+        // where first list is from rule local variables
+        // second list is from global variables
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+        final List tupleDeclarations = new ArrayList();
+        final List factDeclarations = new ArrayList();
+        for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+            final Declaration decl = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
+            if ( decl.getPattern() == pattern ) {
+                factDeclarations.add( decl );
+            } else {
+                tupleDeclarations.add( decl );
+            }
+        }
+        this.createImplicitBindings( context,
+                                     pattern,
+                                     analysis.getNotBoundedIdentifiers(),
+                                     factDeclarations );
+
+        final Declaration[] previousDeclarations = (Declaration[]) tupleDeclarations.toArray( new Declaration[tupleDeclarations.size()] );
+        final Declaration[] localDeclarations = (Declaration[]) factDeclarations.toArray( new Declaration[factDeclarations.size()] );
+        final String[] requiredGlobals = (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] );
+
+        final PredicateConstraint predicateConstraint = new PredicateConstraint( null,
+                                                                                 previousDeclarations,
+                                                                                 localDeclarations,
+                                                                                 requiredGlobals );
+
+        if ( container == null ) {
+            pattern.addConstraint( predicateConstraint );
+        } else {
+            container.addConstraint( predicateConstraint );
+        }
+
+        final PredicateBuilder builder = context.getDialect().getPredicateBuilder();
+
+        builder.build( context,
+                       usedIdentifiers,
+                       previousDeclarations,
+                       localDeclarations,
+                       predicateConstraint,
+                       predicateDescr );
+
+    }
+
+    /**
+     * @param context
+     * @param utils
+     * @param pattern
+     * @param usedIdentifiers
+     * @param NOT_BOUND_INDEX
+     * @param factDeclarations
+     */
+    private void createImplicitBindings(final RuleBuildContext context,
+                                        final Pattern pattern,
+                                        final List unboundIdentifiers,
+                                        final List factDeclarations) {
+        // the following will create the implicit bindings
+        for ( int i = 0, size = unboundIdentifiers.size(); i < size; i++ ) {
+            final String identifier = (String) unboundIdentifiers.get( i );
+
+            Declaration declaration = createDeclarationObject( context,
+                                                               identifier,
+                                                               pattern );
+
+            if ( declaration != null ) {
+                factDeclarations.add( declaration );
+            }
+        }
+    }
+
+    /**
+     * Creates a declaration object for the field identified by the given identifier
+     * on the give pattern object
+     * 
+     * @param context
+     * @param identifier
+     * @param pattern
+     * @return
+     */
+    private Declaration createDeclarationObject(final RuleBuildContext context,
+                                                final String identifier,
+                                                final Pattern pattern) {
+        final FieldBindingDescr implicitBinding = new FieldBindingDescr( identifier,
+                                                                         identifier );
+
+        final FieldExtractor extractor = getFieldExtractor( context,
+                                                            implicitBinding,
+                                                            pattern.getObjectType(),
+                                                            implicitBinding.getFieldName(),
+                                                            false );
+        if ( extractor == null ) {
+            return null;
+        }
+
+        final Declaration declaration = new Declaration( identifier,
+                                                         extractor,
+                                                         pattern );
+        return declaration;
+    }
+
+    private Restriction buildRestriction(final RuleBuildContext context,
+                                         final Pattern pattern,
+                                         final FieldExtractor extractor,
+                                         final FieldConstraintDescr fieldConstraintDescr,
+                                         final RestrictionDescr restrictionDescr) {
+        Restriction restriction = null;
+        if ( restrictionDescr instanceof LiteralRestrictionDescr ) {
+            restriction = buildRestriction( context,
+                                            extractor,
+                                            fieldConstraintDescr,
+                                            (LiteralRestrictionDescr) restrictionDescr );
+        } else if ( restrictionDescr instanceof QualifiedIdentifierRestrictionDescr ) {
+            restriction = buildRestriction( context,
+                                            extractor,
+                                            fieldConstraintDescr,
+                                            (QualifiedIdentifierRestrictionDescr) restrictionDescr );
+        } else if ( restrictionDescr instanceof VariableRestrictionDescr ) {
+            restriction = buildRestriction( context,
+                                            extractor,
+                                            fieldConstraintDescr,
+                                            (VariableRestrictionDescr) restrictionDescr );
+        } else if ( restrictionDescr instanceof ReturnValueRestrictionDescr ) {
+            restriction = buildRestriction( context,
+                                            pattern,
+                                            extractor,
+                                            fieldConstraintDescr,
+                                            (ReturnValueRestrictionDescr) restrictionDescr );
+
+        }
+
+        return restriction;
+    }
+
+    private VariableRestriction buildRestriction(final RuleBuildContext context,
+                                                 final FieldExtractor extractor,
+                                                 final FieldConstraintDescr fieldConstraintDescr,
+                                                 final VariableRestrictionDescr variableRestrictionDescr) {
+        if ( variableRestrictionDescr.getIdentifier() == null || variableRestrictionDescr.getIdentifier().equals( "" ) ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          variableRestrictionDescr,
+                                                          null,
+                                                          "Identifier not defined for binding field '" + fieldConstraintDescr.getFieldName() + "'" ) );
+            return null;
+        }
+
+        Declaration declaration = context.getDeclarationResolver().getDeclaration( variableRestrictionDescr.getIdentifier() );
+
+        if ( declaration == null ) {
+            // trying to create implicit declaration
+            final Pattern thisPattern = (Pattern) context.getBuildStack().peek();
+            final Declaration implicit = this.createDeclarationObject( context,
+                                                                       variableRestrictionDescr.getIdentifier(),
+                                                                       thisPattern );
+            if ( implicit != null ) {
+                declaration = implicit;
+            } else {
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              variableRestrictionDescr,
+                                                              null,
+                                                              "Unable to return Declaration for identifier '" + variableRestrictionDescr.getIdentifier() + "'" ) );
+                return null;
+            }
+        }
+
+        final Evaluator evaluator = getEvaluator( context,
+                                                  variableRestrictionDescr,
+                                                  extractor.getValueType(),
+                                                  variableRestrictionDescr.getEvaluator(),
+                                                  variableRestrictionDescr.isNegated(),
+                                                  variableRestrictionDescr.getParameterText() );
+        if ( evaluator == null ) {
+            return null;
+        }
+
+        return new VariableRestriction( extractor,
+                                        declaration,
+                                        evaluator );
+    }
+
+    private LiteralRestriction buildRestriction(final RuleBuildContext context,
+                                                final FieldExtractor extractor,
+                                                final FieldConstraintDescr fieldConstraintDescr,
+                                                final LiteralRestrictionDescr literalRestrictionDescr) {
+        FieldValue field = null;
+        try {
+            field = FieldFactory.getFieldValue( literalRestrictionDescr.getValue(),
+                                                extractor.getValueType() );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          literalRestrictionDescr,
+                                                          e,
+                                                          "Unable to create a Field value of type  '" + extractor.getValueType() + "' and value '" + literalRestrictionDescr.getText() + "'" ) );
+        }
+
+        if ( field == null ) {
+            return null;
+        }
+
+        final Evaluator evaluator = getEvaluator( context,
+                                                  literalRestrictionDescr,
+                                                  extractor.getValueType(),
+                                                  literalRestrictionDescr.getEvaluator(),
+                                                  literalRestrictionDescr.isNegated(),
+                                                  literalRestrictionDescr.getParameterText() );
+        if ( evaluator == null ) {
+            return null;
+        }
+
+        return new LiteralRestriction( field,
+                                       evaluator,
+                                       extractor );
+    }
+
+    private Restriction buildRestriction(final RuleBuildContext context,
+                                         final FieldExtractor extractor,
+                                         final FieldConstraintDescr fieldConstraintDescr,
+                                         final QualifiedIdentifierRestrictionDescr qiRestrictionDescr) {
+        FieldValue field = null;
+        final String[] parts = qiRestrictionDescr.getText().split( "\\." );
+
+        // if only 2 parts, it may be a composed direct property access
+        if ( parts.length == 2 ) {
+            Declaration implicit = null;
+            if ( "this".equals( parts[0] ) ) {
+                implicit = this.createDeclarationObject( context,
+                                                         parts[1],
+                                                         (Pattern) context.getBuildStack().peek() );
+            } else {
+                final Declaration decl = context.getDeclarationResolver().getDeclaration( parts[0] );
+                // if a declaration exists, then it may be a variable direct property access, not an enum
+                if ( decl != null ) {
+                    if ( decl.isPatternDeclaration() ) {
+                        implicit = this.createDeclarationObject( context,
+                                                                 parts[1],
+                                                                 decl.getPattern() );
+
+                    } else {
+                        context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                                      qiRestrictionDescr,
+                                                                      "",
+                                                                      "Not possible to directly access the property '" + parts[1] + "' of declaration '" + parts[0] + "' since it is not a pattern" ) );
+                        return null;
+                    }
+                }
+            }
+
+            if ( implicit != null ) {
+                final Evaluator evaluator = getEvaluator( context,
+                                                          qiRestrictionDescr,
+                                                          extractor.getValueType(),
+                                                          qiRestrictionDescr.getEvaluator(),
+                                                          qiRestrictionDescr.isNegated(),
+                                                          qiRestrictionDescr.getParameterText() );
+                if ( evaluator == null ) {
+                    return null;
+                }
+
+                return new VariableRestriction( extractor,
+                                                implicit,
+                                                evaluator );
+            }
+        }
+
+        final int lastDot = qiRestrictionDescr.getText().lastIndexOf( '.' );
+        final String className = qiRestrictionDescr.getText().substring( 0,
+                                                                         lastDot );
+        final String fieldName = qiRestrictionDescr.getText().substring( lastDot + 1 );
+        try {
+            final Class staticClass = context.getDialect().getTypeResolver().resolveType( className );
+            field = FieldFactory.getFieldValue( staticClass.getField( fieldName ).get( null ),
+                                                extractor.getValueType() );
+        } catch ( final ClassNotFoundException e ) {
+            // nothing to do, as it is not a class name with static field
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          qiRestrictionDescr,
+                                                          e,
+                                                          "Unable to create a Field value of type  '" + extractor.getValueType() + "' and value '" + qiRestrictionDescr.getText() + "'" ) );
+        }
+
+        if ( field == null ) {
+            return null;
+        }
+
+        final Evaluator evaluator = getEvaluator( context,
+                                                  qiRestrictionDescr,
+                                                  extractor.getValueType(),
+                                                  qiRestrictionDescr.getEvaluator(),
+                                                  qiRestrictionDescr.isNegated(),
+                                                  qiRestrictionDescr.getParameterText() );
+        if ( evaluator == null ) {
+            return null;
+        }
+
+        return new LiteralRestriction( field,
+                                       evaluator,
+                                       extractor );
+    }
+
+    private ReturnValueRestriction buildRestriction(final RuleBuildContext context,
+                                                    final Pattern pattern,
+                                                    final FieldExtractor extractor,
+                                                    final FieldConstraintDescr fieldConstraintDescr,
+                                                    final ReturnValueRestrictionDescr returnValueRestrictionDescr) {
+        Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                  returnValueRestrictionDescr,
+                                                                                  returnValueRestrictionDescr.getContent(),
+                                                                                  new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+        final List tupleDeclarations = new ArrayList();
+        final List factDeclarations = new ArrayList();
+        for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+            final Declaration declaration = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
+            if ( declaration.getPattern() == pattern ) {
+                factDeclarations.add( declaration );
+            } else {
+                tupleDeclarations.add( declaration );
+            }
+        }
+
+        createImplicitBindings( context,
+                                pattern,
+                                analysis.getNotBoundedIdentifiers(),
+                                factDeclarations );
+
+        final Evaluator evaluator = getEvaluator( context,
+                                                  returnValueRestrictionDescr,
+                                                  extractor.getValueType(),
+                                                  returnValueRestrictionDescr.getEvaluator(),
+                                                  returnValueRestrictionDescr.isNegated(),
+                                                  returnValueRestrictionDescr.getParameterText() );
+        if ( evaluator == null ) {
+            return null;
+        }
+
+        final Declaration[] previousDeclarations = (Declaration[]) tupleDeclarations.toArray( new Declaration[tupleDeclarations.size()] );
+        final Declaration[] localDeclarations = (Declaration[]) factDeclarations.toArray( new Declaration[factDeclarations.size()] );
+        final String[] requiredGlobals = (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] );
+        final ReturnValueRestriction returnValueRestriction = new ReturnValueRestriction( extractor,
+                                                                                          previousDeclarations,
+                                                                                          localDeclarations,
+                                                                                          requiredGlobals,
+                                                                                          evaluator );
+
+        final ReturnValueBuilder builder = context.getDialect().getReturnValueBuilder();
+
+        builder.build( context,
+                       usedIdentifiers,
+                       previousDeclarations,
+                       localDeclarations,
+                       returnValueRestriction,
+                       returnValueRestrictionDescr );
+
+        return returnValueRestriction;
+    }
+
+    private FieldExtractor getFieldExtractor(final RuleBuildContext context,
+                                             final BaseDescr descr,
+                                             final ObjectType objectType,
+                                             final String fieldName,
+                                             final boolean reportError) {
+        FieldExtractor extractor = null;
+
+        if ( objectType.getValueType() == ValueType.FACTTEMPLATE_TYPE ) {
+            //@todo use extractor cache            
+            final FactTemplate factTemplate = ((FactTemplateObjectType) objectType).getFactTemplate();
+            extractor = new FactTemplateFieldExtractor( factTemplate,
+                                                        factTemplate.getFieldTemplateIndex( fieldName ) );
+        } else {
+            try {
+                ClassLoader classloader = context.getPkg().getPackageCompilationData().getClassLoader();
+                extractor = context.getDialect().getClassFieldExtractorCache().getExtractor( ((ClassObjectType) objectType).getClassType(),
+                                                                                             fieldName,
+                                                                                             classloader );
+            } catch ( final RuntimeDroolsException e ) {
+                if ( reportError ) {
+                    context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                                  descr,
+                                                                  e,
+                                                                  "Unable to create Field Extractor for '" + fieldName + "'" ) );
+                }
+            }
+        }
+
+        return extractor;
+    }
+
+    private Evaluator getEvaluator(final RuleBuildContext context,
+                                   final BaseDescr descr,
+                                   final ValueType valueType,
+                                   final String evaluatorString,
+                                   final boolean isNegated,
+                                   final String parameterText) {
+
+        final EvaluatorDefinition def = context.getConfiguration().getEvaluatorRegistry().getEvaluatorDefinition( evaluatorString );
+        if ( def == null ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          null,
+                                                          "Unable to determine the Evaluator for  ID '" + evaluatorString + "'" ) );
+        }
+
+        final Evaluator evaluator = def.getEvaluator( valueType,
+                                                      evaluatorString,
+                                                      isNegated,
+                                                      parameterText );
+
+        if ( evaluator == null ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          null,
+                                                          "Evaluator '" + (isNegated ? "not " : "") + evaluatorString + "' does not support type '" + valueType ) );
+        }
+
+        return evaluator;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PredicateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PredicateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/PredicateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.rule.builder;
+
+import java.util.List;
+
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.PredicateConstraint;
+
+public interface PredicateBuilder {
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final PredicateConstraint predicateConstraint,
+                      final PredicateDescr predicateDescr);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessBuildContext.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessBuildContext.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessBuildContext.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,49 @@
+package org.drools.rule.builder;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.ProcessDescr;
+
+import org.drools.process.core.Process;
+import org.drools.rule.Package;
+
+public class ProcessBuildContext extends PackageBuildContext {
+    private Process      process;
+    private ProcessDescr processDescr;
+
+    public ProcessBuildContext(final PackageBuilderConfiguration cfg,
+                               final Package pkg,
+                               final Process process,
+                               final BaseDescr processDescr,
+                               final DialectRegistry dialectRegistry,
+                               final Dialect defaultDialect) {
+        this.process = process;
+        this.processDescr = (ProcessDescr) processDescr;
+        init( cfg,
+              pkg,
+              processDescr,
+              dialectRegistry,
+              defaultDialect,
+              null );
+
+    }
+
+    public ProcessDescr getProcessDescr() {
+        return processDescr;
+    }
+
+    public void setProcessDescr(ProcessDescr processDescr) {
+        this.processDescr = processDescr;
+    }
+
+    public Process getProcess() {
+        return process;
+    }
+
+    public void setProcess(Process process) {
+        this.process = process;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessClassBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessClassBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ProcessClassBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools.rule.builder;
+
+
+public interface ProcessClassBuilder {
+
+    public String  buildRule(final ProcessBuildContext context);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/QueryBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/QueryBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/QueryBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,72 @@
+package org.drools.rule.builder;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DroolsQuery;
+import org.drools.base.FieldFactory;
+import org.drools.base.ValueType;
+import org.drools.base.evaluators.Operator;
+import org.drools.base.extractors.ArrayExtractor;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.rule.LiteralConstraint;
+import org.drools.rule.Pattern;
+import org.drools.spi.Extractor;
+import org.drools.spi.FieldExtractor;
+import org.drools.spi.FieldValue;
+import org.drools.spi.ObjectType;
+
+public class QueryBuilder {
+    public Pattern build(final RuleBuildContext context,
+                         final QueryDescr queryDescr) {
+        ObjectType objectType = new ClassObjectType( DroolsQuery.class );
+        final Pattern pattern = new Pattern( context.getNextPatternId(),
+                                             0, // offset is 0 by default
+                                             objectType,
+                                             null );
+        ClassLoader classloader = context.getPkg().getPackageCompilationData().getClassLoader();
+        final FieldExtractor extractor = context.getDialect().getClassFieldExtractorCache().getExtractor( DroolsQuery.class,
+                                                                                                          "name",
+                                                                                                          classloader );
+
+        final FieldValue field = FieldFactory.getFieldValue( queryDescr.getName(),
+                                                             ValueType.STRING_TYPE );
+
+        final LiteralConstraint constraint = new LiteralConstraint( extractor,
+                                                                    context.getConfiguration().getEvaluatorRegistry().getEvaluator( ValueType.STRING_TYPE,
+                                                                                                                                    Operator.EQUAL ),
+                                                                    field );
+        // adds appropriate constraint to the pattern
+        pattern.addConstraint( constraint );
+
+        Extractor arrayExtractor = null;
+        try {
+            arrayExtractor = context.getDialect().getClassFieldExtractorCache().getExtractor( ((ClassObjectType) objectType).getClassType(),
+                                                                                              "arguments",
+                                                                                              classloader );
+        } catch ( final RuntimeDroolsException e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          queryDescr,
+                                                          e,
+                                                          "Unable to create Field Extractor for 'getArguments'" ) );
+        }
+
+        String[] params = queryDescr.getParameters();
+        String[] types = queryDescr.getParameterTypes();
+        int i = 0;
+        try {
+            for ( i = 0; i < params.length; i++ ) {
+                pattern.addDeclaration( params[i],
+                                        new ArrayExtractor( arrayExtractor,
+                                                            i,
+                                                            context.getDialect().getTypeResolver().resolveType( types[i] ) ) );
+            }
+        } catch ( ClassNotFoundException e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          queryDescr,
+                                                          e,
+                                                          "Unable to resolve type '" + types[i] + " for parameter" + params[i] ) );
+        }
+        return pattern;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.rule.builder;
+
+import java.util.List;
+
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.ReturnValueRestriction;
+
+public interface ReturnValueBuilder {
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final ReturnValueRestriction returnValueRestriction,
+                      final ReturnValueRestrictionDescr returnValueRestrictionDescr);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.rule.builder;
+
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+
+public interface ReturnValueEvaluatorBuilder {
+
+    public void build(final PackageBuildContext context,
+                      final ReturnValueConstraintEvaluator returnValueConstraintEvaluator,
+                      final ReturnValueDescr returnValueDescr);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuildContext.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuildContext.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuildContext.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Package;
+import org.drools.rule.Query;
+import org.drools.rule.Rule;
+import org.drools.spi.DeclarationScopeResolver;
+import org.drools.util.DateUtils;
+
+/**
+ * A context for the current build
+ * 
+ * @author etirelli
+ */
+public class RuleBuildContext extends PackageBuildContext {
+
+    // current rule
+    private Rule                        rule;
+
+    // a stack for the rule building used
+    // for declarations resolution
+    private Stack                       buildStack;
+
+    // current Rule descriptor
+    private RuleDescr                   ruleDescr;
+
+    // available declarationResolver 
+    private DeclarationScopeResolver    declarationResolver;
+
+    // a simple counter for patterns
+    private int                         patternId = -1;
+
+    /**
+     * Default constructor
+     */
+    public RuleBuildContext(final PackageBuilderConfiguration configuration,
+                            final Package pkg,
+                            final RuleDescr ruleDescr,
+                            final DialectRegistry dialectRegistry,
+                            final Dialect defaultDialect) {
+        this.buildStack = new Stack();
+        this.declarationResolver = new DeclarationScopeResolver( new Map[]{pkg.getGlobals()},
+                                                                 this.buildStack );
+        this.ruleDescr = ruleDescr;
+
+        if ( ruleDescr instanceof QueryDescr ) {
+            this.rule = new Query( ruleDescr.getName() );
+        } else {
+            this.rule = new Rule( ruleDescr.getName() );
+        }        
+
+        // Assign attributes
+        setAttributes( this.rule,
+                       ruleDescr,
+                       ruleDescr.getAttributes() );
+        
+        init(configuration, pkg, ruleDescr, dialectRegistry, defaultDialect, this.rule );
+
+        getDialect().init( ruleDescr );
+    }
+
+    /**
+     * Returns the current Rule being built
+     * @return
+     */
+    public Rule getRule() {
+        return this.rule;
+    }
+
+    /**
+     * Returns the current RuleDescriptor
+     * @return
+     */
+    public RuleDescr getRuleDescr() {
+        return this.ruleDescr;
+    }
+
+    /**
+     * Returns the available declarationResolver instance
+     * @return
+     */
+    public DeclarationScopeResolver getDeclarationResolver() {
+        return this.declarationResolver;
+    }
+
+    /**
+     * Sets the available declarationResolver instance
+     * @param declarationResolver
+     */
+    public void setDeclarationResolver(final DeclarationScopeResolver variables) {
+        this.declarationResolver = variables;
+    }
+
+    public int getPatternId() {
+        return this.patternId;
+    }
+
+    public int getNextPatternId() {
+        return ++this.patternId;
+    }
+
+    public void setPatternId(final int patternId) {
+        this.patternId = patternId;
+    }
+
+    public Stack getBuildStack() {
+        return this.buildStack;
+    }
+
+    /**
+     * Sets rule Attributes
+     * 
+     * @param rule
+     * @param attributes
+     */
+    public static void setAttributes(final Rule rule,
+                                     final RuleDescr ruleDescr,
+                                     final List attributes) {
+
+        for ( final Iterator it = attributes.iterator(); it.hasNext(); ) {
+            final AttributeDescr attributeDescr = (AttributeDescr) it.next();
+            final String name = attributeDescr.getName();
+            if ( name.equals( "salience" ) ) {
+                try {
+                    ruleDescr.setSalience( attributeDescr.getValue() );
+                } catch ( Exception e ) {
+
+                }
+            } else if ( name.equals( "no-loop" ) ) {
+                if ( attributeDescr.getValue() == null ) {
+                    rule.setNoLoop( true );
+                } else {
+                    rule.setNoLoop( Boolean.valueOf( attributeDescr.getValue() ).booleanValue() );
+                }
+            } else if ( name.equals( "auto-focus" ) ) {
+                if ( attributeDescr.getValue() == null ) {
+                    rule.setAutoFocus( true );
+                } else {
+                    rule.setAutoFocus( Boolean.valueOf( attributeDescr.getValue() ).booleanValue() );
+                }
+            } else if ( name.equals( "agenda-group" ) ) {
+                rule.setAgendaGroup( attributeDescr.getValue() );
+            } else if ( name.equals( "activation-group" ) ) {
+                rule.setActivationGroup( attributeDescr.getValue() );
+            } else if ( name.equals( "ruleflow-group" ) ) {
+                rule.setRuleFlowGroup( attributeDescr.getValue() );
+            } else if ( name.equals( "lock-on-active" ) ) {
+                if ( attributeDescr.getValue() == null ) {
+                    rule.setLockOnActive( true );
+                } else {
+                    rule.setLockOnActive( Boolean.valueOf( attributeDescr.getValue() ).booleanValue() );
+                }
+            } else if ( name.equals( "duration" ) ) {
+                rule.setDuration( Long.parseLong( attributeDescr.getValue() ) );
+                rule.setAgendaGroup( "" );
+            } else if ( name.equals( "enabled" ) ) {
+                if ( attributeDescr.getValue() == null ) {
+                    rule.setEnabled( true );
+                } else {
+                    rule.setEnabled( Boolean.valueOf( attributeDescr.getValue() ).booleanValue() );
+                }
+            } else if ( name.equals( "date-effective" ) ) {
+                final Calendar cal = Calendar.getInstance();
+                cal.setTime( DateUtils.parseDate( attributeDescr.getValue() ) );
+                rule.setDateEffective( cal );
+            } else if ( name.equals( "date-expires" ) ) {
+                final Calendar cal = Calendar.getInstance();
+                cal.setTime( DateUtils.parseDate( attributeDescr.getValue() ) );
+                rule.setDateExpires( cal );
+            } else if ( name.equals( "dialect" ) ) {
+                rule.setDialect( attributeDescr.getValue() );
+            }
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package org.drools.rule.builder;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.RuntimeDroolsException;
+import org.drools.base.SalienceInteger;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.GroupElement;
+import org.drools.rule.Pattern;
+import org.drools.spi.Salience;
+
+/**
+ * This builds the rule structure from an AST.
+ * Generates semantic code where necessary if semantics are used.
+ * This is an internal API.
+ */
+public class RuleBuilder {
+
+    // Constructor
+    public RuleBuilder() {
+    }
+
+    /**
+     * Build the give rule into the 
+     * @param pkg
+     * @param ruleDescr
+     * @return
+     */
+    public void build(final RuleBuildContext context) {
+        RuleDescr ruleDescr = context.getRuleDescr();
+
+        final RuleConditionBuilder builder = (RuleConditionBuilder) context.getDialect().getBuilder( ruleDescr.getLhs().getClass() );
+        if ( builder != null ) {
+            Pattern prefixPattern = null;
+            if ( context.getRuleDescr() instanceof QueryDescr ) {
+                prefixPattern = context.getDialect().getQueryBuilder().build( context, ( QueryDescr ) context.getRuleDescr() );
+            }
+            final GroupElement ce = (GroupElement) builder.build( context,
+                                                                  ruleDescr.getLhs(),
+                                                                  prefixPattern );
+            
+            context.getRule().setLhs( ce );
+        } else {
+            throw new RuntimeDroolsException( "BUG: builder not found for descriptor class " + ruleDescr.getLhs().getClass() );
+        }
+
+        // Build the consequence and generate it's invoker/s
+        // generate the main rule from the previously generated s.
+        if ( !(ruleDescr instanceof QueryDescr) ) {
+            // do not build the consequence if we have a query
+
+            context.getDialect().getConsequenceBuilder().build( context );
+        }
+        
+        String salienceText = context.getRuleDescr().getSalience();
+        
+        try {
+            // First see if its an Integer
+            if ( salienceText != null && !salienceText.equals( "" )) {
+                Salience salience = new SalienceInteger( Integer.parseInt( salienceText ) );
+                context.getRule().setSalience( salience );
+            }
+        } catch (Exception e) {
+            // It wasn't an integer, so build as an expression
+            context.getDialect().getSalienceBuilder().build( context );    
+        }              
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleClassBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleClassBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleClassBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools.rule.builder;
+
+
+public interface RuleClassBuilder {
+
+    public String  buildRule(final RuleBuildContext context);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleConditionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleConditionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/RuleConditionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+
+/**
+ * An interface to define classes capable of building
+ * specific conditional elements.
+ * 
+ * @author etirelli
+ */
+public interface RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr);    
+    
+    public RuleConditionElement build(final RuleBuildContext context,
+                                    final BaseDescr descr,
+                                    final Pattern prefixPattern);
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/SalienceBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/SalienceBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/SalienceBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+package org.drools.rule.builder;
+
+public interface SalienceBuilder {
+    public void build(final RuleBuildContext context);    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/TimeWindowBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/TimeWindowBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/TimeWindowBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.rule.builder;
+
+/**
+ * A markup interface for TimeWindowBuilders
+ * @author mgroch
+ *
+ */
+public interface TimeWindowBuilder extends RuleConditionBuilder {
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaProcessBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaProcessBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaProcessBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,106 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.util.StringUtils;
+import org.mvel.MVELTemplateRegistry;
+import org.mvel.TemplateInterpreter;
+import org.mvel.TemplateRegistry;
+
+public class AbstractJavaProcessBuilder {
+
+    protected static final TemplateRegistry RULE_REGISTRY    = new MVELTemplateRegistry();
+    protected static final TemplateRegistry INVOKER_REGISTRY = new MVELTemplateRegistry();
+
+    static {
+        RULE_REGISTRY.registerTemplate( new InputStreamReader( AbstractJavaProcessBuilder.class.getResourceAsStream( "javaRule.mvel" ) ) );
+        INVOKER_REGISTRY.registerTemplate( new InputStreamReader( AbstractJavaProcessBuilder.class.getResourceAsStream( "javaInvokers.mvel" ) ) );
+        MVELDialect.setLanguageLevel( 4 );
+
+    }
+
+    public TemplateRegistry getRuleTemplateRegistry() {
+        return RULE_REGISTRY;
+    }
+
+    public TemplateRegistry getInvokerTemplateRegistry() {
+        return INVOKER_REGISTRY;
+    }
+
+    public Map createVariableContext(final String className,
+                                     final String text,
+                                     final ProcessBuildContext context,
+                                     final String[] globals) {
+        final Map map = new HashMap();
+
+        map.put( "methodName",
+                 className );
+
+        map.put( "package",
+                 context.getPkg().getName() );
+
+        map.put( "processClassName",
+                 StringUtils.ucFirst( context.getProcessDescr().getClassName() ) );
+
+        map.put( "invokerClassName",
+                 context.getProcessDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker" );
+
+        if ( text != null ) {
+            map.put( "text",
+                     text );
+
+            map.put( "hashCode",
+                     new Integer( text.hashCode() ) );
+        }
+
+        final List globalTypes = new ArrayList( globals.length );
+        for ( int i = 0, length = globals.length; i < length; i++ ) {
+            globalTypes.add( ((Class) context.getPkg().getGlobals().get( globals[i] )).getName().replace( '$',
+                                                                                                          '.' ) );
+        }
+
+        map.put( "globals",
+                 globals );
+
+        map.put( "globalTypes",
+                 globalTypes );
+
+        return map;
+    }
+
+    public void generatTemplates(final String ruleTemplate,
+                                 final String invokerTemplate,
+                                 final ProcessBuildContext context,
+                                 final String className,
+                                 final Map vars,
+                                 final Object invokerLookup,
+                                 final BaseDescr descrLookup) {
+        TemplateRegistry registry = getRuleTemplateRegistry();
+        context.getMethods().add( TemplateInterpreter.parse( registry.getTemplate( ruleTemplate ),
+                                                             null,
+                                                             vars,
+                                                             registry ) );
+
+        registry = getInvokerTemplateRegistry();
+        final String invokerClassName = context.getPkg().getName() + "." + context.getProcessDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker";
+        context.getInvokers().put( invokerClassName,
+                                   TemplateInterpreter.parse( registry.getTemplate( invokerTemplate ),
+                                                              null,
+                                                              vars,
+                                                              registry ) );
+
+        context.getInvokerLookups().put( invokerClassName,
+                                         invokerLookup );
+        context.getDescrLookups().put( invokerClassName,
+                                       descrLookup );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaRuleBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaRuleBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/AbstractJavaRuleBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,135 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.util.StringUtils;
+import org.mvel.MVEL;
+import org.mvel.MVELTemplateRegistry;
+import org.mvel.TemplateInterpreter;
+import org.mvel.TemplateRegistry;
+import org.mvel.optimizers.OptimizerFactory;
+
+public class AbstractJavaRuleBuilder {
+
+    protected static final TemplateRegistry RULE_REGISTRY    = new MVELTemplateRegistry();
+    protected static final TemplateRegistry INVOKER_REGISTRY = new MVELTemplateRegistry();
+
+    static {
+        MVEL.setThreadSafe( true );
+        MVELDialect.setLanguageLevel( 4 );   
+        OptimizerFactory.setDefaultOptimizer( "reflective" );
+        RULE_REGISTRY.registerTemplate( new InputStreamReader( AbstractJavaRuleBuilder.class.getResourceAsStream( "javaRule.mvel" ) ) );
+        INVOKER_REGISTRY.registerTemplate( new InputStreamReader( AbstractJavaRuleBuilder.class.getResourceAsStream( "javaInvokers.mvel" ) ) );
+        
+    }
+
+    public TemplateRegistry getRuleTemplateRegistry() {
+        return RULE_REGISTRY;
+    }
+
+    public TemplateRegistry getInvokerTemplateRegistry() {
+        return INVOKER_REGISTRY;
+    }
+
+    public Map createVariableContext(final String className,
+                                     final String text,
+                                     final RuleBuildContext context,
+                                     final Declaration[] declarations,
+                                     final Declaration[] localDeclarations,
+                                     final String[] globals) {
+        final Map map = new HashMap();
+
+        map.put( "methodName",
+                 className );
+
+        map.put( "package",
+                 context.getPkg().getName() );
+
+        map.put( "ruleClassName",
+                 StringUtils.ucFirst( context.getRuleDescr().getClassName() ) );
+
+        map.put( "invokerClassName",
+                 context.getRuleDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker" );
+
+        if ( text != null ) {
+            map.put( "text",
+                     text );
+
+            map.put( "hashCode",
+                     new Integer( text.hashCode() ) );
+        }
+
+        final String[] declarationTypes = new String[declarations.length];
+        for ( int i = 0, size = declarations.length; i < size; i++ ) {
+            declarationTypes[i] = ((JavaDialect) context.getDialect()).getTypeFixer().fix( declarations[i] );
+        }
+
+        map.put( "declarations",
+                 declarations );
+
+        map.put( "declarationTypes",
+                 declarationTypes );
+
+        if ( localDeclarations != null ) {
+            final String[] localDeclarationTypes = new String[localDeclarations.length];
+            for ( int i = 0, size = localDeclarations.length; i < size; i++ ) {
+                localDeclarationTypes[i] = ((JavaDialect) context.getDialect()).getTypeFixer().fix( localDeclarations[i] );
+            }
+
+            map.put( "localDeclarations",
+                     localDeclarations );
+
+            map.put( "localDeclarationTypes",
+                     localDeclarationTypes );
+        }
+
+        final List globalTypes = new ArrayList( globals.length );
+        for ( int i = 0, length = globals.length; i < length; i++ ) {
+            globalTypes.add( ((Class) context.getPkg().getGlobals().get( globals[i] )).getName().replace( '$',
+                                                                                                          '.' ) );
+        }
+
+        map.put( "globals",
+                 globals );
+
+        map.put( "globalTypes",
+                 globalTypes );
+
+        return map;
+    }
+
+    public void generatTemplates(final String ruleTemplate,
+                                 final String invokerTemplate,
+                                 final RuleBuildContext context,
+                                 final String className,
+                                 final Map vars,
+                                 final Object invokerLookup,
+                                 final BaseDescr descrLookup) {
+        TemplateRegistry registry = getRuleTemplateRegistry();
+        context.getMethods().add( TemplateInterpreter.parse( registry.getTemplate( ruleTemplate ),
+                                                             null,
+                                                             vars,
+                                                             registry ) );
+
+        registry = getInvokerTemplateRegistry();
+        final String invokerClassName = context.getPkg().getName() + "." + context.getRuleDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker";
+        context.getInvokers().put( invokerClassName,
+                                   TemplateInterpreter.parse( registry.getTemplate( invokerTemplate ),
+                                                              null,
+                                                              vars,
+                                                              registry ) );
+
+        context.getInvokerLookups().put( invokerClassName,
+                                         invokerLookup );
+        context.getDescrLookups().put( invokerClassName,
+                                       descrLookup );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DeclarationTypeFixer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DeclarationTypeFixer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DeclarationTypeFixer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+/**
+ * 
+ */
+package org.drools.rule.builder.dialect.java;
+
+import org.drools.rule.Declaration;
+import org.drools.util.ClassUtils;
+
+/**
+ * @author fburlet
+ * @author gdupriez
+ *
+ */
+public class DeclarationTypeFixer {
+
+    public String fix(final Declaration declaration) {
+        final Class classType = declaration.getExtractor().getExtractToClass();
+        return ClassUtils.canonicalName( classType );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DialectSession.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DialectSession.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/DialectSession.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+package org.drools.rule.builder.dialect.java;
+
+public class DialectSession {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.drools.base.accumulators.AccumulateFunction;
+import org.drools.base.accumulators.JavaAccumulatorFunctionExecutor;
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Accumulate;
+import org.drools.rule.Declaration;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
+
+/**
+ * A builder for the java dialect accumulate version
+ * 
+ * @author etirelli
+ */
+public class JavaAccumulateBuilder extends AbstractJavaRuleBuilder
+    implements
+    AccumulateBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+
+        final AccumulateDescr accumDescr = (AccumulateDescr) descr;
+
+        if ( !accumDescr.hasValidInput() ) {
+            return null;
+        }
+
+        final RuleConditionBuilder builder = context.getDialect().getBuilder( accumDescr.getInput().getClass() );
+
+        final RuleConditionElement source = builder.build( context,
+                                                           accumDescr.getInput() );
+
+        if ( source == null ) {
+            return null;
+        }
+
+        Accumulate accumulate = null;
+
+        if ( accumDescr.isExternalFunction() ) {
+            // if it is an external function, build a method for it
+
+            final JavaAnalysisResult analysis = (JavaAnalysisResult) context.getDialect().analyzeBlock( context,
+                                                                                                        accumDescr,
+                                                                                                        accumDescr.getExpression(),
+                                                                                                        new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+            final List tupleDeclarations = new ArrayList();
+            for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+                tupleDeclarations.add( context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) ) );
+            }
+
+            final Declaration[] previousDeclarations = (Declaration[]) tupleDeclarations.toArray( new Declaration[tupleDeclarations.size()] );
+            final String[] requiredGlobals = (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] );
+            final Declaration[] sourceDeclArr = (Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[0] );
+
+            final String className = "accumulateExpression" + context.getNextId();
+
+            final Map map = createVariableContext( className,
+                                                   (String) accumDescr.getExpression(),
+                                                   context,
+                                                   previousDeclarations,
+                                                   sourceDeclArr,
+                                                   requiredGlobals );
+            map.put( "readLocalsFromTuple", accumDescr.isMultiPattern() ? Boolean.TRUE : Boolean.FALSE );
+
+            AccumulateFunction function = context.getConfiguration().getAccumulateFunction( accumDescr.getFunctionIdentifier() );
+
+            JavaAccumulatorFunctionExecutor accumulator = new JavaAccumulatorFunctionExecutor( function );
+
+            accumulate = new Accumulate( source,
+                                         previousDeclarations,
+                                         sourceDeclArr,
+                                         accumulator );
+
+            generatTemplates( "returnValueMethod",
+                              "returnValueInvoker",
+                              context,
+                              className,
+                              map,
+                              accumulator,
+                              accumDescr );
+        } else {
+            // ELSE, if it is not an external function, build it using the regular java builder
+            final String className = "Accumulate" + context.getNextId();
+            accumDescr.setClassName( className );
+
+            final JavaAnalysisResult initCodeAnalysis = (JavaAnalysisResult) context.getDialect().analyzeBlock( context,
+                                                                                                                accumDescr,
+                                                                                                                accumDescr.getInitCode(),
+                                                                                                                new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+            final Dialect.AnalysisResult actionCodeAnalysis = context.getDialect().analyzeBlock( context,
+                                                                                                 accumDescr,
+                                                                                                 accumDescr.getActionCode(),
+                                                                                                 new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+            final Dialect.AnalysisResult resultCodeAnalysis = context.getDialect().analyzeExpression( context,
+                                                                                                      accumDescr,
+                                                                                                      accumDescr.getResultCode(),
+                                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final Set requiredDeclarations = new HashSet( initCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( actionCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( resultCodeAnalysis.getBoundIdentifiers()[0] );
+
+            final Set requiredGlobals = new HashSet( initCodeAnalysis.getBoundIdentifiers()[1] );
+            requiredGlobals.addAll( actionCodeAnalysis.getBoundIdentifiers()[1] );
+            requiredGlobals.addAll( resultCodeAnalysis.getBoundIdentifiers()[1] );
+
+            if ( accumDescr.getReverseCode() != null ) {
+                final Dialect.AnalysisResult reverseCodeAnalysis = context.getDialect().analyzeBlock( context,
+                                                                                                      accumDescr,
+                                                                                                      accumDescr.getActionCode(),
+                                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+                requiredDeclarations.addAll( reverseCodeAnalysis.getBoundIdentifiers()[0] );
+                requiredGlobals.addAll( reverseCodeAnalysis.getBoundIdentifiers()[1] );
+            }
+
+            final Declaration[] declarations = new Declaration[requiredDeclarations.size()];
+            int i = 0;
+            for( Iterator it = requiredDeclarations.iterator(); it.hasNext(); i++ ) {
+                declarations[i] = context.getDeclarationResolver().getDeclaration( (String) it.next() );
+            }
+            final Declaration[] sourceDeclArr = (Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[0] );
+
+            final String[] globals = (String[]) requiredGlobals.toArray( new String[requiredGlobals.size()] );
+
+            final Map map = createVariableContext( className,
+                                                   null,
+                                                   context,
+                                                   declarations,
+                                                   null,
+                                                   globals );
+
+            map.put( "className",
+                     accumDescr.getClassName() );
+            map.put( "innerDeclarations",
+                     sourceDeclArr );
+            map.put( "isMultiPattern",
+                     accumDescr.isMultiPattern() ? Boolean.TRUE : Boolean.FALSE );
+
+            final String initCode = this.fixInitCode( initCodeAnalysis,
+                                                      accumDescr.getInitCode() );
+            final String actionCode = accumDescr.getActionCode();
+            final String resultCode = accumDescr.getResultCode();
+
+            String[] attributesTypes = new String[initCodeAnalysis.getLocalVariablesMap().size()];
+            String[] attributes = new String[initCodeAnalysis.getLocalVariablesMap().size()];
+            int index = 0;
+            for ( Iterator it = initCodeAnalysis.getLocalVariablesMap().entrySet().iterator(); it.hasNext(); ) {
+                Map.Entry entry = (Map.Entry) it.next();
+                attributes[index] = (String) entry.getKey();
+                attributesTypes[index] = ((JavaLocalDeclarationDescr) entry.getValue()).getType();
+            }
+
+            map.put( "attributes",
+                     attributes );
+            map.put( "attributesTypes",
+                     attributesTypes );
+
+            map.put( "initCode",
+                     initCode );
+            map.put( "actionCode",
+                     actionCode );
+            map.put( "resultCode",
+                     resultCode );
+            if ( accumDescr.getReverseCode() == null ) {
+                map.put( "reverseCode",
+                         "" );
+                map.put( "supportsReverse",
+                         "false" );
+            } else {
+                map.put( "reverseCode",
+                         accumDescr.getReverseCode() );
+                map.put( "supportsReverse",
+                         "true" );
+            }
+
+            map.put( "hashCode",
+                     new Integer( actionCode.hashCode() ) );
+
+            accumulate = new Accumulate( source,
+                                         declarations,
+                                         sourceDeclArr );
+
+            generatTemplates( "accumulateInnerClass",
+                              "accumulateInvoker",
+                              context,
+                              className,
+                              map,
+                              accumulate,
+                              accumDescr );
+        }
+
+        return accumulate;
+    }
+
+    protected String fixInitCode(JavaAnalysisResult analysis,
+                                 final String originalCode) {
+        TreeSet locals = new TreeSet( new Comparator() {
+            public int compare(Object o1,
+                               Object o2) {
+                JavaLocalDeclarationDescr d1 = (JavaLocalDeclarationDescr) o1;
+                JavaLocalDeclarationDescr d2 = (JavaLocalDeclarationDescr) o2;
+                return d1.getStart() - d2.getStart();
+            }
+        } );
+
+        for ( Iterator it = analysis.getLocalVariablesMap().values().iterator(); it.hasNext(); ) {
+            locals.add( it.next() );
+        }
+
+        StringBuffer initCode = new StringBuffer();
+        int lastAdded = 0;
+        for ( Iterator it = locals.iterator(); it.hasNext(); ) {
+            JavaLocalDeclarationDescr d = (JavaLocalDeclarationDescr) it.next();
+            // adding chunk
+            initCode.append( originalCode.substring( lastAdded,
+                                                     d.getStart() ) );
+            lastAdded = d.getEnd();
+            // adding variable initializations
+            for ( Iterator vars = d.getIdentifiers().iterator(); vars.hasNext(); ) {
+                JavaLocalDeclarationDescr.IdentifierDescr id = (JavaLocalDeclarationDescr.IdentifierDescr) vars.next();
+                initCode.append( originalCode.substring( id.getStart(),
+                                                         id.getEnd() ) );
+                initCode.append( ";" );
+                lastAdded = id.getEnd();
+                while ( lastAdded < originalCode.length() && (Character.isWhitespace( originalCode.charAt( lastAdded ) ) || originalCode.charAt( lastAdded ) == ';') ) {
+                    lastAdded++;
+                }
+            }
+        }
+        initCode.append( originalCode.substring( lastAdded ) );
+
+        return initCode.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.spi.PatternExtractor;
+import org.drools.workflow.core.node.ActionNode;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaActionBuilder extends AbstractJavaProcessBuilder
+    implements
+    ActionBuilder {
+
+    /* (non-Javadoc)
+     * @see org.drools.semantics.java.builder.ConsequenceBuilder#buildConsequence(org.drools.semantics.java.builder.BuildContext, org.drools.semantics.java.builder.BuildUtils, org.drools.lang.descr.RuleDescr)
+     */
+    public void build(final PackageBuildContext context,
+                      final ActionNode actionNode,
+                      final ActionDescr actionDescr) {
+
+        final String className = "action" + context.getNextId();               
+
+        JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
+
+        Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+                                                                actionDescr,
+                                                                actionDescr.getText(),
+                                                                new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()} );
+
+        if ( analysis == null ) {
+            // not possible to get the analysis results
+            return;
+        }
+
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+
+        final Map map = createVariableContext( className,
+                                               actionDescr.getText(),
+                                               (ProcessBuildContext) context,
+                                               (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+        map.put( "text",
+                 actionDescr.getText() );
+
+        generatTemplates( "actionMethod",
+                          "actionInvoker",
+                          (ProcessBuildContext)context,
+                          className,
+                          map,
+                          actionNode,
+                          actionDescr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAnalysisResult.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAnalysisResult.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaAnalysisResult.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 18, 2007
+ */
+package org.drools.rule.builder.dialect.java;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.compiler.Dialect.AnalysisResult;
+import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
+
+/**
+ * An analysis result implementation for the java dialect
+ * 
+ * @author etirelli
+ */
+public class JavaAnalysisResult implements AnalysisResult {
+    private static final List[] EMPTY_ARRAY_OF_LISTS = new List[0];
+    
+    private List[] boundIdentifiers = EMPTY_ARRAY_OF_LISTS;
+    private List identifiers = Collections.EMPTY_LIST;
+    private Map localVariables = Collections.EMPTY_MAP;
+    private List notBoundedIdentifiers = Collections.EMPTY_LIST;
+    private List modifyBlocks = Collections.EMPTY_LIST;
+    
+    public List[] getBoundIdentifiers() {
+        return boundIdentifiers;
+    }
+    public void setBoundIdentifiers(List[] boundIdentifiers) {
+        this.boundIdentifiers = boundIdentifiers;
+    }
+    public List getIdentifiers() {
+        return identifiers;
+    }
+    public void setIdentifiers(List identifiers) {
+        this.identifiers = identifiers;
+    }
+    public List getLocalVariables() {
+        return new ArrayList( localVariables.keySet() );
+    }
+    public Map getLocalVariablesMap() {
+        return this.localVariables;
+    }
+    public void setLocalVariables(Map localVariables) {
+        this.localVariables = localVariables;
+    }
+    public void addLocalVariable( String identifier, JavaLocalDeclarationDescr descr ) {
+        this.localVariables.put( identifier, descr );
+    }
+    public List getNotBoundedIdentifiers() {
+        return notBoundedIdentifiers;
+    }
+    public void setNotBoundedIdentifiers(List notBoundedIdentifiers) {
+        this.notBoundedIdentifiers = notBoundedIdentifiers;
+    }
+    public List getModifyBlocks() {
+        return modifyBlocks;
+    }
+    public void setModifyBlocks(List modifyBlocks) {
+        this.modifyBlocks = modifyBlocks;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.java.parser.JavaModifyBlockDescr;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.spi.PatternExtractor;
+import org.mvel.ExecutableStatement;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaConsequenceBuilder extends AbstractJavaRuleBuilder
+    implements
+    ConsequenceBuilder {
+
+    /* (non-Javadoc)
+     * @see org.drools.semantics.java.builder.ConsequenceBuilder#buildConsequence(org.drools.semantics.java.builder.BuildContext, org.drools.semantics.java.builder.BuildUtils, org.drools.lang.descr.RuleDescr)
+     */
+    public void build(final RuleBuildContext context) {
+
+        // pushing consequence LHS into the stack for variable resolution
+        context.getBuildStack().push( context.getRule().getLhs() );
+
+        final String className = "consequence";
+
+        final RuleDescr ruleDescr = context.getRuleDescr();
+
+        Dialect.AnalysisResult analysis = context.getDialect().analyzeBlock( context,
+                                                                             ruleDescr,
+                                                                             (String) ruleDescr.getConsequence(),
+                                                                             new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+        if ( analysis == null ) {
+            // not possible to get the analysis results
+            return;
+        }
+        
+        String fixedConsequence = this.fixModifyBlocks( context, (JavaAnalysisResult) analysis, (String) ruleDescr.getConsequence() );
+        
+        if ( fixedConsequence == null ) {
+            // not possible to rewrite the modify blocks
+            return;
+        }
+        fixedConsequence = ((JavaDialect) context.getDialect()).getKnowledgeHelperFixer().fix( fixedConsequence );        
+
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+        final Declaration[] declarations = new Declaration[usedIdentifiers[0].size()];
+
+        for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+            declarations[i] = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
+        }
+
+        final Map map = createVariableContext( className,
+                                               null,
+                                               context,
+                                               declarations,
+                                               null,
+                                               (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+        map.put( "text",
+                  fixedConsequence);
+
+        // Must use the rule declarations, so we use the same order as used in the generated invoker
+        final List list = Arrays.asList( context.getRule().getDeclarations() );
+
+        //final int[] indexes = new int[declarations.length];
+        final Integer[] indexes = new Integer[declarations.length];
+
+        final Boolean[] notPatterns = new Boolean[declarations.length];
+        for ( int i = 0, length = declarations.length; i < length; i++ ) {
+            indexes[i] = new Integer( list.indexOf( declarations[i] ) );
+            notPatterns[i] = (declarations[i].getExtractor() instanceof PatternExtractor) ? new Boolean( false ) : new Boolean( true );
+            if ( (indexes[i]).intValue() == -1 ) {
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              ruleDescr,
+                                                              null,
+                                                              "Internal Error : Unable to find declaration in list while generating the consequence invoker" ) );
+            }
+        }
+
+        map.put( "indexes",
+                 indexes );
+
+        map.put( "notPatterns",
+                 notPatterns );
+
+        generatTemplates( "consequenceMethod",
+                          "consequenceInvoker",
+                          context,
+                          className,
+                          map,
+                          context.getRule(),
+                          ruleDescr );
+
+        // popping Rule.getLHS() from the build stack
+        context.getBuildStack().pop();
+    }
+
+    protected String fixModifyBlocks(final RuleBuildContext context,
+                                     final JavaAnalysisResult analysis,
+                                     final String originalCode) {
+        MVELDialect mvel = (MVELDialect) context.getDialect( "mvel" );
+
+        TreeSet blocks = new TreeSet( new Comparator() {
+            public int compare(Object o1,
+                               Object o2) {
+                JavaModifyBlockDescr d1 = (JavaModifyBlockDescr) o1;
+                JavaModifyBlockDescr d2 = (JavaModifyBlockDescr) o2;
+                return d1.getStart() - d2.getStart();
+            }
+        } );
+
+        for ( Iterator it = analysis.getModifyBlocks().iterator(); it.hasNext(); ) {
+            blocks.add( it.next() );
+        }
+
+        StringBuffer consequence = new StringBuffer();
+        int lastAdded = 0;
+        for ( Iterator it = blocks.iterator(); it.hasNext(); ) {
+            JavaModifyBlockDescr d = (JavaModifyBlockDescr) it.next();
+            // adding chunk
+            consequence.append( originalCode.substring( lastAdded,
+                                                        d.getStart() - 1 ) );
+            lastAdded = d.getEnd();
+
+            Dialect.AnalysisResult mvelAnalysis = mvel.analyzeBlock( context,
+                                                                     context.getRuleDescr(),
+                                                                     mvel.getInterceptors(),
+                                                                     d.getModifyExpression(),
+                                                                     new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()},
+                                                                     null );
+
+            final ExecutableStatement expr = (ExecutableStatement) mvel.compile( d.getModifyExpression(),
+                                                                                 mvelAnalysis,
+                                                                                 mvel.getInterceptors(),
+                                                                                 null,
+                                                                                 null,
+                                                                                 context );
+
+            Class ret = expr.getKnownEgressType();
+            
+            if( ret == null ) {
+                // not possible to evaluate expression return value
+                context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                              context.getRuleDescr(),
+                                                              originalCode,
+                                                              "Unable to determine the resulting type of the expression: " + d.getModifyExpression()+"\n" ) );
+                
+                return null;
+            }
+
+            // adding modify expression
+            consequence.append( ret.getName() );
+            consequence.append( " __obj__ = (" );
+            consequence.append( ret.getName() );
+            consequence.append( ") " );
+            consequence.append( d.getModifyExpression() );
+            consequence.append( ";\n" );
+            // adding the modifyRetract call:
+            consequence.append( "modifyRetract( __obj__ );\n" );
+
+            // adding each of the expressions:
+            for ( Iterator exprIt = d.getExpressions().iterator(); exprIt.hasNext(); ) {
+                consequence.append( "__obj__." );
+                consequence.append( exprIt.next() );
+                consequence.append( ";\n" );
+            }
+            // adding the modifyInsert call:
+            consequence.append( "modifyInsert( __obj__ );" );
+        }
+        consequence.append( originalCode.substring( lastAdded ) );
+
+        return consequence.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,674 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.process.core.Process;
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.TypeResolver;
+import org.drools.commons.jci.compilers.CompilationResult;
+import org.drools.commons.jci.compilers.JavaCompiler;
+import org.drools.commons.jci.compilers.JavaCompilerFactory;
+import org.drools.commons.jci.compilers.JavaCompilerSettings;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.MemoryResourceReader;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.PackageBuilder.ErrorHandler;
+import org.drools.compiler.PackageBuilder.FunctionErrorHandler;
+import org.drools.compiler.PackageBuilder.RuleErrorHandler;
+import org.drools.compiler.PackageBuilder.RuleInvokerErrorHandler;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.TimeWindowDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EntryPointDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.EntryPoint;
+import org.drools.rule.LineMappings;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.TimeWindowBuilder;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.CollectBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.EntryPointBuilder;
+import org.drools.rule.builder.ForallBuilder;
+import org.drools.rule.builder.FromBuilder;
+import org.drools.rule.builder.FunctionBuilder;
+import org.drools.rule.builder.GroupElementBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.PatternBuilder;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ProcessClassBuilder;
+import org.drools.rule.builder.QueryBuilder;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleClassBuilder;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.SalienceBuilder;
+import org.drools.rule.builder.dialect.mvel.MVELFromBuilder;
+import org.drools.rule.builder.dialect.mvel.MVELSalienceBuilder;
+import org.drools.compiler.PackageBuilder.ProcessInvokerErrorHandler;
+import org.drools.compiler.PackageBuilder.ProcessErrorHandler;
+import org.drools.util.StringUtils;
+
+public class JavaDialect
+    implements
+    Dialect {
+
+    public static final String                ID                          = "java";
+
+    private final static String               EXPRESSION_DIALECT_NAME     = "MVEL";
+    // builders
+    private final PatternBuilder              pattern                     = new PatternBuilder();
+    private final QueryBuilder                query                       = new QueryBuilder();
+    private final SalienceBuilder             salience                    = new MVELSalienceBuilder();
+    private final JavaAccumulateBuilder       accumulate                  = new JavaAccumulateBuilder();
+    private final JavaTimeWindowBuilder       timeWindow                  = new JavaTimeWindowBuilder();
+    private final JavaEvalBuilder             eval                        = new JavaEvalBuilder();
+    private final JavaPredicateBuilder        predicate                   = new JavaPredicateBuilder();
+    private final JavaReturnValueBuilder      returnValue                 = new JavaReturnValueBuilder();
+    private final JavaConsequenceBuilder      consequence                 = new JavaConsequenceBuilder();
+    private final JavaActionBuilder           actionBuilder               = new JavaActionBuilder();
+    private final ReturnValueEvaluatorBuilder returnValueEvaluatorBuilder = new JavaReturnValueEvaluatorBuilder();
+    private final JavaRuleClassBuilder        ruleClassBuilder            = new JavaRuleClassBuilder();
+    private final JavaProcessClassBuilder     processClassBuilder         = new JavaProcessClassBuilder();
+    private final MVELFromBuilder             from                        = new MVELFromBuilder();
+    private final JavaFunctionBuilder         function                    = new JavaFunctionBuilder();
+    private final CollectBuilder              collect                     = new CollectBuilder();
+    private final ForallBuilder               forall                      = new ForallBuilder();
+    private final EntryPointBuilder        entrypoint              = new EntryPointBuilder();
+
+    //
+    private KnowledgeHelperFixer              knowledgeHelperFixer;
+    private DeclarationTypeFixer              typeFixer;
+    private JavaExprAnalyzer                  analyzer;
+
+    private JavaDialectConfiguration          configuration;
+
+    private Package                           pkg;
+    private JavaCompiler                      compiler;
+    private List                              generatedClassList;
+    private MemoryResourceReader              src;
+    private PackageStore                      packageStoreWrapper;
+    private Map                               errorHandlers;
+    private List                              results;
+
+    private TypeResolver                      typeResolver;
+    private ClassFieldExtractorCache          classFieldExtractorCache;
+
+    // a map of registered builders
+    private Map                               builders;
+
+    public JavaDialect() {
+
+    }
+
+    public void init(PackageBuilder builder) {
+        this.pkg = builder.getPackage();
+        this.configuration = (JavaDialectConfiguration) builder.getPackageBuilderConfiguration().getDialectConfiguration( "java" );
+        this.typeResolver = builder.getTypeResolver();
+        this.classFieldExtractorCache = builder.getClassFieldExtractorCache();
+
+        this.knowledgeHelperFixer = new KnowledgeHelperFixer();
+        this.typeFixer = new DeclarationTypeFixer();
+        this.analyzer = new JavaExprAnalyzer();
+
+        if ( pkg != null ) {
+            init( pkg );
+        }
+
+        initBuilder();
+
+        loadCompiler();
+    }
+
+    public void initBuilder() {
+        // statically adding all builders to the map
+        // but in the future we can move that to a configuration
+        // if we want to
+        this.builders = new HashMap();
+
+        this.builders.put( CollectDescr.class,
+                           collect );
+
+        this.builders.put( ForallDescr.class,
+                           forall );
+
+        final GroupElementBuilder gebuilder = new GroupElementBuilder();
+
+        this.builders.put( AndDescr.class,
+                           gebuilder );
+
+        this.builders.put( OrDescr.class,
+                           gebuilder );
+
+        this.builders.put( NotDescr.class,
+                           gebuilder );
+
+        this.builders.put( ExistsDescr.class,
+                           gebuilder );
+
+        this.builders.put( PatternDescr.class,
+                           getPatternBuilder() );
+
+        this.builders.put( QueryDescr.class,
+                           getQueryBuilder() );
+
+        this.builders.put( FromDescr.class,
+                           getFromBuilder() );
+
+        this.builders.put( AccumulateDescr.class,
+                           getAccumulateBuilder() );
+        
+        this.builders.put( TimeWindowDescr.class,
+                getTimeWindowBuilder() );
+
+        this.builders.put( EvalDescr.class,
+                           getEvalBuilder() );
+
+        this.builders.put( EntryPointDescr.class,
+                           getEntryPointBuilder() );
+    }
+
+    public Map getBuilders() {
+        return this.builders;
+    }
+
+    public void init(final Package pkg) {
+
+        this.pkg = pkg;
+        //TODO Consider lazy init for these as they might have been initialized from the constructor and maybe used meanwhile
+        this.errorHandlers = new HashMap();
+        this.results = new ArrayList();
+
+        this.src = new MemoryResourceReader();
+
+        this.generatedClassList = new ArrayList();
+
+        this.packageStoreWrapper = new PackageStore( pkg.getPackageCompilationData(),
+                                                     this.results );
+    }
+
+    public void init(final RuleDescr ruleDescr) {
+        final String ruleClassName = getUniqueLegalName( this.pkg.getName(),
+                                                         ruleDescr.getName(),
+                                                         "java",
+                                                         "Rule",
+                                                         this.src );
+        ruleDescr.setClassName( StringUtils.ucFirst( ruleClassName ) );
+    }    
+    
+    public void init(final ProcessDescr processDescr) {
+        final String processDescrClassName = getUniqueLegalName( this.pkg.getName(),
+                                                         processDescr.getName(),
+                                                         "java",
+                                                         "Process",
+                                                         this.src );
+        processDescr.setClassName( StringUtils.ucFirst( processDescrClassName ) );
+    }      
+
+    public String getExpressionDialectName() {
+        return EXPRESSION_DIALECT_NAME;
+    }
+
+    public AnalysisResult analyzeExpression(final PackageBuildContext context,
+                                            final BaseDescr descr,
+                                            final Object content,
+                                            final Set[] availableIdentifiers) {
+        JavaAnalysisResult result = null;
+        try {
+            //new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()}
+            result = this.analyzer.analyzeExpression( (String) content,
+                                                      availableIdentifiers );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          e,
+                                                          "Unable to determine the used declarations.\n" + e ) );
+        }
+        return result;
+    }
+
+    public AnalysisResult analyzeBlock(final PackageBuildContext context,
+                                       final BaseDescr descr,
+                                       final String text,
+                                       final Set[] availableIdentifiers) {
+        JavaAnalysisResult result = null;
+        try {
+            // new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} 
+            result = this.analyzer.analyzeBlock( text,
+                                                 availableIdentifiers );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          e,
+                                                          "Unable to determine the used declarations.\n" + e ) );
+        }
+        return result;
+    }
+
+    /**
+     * Returns the current type resolver instance
+     * @return
+     */
+    public TypeResolver getTypeResolver() {
+        return this.typeResolver;
+    }
+
+    /**
+     * Returns the cache of field extractors
+     * @return
+     */
+    public ClassFieldExtractorCache getClassFieldExtractorCache() {
+        return this.classFieldExtractorCache;
+    }
+
+    /**
+     * Returns the Knowledge Helper Fixer
+     * @return
+     */
+    public KnowledgeHelperFixer getKnowledgeHelperFixer() {
+        return this.knowledgeHelperFixer;
+    }
+
+    /**
+     * @return the typeFixer
+     */
+    public DeclarationTypeFixer getTypeFixer() {
+        return this.typeFixer;
+    }
+
+    public RuleConditionBuilder getBuilder(final Class clazz) {
+        return (RuleConditionBuilder) this.builders.get( clazz );
+    }
+
+    public PatternBuilder getPatternBuilder() {
+        return this.pattern;
+    }
+
+    public QueryBuilder getQueryBuilder() {
+        return this.query;
+    }
+
+    public SalienceBuilder getSalienceBuilder() {
+        return this.salience;
+    }
+
+    public AccumulateBuilder getAccumulateBuilder() {
+        return this.accumulate;
+    }
+    
+    public TimeWindowBuilder getTimeWindowBuilder() {
+        return this.timeWindow;
+    }
+
+    public RuleConditionBuilder getEvalBuilder() {
+        return this.eval;
+    }
+
+    public PredicateBuilder getPredicateBuilder() {
+        return this.predicate;
+    }
+
+    public ReturnValueBuilder getReturnValueBuilder() {
+        return this.returnValue;
+    }
+
+    public ConsequenceBuilder getConsequenceBuilder() {
+        return this.consequence;
+    }
+
+    public ActionBuilder getActionBuilder() {
+        return this.actionBuilder;
+    }
+
+    public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+        return this.returnValueEvaluatorBuilder;
+    }
+
+    public RuleClassBuilder getRuleClassBuilder() {
+        return this.ruleClassBuilder;
+    }
+
+    public ProcessClassBuilder getProcessClassBuilder() {
+        return this.processClassBuilder;
+    }
+
+    public FunctionBuilder getFunctionBuilder() {
+        return this.function;
+    }
+
+    public FromBuilder getFromBuilder() {
+        return this.from;
+    }
+
+    public EntryPointBuilder getEntryPointBuilder() {
+        return this.entrypoint;
+    }
+
+    /**
+     * This actually triggers the compiling of all the resources.
+     * Errors are mapped back to the element that originally generated the semantic
+     * code.
+     */
+    public void compileAll() {
+        if ( this.generatedClassList.isEmpty() ) {
+            return;
+        }
+        final String[] classes = new String[this.generatedClassList.size()];
+        this.generatedClassList.toArray( classes );
+
+        final CompilationResult result = this.compiler.compile( classes,
+                                                                this.src,
+                                                                this.packageStoreWrapper,
+                                                                this.pkg.getPackageCompilationData().getClassLoader() );
+
+        //this will sort out the errors based on what class/file they happened in
+        if ( result.getErrors().length > 0 ) {
+            for ( int i = 0; i < result.getErrors().length; i++ ) {
+                final CompilationProblem err = result.getErrors()[i];
+
+                //                System.out.println("Line: "+err.getStartLine());
+                //                LineMappings maps = this.pkg.getPackageCompilationData().getLineMappings( err.getFileName().replace( '/', '.' ).substring( 0, err.getFileName().length() - 5 ) );
+                //                int line = err.getStartLine() + maps.getStartLine() - maps.getOffset() -1;
+                //                System.out.println("Map:  "+line);
+                final ErrorHandler handler = (ErrorHandler) this.errorHandlers.get( err.getFileName() );
+                if ( handler instanceof RuleErrorHandler ) {
+                    final RuleErrorHandler rh = (RuleErrorHandler) handler;
+                }
+                handler.addError( err );
+            }
+
+            final Collection errors = this.errorHandlers.values();
+            for ( final Iterator iter = errors.iterator(); iter.hasNext(); ) {
+                final ErrorHandler handler = (ErrorHandler) iter.next();
+                if ( handler.isInError() ) {
+                    if ( !(handler instanceof RuleInvokerErrorHandler) ) {
+                        this.results.add( handler.getError() );
+                    } else {
+                        //we don't really want to report invoker errors.
+                        //mostly as they can happen when there is a syntax error in the RHS
+                        //and otherwise, it is a programmatic error in drools itself.
+                        //throw new RuntimeException( "Warning: An error occurred compiling a semantic invoker. Errors should have been reported elsewhere." + handler.getError() );
+                    }
+                }
+            }
+        }
+
+        // We've compiled everthing, so clear it for the next set of additions
+        this.generatedClassList.clear();
+    }
+
+    /**
+     * This will add the rule for compiling later on.
+     * It will not actually call the compiler
+     */
+    public void addRule(final RuleBuildContext context) {
+        RuleClassBuilder classBuilder = context.getDialect().getRuleClassBuilder();
+
+        String ruleClass = classBuilder.buildRule( context );
+        // return if there is no ruleclass name;
+        if ( ruleClass == null ) {
+            return;
+        }
+
+        final Rule rule = context.getRule();
+        final RuleDescr ruleDescr = context.getRuleDescr();
+
+        // The compilation result is for the entire rule, so difficult to associate with any descr
+        addClassCompileTask( this.pkg.getName() + "." + ruleDescr.getClassName(),
+                             ruleDescr,
+                             ruleClass,
+                             this.src,
+                             new RuleErrorHandler( ruleDescr,
+                                                   rule,
+                                                   "Rule Compilation error" ) );
+
+        for ( final Iterator it = context.getInvokers().keySet().iterator(); it.hasNext(); ) {
+            final String className = (String) it.next();
+
+            // Check if an invoker - returnvalue, predicate, eval or consequence has been associated
+            // If so we add it to the PackageCompilationData as it will get wired up on compilation
+            final Object invoker = context.getInvokerLookups().get( className );
+            if ( invoker != null ) {
+                this.pkg.getPackageCompilationData().putInvoker( className,
+                                                                 invoker );
+            }
+            final String text = (String) context.getInvokers().get( className );
+
+            final BaseDescr descr = (BaseDescr) context.getDescrLookups().get( className );
+            addClassCompileTask( className,
+                                 descr,
+                                 text,
+                                 this.src,
+                                 new RuleInvokerErrorHandler( descr,
+                                                              rule,
+                                                              "Unable to generate rule invoker." ) );
+
+        }
+
+        // setup the line mappins for this rule
+        final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
+        final LineMappings mapping = new LineMappings( name );
+        mapping.setStartLine( ruleDescr.getConsequenceLine() );
+        mapping.setOffset( ruleDescr.getConsequenceOffset() );
+
+        context.getPkg().getPackageCompilationData().getLineMappings().put( name,
+                                                                            mapping );
+
+    }
+
+    /**
+     * This will add the rule for compiling later on.
+     * It will not actually call the compiler
+     */
+    public void addProcess(final ProcessBuildContext context) {
+        ProcessClassBuilder classBuilder = context.getDialect().getProcessClassBuilder();
+
+        String processClass = classBuilder.buildRule( context );
+        if ( processClass == null ) {
+            // nothing to compile.
+            return;
+        }
+
+        final Process process = context.getProcess();
+        final ProcessDescr processDescr = context.getProcessDescr();
+
+        // The compilation result is for the entire rule, so difficult to associate with any descr
+        addClassCompileTask( this.pkg.getName() + "." + processDescr.getClassName(),
+                             processDescr,
+                             processClass,
+                             this.src,
+                             new ProcessErrorHandler( processDescr,
+                                                      process,
+                                                      "Process Compilation error" ) );
+
+        for ( final Iterator it = context.getInvokers().keySet().iterator(); it.hasNext(); ) {
+            final String className = (String) it.next();
+
+            // Check if an invoker - Action has been associated
+            // If so we add it to the PackageCompilationData as it will get wired up on compilation
+            final Object invoker = context.getInvokerLookups().get( className );
+            if ( invoker != null ) {
+                this.pkg.getPackageCompilationData().putInvoker( className,
+                                                                 invoker );
+            }
+            final String text = (String) context.getInvokers().get( className );
+
+            final BaseDescr descr = (BaseDescr) context.getDescrLookups().get( className );
+            addClassCompileTask( className,
+                                 descr,
+                                 text,
+                                 this.src,
+                                 new ProcessInvokerErrorHandler( processDescr,
+                                                                 process,
+                                                                 "Unable to generate action invoker." ) );
+
+        }
+
+        // setup the line mappins for this rule
+        // @TODO must setup mappings
+        //        final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
+        //        final LineMappings mapping = new LineMappings( name );
+        //        mapping.setStartLine( ruleDescr.getConsequenceLine() );
+        //        mapping.setOffset( ruleDescr.getConsequenceOffset() );
+        //
+        //        context.getPkg().getPackageCompilationData().getLineMappings().put( name,
+        //                                                                           mapping );
+
+    }
+
+    public void addFunction(final FunctionDescr functionDescr,
+                            final TypeResolver typeResolver) {
+
+        //System.out.println( functionDescr + " : " + typeResolver );
+        final String functionClassName = this.pkg.getName() + "." + StringUtils.ucFirst( functionDescr.getName() );
+        this.pkg.addFunction( functionDescr.getName() );
+
+        final String functionSrc = getFunctionBuilder().build( this.pkg,
+                                                               functionDescr,
+                                                               typeResolver,
+                                                               pkg.getPackageCompilationData().getLineMappings(),
+                                                               this.results );
+
+        addClassCompileTask( functionClassName,
+                             functionDescr,
+                             functionSrc,
+                             this.src,
+                             new FunctionErrorHandler( functionDescr,
+                                                       "Function Compilation error" ) );
+
+        final LineMappings mapping = new LineMappings( functionClassName );
+        mapping.setStartLine( functionDescr.getLine() );
+        mapping.setOffset( functionDescr.getOffset() );
+        pkg.getPackageCompilationData().getLineMappings().put( functionClassName,
+                                                               mapping );
+    }
+
+    /**
+     * This adds a compile "task" for when the compiler of
+     * semantics (JCI) is called later on with compileAll()\
+     * which actually does the compiling.
+     * The ErrorHandler is required to map the errors back to the
+     * element that caused it.
+     */
+    private void addClassCompileTask(final String className,
+                                     final BaseDescr descr,
+                                     final String text,
+                                     final MemoryResourceReader src,
+                                     final ErrorHandler handler) {
+
+        final String fileName = className.replace( '.',
+                                                   '/' ) + ".java";
+
+        src.add( fileName,
+                 text.getBytes() );
+
+        this.errorHandlers.put( fileName,
+                                handler );
+
+        addClassName( fileName );
+    }
+
+    public void addClassName(final String className) {
+        this.generatedClassList.add( className );
+    }
+
+    private void loadCompiler() {
+        switch ( this.configuration.getCompiler() ) {
+            case JavaDialectConfiguration.JANINO : {
+                this.compiler = JavaCompilerFactory.getInstance().createCompiler( "janino" );
+                break;
+            }
+            case JavaDialectConfiguration.ECLIPSE :
+            default : {
+                this.compiler = JavaCompilerFactory.getInstance().createCompiler( "eclipse" );
+                JavaCompilerSettings settings = this.compiler.createDefaultSettings();
+
+                String lngLevel = this.configuration.getJavaLanguageLevel();
+                settings.setTargetVersion( lngLevel );
+
+                settings.setSourceVersion( lngLevel );
+                break;
+            }
+        }
+    }
+
+    public void addImport(String importEntry) {
+        // we don't need to do anything here
+    }
+
+    public void addStaticImport(String staticImportEntry) {
+        // we don't need to do anything here
+    }
+
+    public List getResults() {
+        return this.results;
+    }
+
+    /**
+     * Takes a given name and makes sure that its legal and doesn't already exist. If the file exists it increases counter appender untill it is unique.
+     *
+     * TODO: move out to shared utility class
+     *
+     * @param packageName
+     * @param name
+     * @param ext
+     * @return
+     */
+    public static String getUniqueLegalName(final String packageName,
+                                            final String name,
+                                            final String ext,
+                                            final String prefix,
+                                            final ResourceReader src) {
+        // replaces all non alphanumeric or $ chars with _
+        String newName = prefix + "_" + name.replaceAll( "[[^\\w]$]",
+                                                    "_" );
+
+        // make sure the class name does not exist, if it does increase the counter
+        int counter = -1;
+        boolean exists = true;
+        while ( exists ) {
+
+            counter++;
+            final String fileName = packageName.replaceAll( "\\.",
+                                                            "/" ) + newName + "_" + counter + ext;
+
+            //MVEL:test null to Fix failing test on org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilderTest.testImperativeCodeError()
+            exists = src != null && src.isAvailable( fileName );
+        }
+        // we have duplicate file names so append counter
+        if ( counter >= 0 ) {
+            newName = newName + "_" + counter;
+        }
+
+        return newName;
+    }
+
+    public String getId() {
+        return ID;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectConfiguration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectConfiguration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectConfiguration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,165 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+
+/**
+ * 
+ * There are options to use various flavours of runtime compilers.
+ * Apache JCI is used as the interface to all the runtime compilers.
+ * 
+ * You can also use the system property "drools.compiler" to set the desired compiler.
+ * The valid values are "ECLIPSE" and "JANINO" only. 
+ * 
+ * drools.dialect.java.compiler = <ECLIPSE|JANINO>
+ * drools.dialect.java.lngLevel = <1.5|1.6>
+ * 
+ * The default compiler is Eclipse and the default lngLevel is 1.5.
+ * The lngLevel will attempt to autodiscover your system using the 
+ * system property "java.version"
+ * 
+ * The JavaDialectConfiguration will attempt to validate that the specified compiler
+ * is in the classpath, using ClassLoader.loasClass(String). If you intented to
+ * just Janino sa the compiler you must either overload the compiler property before 
+ * instantiating this class or the PackageBuilder, or make sure Eclipse is in the 
+ * classpath, as Eclipse is the default.
+ *
+ */
+public class JavaDialectConfiguration
+    implements
+    DialectConfiguration {
+    public static final int             ECLIPSE         = 0;
+    public static final int             JANINO          = 1;
+
+    public static final String[]        LANGUAGE_LEVELS = new String[]{"1.5", "1.6"};
+
+    private String                      languageLevel;
+
+    private PackageBuilderConfiguration conf;
+
+    private int                         compiler;
+
+    public JavaDialectConfiguration() {
+    }
+
+    public void init(final PackageBuilderConfiguration conf) {
+        this.conf = conf;
+
+        setCompiler( getDefaultCompiler() );        
+        
+        setJavaLanguageLevel( getDefaultLanguageLevel() );
+    }
+
+    public PackageBuilderConfiguration getPackageBuilderConfiguration() {
+        return this.conf;
+    }
+
+    public Dialect getDialect() {
+        return new JavaDialect();
+    }
+
+    public String getJavaLanguageLevel() {
+        return this.languageLevel;
+    }
+
+    /**
+     * You cannot set language level below 1.5, as we need static imports, 1.5 is now the default.
+     * @param level
+     */
+    public void setJavaLanguageLevel(final String languageLevel) {
+        if ( Arrays.binarySearch( LANGUAGE_LEVELS,
+                                  languageLevel ) < 0 ) {
+            throw new RuntimeDroolsException( "value '" + languageLevel + "' is not a valid language level" );
+        }
+        this.languageLevel = languageLevel;
+    }
+
+    /** 
+     * Set the compiler to be used when building the rules semantic code blocks.
+     * This overrides the default, and even what was set as a system property. 
+     */
+    public void setCompiler(final int compiler) {
+        // check that the jar for the specified compiler are present
+        if ( compiler == ECLIPSE ) {
+            try {
+                getClass().getClassLoader().loadClass( "org.eclipse.jdt.internal.compiler.Compiler" );
+            } catch ( ClassNotFoundException e ) {
+                throw new RuntimeException( "The Eclipse JDT Core jar is not in the classpath" );
+            }
+        } else if ( compiler == JANINO ){
+            try {
+                getClass().getClassLoader().loadClass( "org.codehaus.janino.Parser" );
+            } catch ( ClassNotFoundException e ) {
+                throw new RuntimeException( "The Janino jar is not in the classpath" );
+            }
+        }
+        
+        switch ( compiler ) {
+            case JavaDialectConfiguration.ECLIPSE :
+                this.compiler = JavaDialectConfiguration.ECLIPSE;
+                break;
+            case JavaDialectConfiguration.JANINO :
+                this.compiler = JavaDialectConfiguration.JANINO;
+                break;
+            default :
+                throw new RuntimeDroolsException( "value '" + compiler + "' is not a valid compiler" );
+        }
+    }
+
+    public int getCompiler() {
+        return this.compiler;
+    }
+
+    /**
+     * This will attempt to read the System property to work out what default to set.
+     * This should only be done once when the class is loaded. After that point, you will have
+     * to programmatically override it.
+     */
+    private int getDefaultCompiler() {
+        try {
+            final String prop = this.conf.getChainedProperties().getProperty( "drools.dialect.java.compiler",
+                                                                              "ECLIPSE" );
+            if ( prop.equals( "ECLIPSE".intern() ) ) {
+                return JavaDialectConfiguration.ECLIPSE;
+            } else if ( prop.equals( "JANINO" ) ) {
+                return JavaDialectConfiguration.JANINO;
+            } else {
+                System.err.println( "Drools config: unable to use the drools.compiler property. Using default. It was set to:" + prop );
+                return JavaDialectConfiguration.ECLIPSE;
+            }
+        } catch ( final SecurityException e ) {
+            System.err.println( "Drools config: unable to read the drools.compiler property. Using default." );
+            return JavaDialectConfiguration.ECLIPSE;
+        }
+    }
+
+    private String getDefaultLanguageLevel() {
+        String level = this.conf.getChainedProperties().getProperty( "drools.dialect.java.compiler.lnglevel",
+                                                                     null );
+
+        if ( level == null ) {
+            String version = System.getProperty( "java.version" );
+            if ( version.startsWith( "1.5" ) ) {
+                level = "1.5";
+            } else if ( version.startsWith( "1.6" ) ) {
+                level = "1.6";
+            } else {
+                level = "1.5";
+            }
+        }
+
+        if ( Arrays.binarySearch( LANGUAGE_LEVELS,
+                                  level ) < 0 ) {
+            throw new RuntimeDroolsException( "value '" + level + "' is not a valid language level" );
+        }
+
+        return level;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectError.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectError.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectError.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools.rule.builder.dialect.java;
+
+import org.drools.compiler.DroolsError;
+
+public class JavaDialectError extends DroolsError {
+    private String message;
+    private static final int[] line = new int[0];
+
+    public JavaDialectError(final String message) {
+        super();
+        this.message = message;
+    }
+
+    public int[] getErrorLines() {
+        return line;
+    }
+    
+    public String getMessage() {
+        return this.message;
+    }
+
+    public String toString() {
+        return "[JavaDialectError message='" + this.message + "']";
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectSession.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectSession.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaDialectSession.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+package org.drools.rule.builder.dialect.java;
+
+public class JavaDialectSession {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.EvalCondition;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleConditionBuilder;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaEvalBuilder extends AbstractJavaRuleBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    /**
+     * Builds and returns an Eval Conditional Element
+     * 
+     * @param context The current build context
+     * @param utils The current build utils instance
+     * @param patternBuilder not used by EvalBuilder
+     * @param descr The Eval Descriptor to build the eval conditional element from
+     * 
+     * @return the Eval Conditional Element
+     */
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+        // it must be an EvalDescr
+        final EvalDescr evalDescr = (EvalDescr) descr;
+
+        final String className = "eval" + context.getNextId();
+
+        evalDescr.setClassMethodName( className );
+
+        Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                  evalDescr,
+                                                                                  evalDescr.getContent(),
+                                                                                  new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+        final Declaration[] declarations = new Declaration[usedIdentifiers[0].size()];
+        for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+            declarations[i] = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
+        }
+
+        final EvalCondition eval = new EvalCondition( declarations );
+
+        final Map map = createVariableContext( className,
+                                               (String) evalDescr.getContent(),
+                                               context,
+                                               declarations,
+                                               null,
+                                               (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+
+        generatTemplates( "evalMethod",
+                          "evalInvoker",
+                          context,
+                          className,
+                          map,
+                          eval,
+                          descr );
+
+        return eval;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,145 @@
+package org.drools.rule.builder.dialect.java;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.TokenStream;
+import org.drools.rule.builder.dialect.java.parser.JavaLexer;
+import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
+import org.drools.rule.builder.dialect.java.parser.JavaParser;
+
+/**
+ * Expression analyzer.
+ * 
+ * @author <a href="mailto:bob at eng.werken.com">bob mcwhirter </a>
+ */
+public class JavaExprAnalyzer {
+    // ------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------
+
+    /**
+     * Construct.
+     */
+    public JavaExprAnalyzer() {
+        // intentionally left blank.
+    }
+
+    // ------------------------------------------------------------
+    // Instance methods
+    // ------------------------------------------------------------
+
+    /**
+     * Analyze an expression.
+     * 
+     * @param expr
+     *            The expression to analyze.
+     * @param availDecls
+     *            Total set of declarations available.
+     * 
+     * @return The <code>Set</code> of declarations used by the expression.
+     * @throws RecognitionException 
+     *             If an error occurs in the parser.
+     */
+    public JavaAnalysisResult analyzeExpression(final String expr,
+                                            final Set[] availableIdentifiers) throws RecognitionException {
+        final CharStream charStream = new ANTLRStringStream( expr );
+        final JavaLexer lexer = new JavaLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final JavaParser parser = new JavaParser( tokenStream );
+
+        parser.conditionalOrExpression();
+        
+        JavaAnalysisResult result = new JavaAnalysisResult();
+        result.setIdentifiers( parser.getIdentifiers() );
+        return analyze( result,
+                        availableIdentifiers );
+    }
+
+    public JavaAnalysisResult analyzeBlock(final String expr,
+                                       final Set[] availableIdentifiers) throws RecognitionException {
+        final CharStream charStream = new ANTLRStringStream( "{" + expr + "}" );
+        final JavaLexer lexer = new JavaLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final JavaParser parser = new JavaParser( tokenStream );
+
+        parser.block();
+
+        JavaAnalysisResult result = new JavaAnalysisResult();
+        result.setIdentifiers( parser.getIdentifiers() );
+        result.setLocalVariables( new HashMap() );
+        for( Iterator it = parser.getLocalDeclarations().iterator(); it.hasNext(); ) {
+            JavaLocalDeclarationDescr descr = (JavaLocalDeclarationDescr) it.next();
+            for( Iterator identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
+                JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
+                result.addLocalVariable( ident.getIdentifier(), descr );
+            }
+        }
+        result.setModifyBlocks( parser.getModifyBlocks() );
+
+        return analyze( result,
+                        availableIdentifiers );
+    }
+
+    /**
+     * Analyze an expression.
+     * 
+     * @param availDecls
+     *            Total set of declarations available.
+     * @param ast
+     *            The AST for the expression.
+     * 
+     * @return The <code>Set</code> of declarations used by the expression.
+     * 
+     * @throws RecognitionException
+     *             If an error occurs in the parser.
+     */
+    private JavaAnalysisResult analyze(final JavaAnalysisResult result,
+                                   final Set[] availableIdentifiers) throws RecognitionException {
+        final List identifiers = result.getIdentifiers();
+        final Set notBound = new HashSet( identifiers );
+        final List[] used = new List[availableIdentifiers.length];
+        for ( int i = 0, length = used.length; i < length; i++ ) {
+            used[i] = new ArrayList();
+        }
+
+        for ( int i = 0, length = availableIdentifiers.length; i < length; i++ ) {
+            final Set set = availableIdentifiers[i];
+            for ( final Iterator it = set.iterator(); it.hasNext(); ) {
+                final String eachDecl = (String) it.next();
+                if ( identifiers.contains( eachDecl ) ) {
+                    used[i].add( eachDecl );
+                    notBound.remove( eachDecl );
+                }
+            }
+        }
+        result.setBoundIdentifiers( used );
+        result.setNotBoundedIdentifiers( new ArrayList( notBound ) );
+
+        return result;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaFunctionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaFunctionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaFunctionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,129 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.base.TypeResolver;
+import org.drools.compiler.FunctionError;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.rule.LineMappings;
+import org.drools.rule.Package;
+import org.drools.rule.builder.FunctionBuilder;
+import org.drools.util.StringUtils;
+import org.mvel.TemplateInterpreter;
+
+public class JavaFunctionBuilder
+    implements
+    FunctionBuilder {
+
+    //    private static final StringTemplateGroup functionGroup = new StringTemplateGroup( new InputStreamReader( JavaFunctionBuilder.class.getResourceAsStream( "javaFunction.stg" ) ),
+    //                                                                                      AngleBracketTemplateLexer.class );
+
+    private static final String template = StringUtils.readFileAsString( new InputStreamReader( JavaFunctionBuilder.class.getResourceAsStream( "javaFunction.mvel" ) ) );
+
+    public JavaFunctionBuilder() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.rule.builder.dialect.java.JavaFunctionBuilder#build(org.drools.rule.Package, org.drools.lang.descr.FunctionDescr, org.codehaus.jfdi.interpreter.TypeResolver, java.util.Map)
+     */
+    public String build(final Package pkg,
+                        final FunctionDescr functionDescr,
+                        final TypeResolver typeResolver,
+                        final Map lineMappings,
+                        final List errors) {
+
+        final Map vars = new HashMap();
+
+        vars.put( "package",
+                  pkg.getName() );
+
+        vars.put( "imports",
+                  pkg.getImports().keySet() );
+
+        final List staticImports = new LinkedList();
+        for( Iterator it = pkg.getStaticImports().iterator(); it.hasNext(); ) {
+            final String staticImport = (String) it.next();
+            if( ! staticImport.startsWith( functionDescr.getClassName() ) ) {
+                staticImports.add( staticImport );
+            }
+        }
+        vars.put( "staticImports",
+                  staticImports );
+
+        vars.put( "className",
+                  StringUtils.ucFirst( functionDescr.getName() ) );
+
+        vars.put( "methodName",
+                  functionDescr.getName() );
+
+        vars.put( "returnType",
+                  functionDescr.getReturnType() );
+
+        vars.put( "parameterTypes",
+                  functionDescr.getParameterTypes() );
+
+        vars.put( "parameterNames",
+                  functionDescr.getParameterNames() );
+
+        // Check that all the parameters are resolvable
+        final Map params = new HashMap();
+        final List names = functionDescr.getParameterNames();
+        final List types = functionDescr.getParameterTypes();
+        try {
+            for ( int i = 0, size = names.size(); i < size; i++ ) {
+                params.put( names.get( i ),
+                            typeResolver.resolveType( (String) types.get( i ) ) );
+            }
+        } catch ( final ClassNotFoundException e ) {
+            errors.add( new FunctionError( functionDescr,
+                                           e,
+                                           "unable to resolve type while building function" ) );
+        }
+
+        vars.put( "text",
+                  functionDescr.getText() );
+
+        final String text = TemplateInterpreter.evalToString( template,
+                                                              vars );
+
+        //System.out.println( text );
+
+        final BufferedReader reader = new BufferedReader( new StringReader( text ) );
+        String line = null;
+        final String lineStartsWith = "    public static " + functionDescr.getReturnType() + " " + functionDescr.getName();
+        int offset = 0;
+        try {
+            while ( (line = reader.readLine()) != null ) {
+                offset++;
+                if ( line.startsWith( lineStartsWith ) ) {
+                    break;
+                }
+            }
+            functionDescr.setOffset( offset );
+        } catch ( final IOException e ) {
+            // won't ever happen, it's just reading over a string.
+            throw new RuntimeDroolsException( "Error determining start offset with function" );
+        }
+
+        final String name = pkg.getName() + "." + StringUtils.ucFirst( functionDescr.getName() );
+        final LineMappings mapping = new LineMappings( name );
+        mapping.setStartLine( functionDescr.getLine() );
+        mapping.setOffset( functionDescr.getOffset() );
+        lineMappings.put( name,
+                          mapping );
+
+        return text;
+
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.List;
+import java.util.Map;
+
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.PredicateConstraint;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+
+public class JavaPredicateBuilder extends AbstractJavaRuleBuilder
+    implements
+    PredicateBuilder {
+
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final PredicateConstraint predicateConstraint,
+                      final PredicateDescr predicateDescr) {
+        final String className = "returnValue" + context.getNextId();
+        predicateDescr.setClassMethodName( className );
+
+        final Map map = createVariableContext( className,
+                                         (String) predicateDescr.getContent(),
+                                         context,
+                                         previousDeclarations,
+                                         localDeclarations,
+                                         (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+
+        generatTemplates( "predicateMethod",
+                          "predicateInvoker",
+                          context,
+                          className,
+                          map,
+                          predicateConstraint,
+                          predicateDescr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaProcessClassBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaProcessClassBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaProcessClassBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Iterator;
+
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.rule.ImportDeclaration;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ProcessClassBuilder;
+import org.drools.util.StringUtils;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaProcessClassBuilder
+    implements
+    ProcessClassBuilder {
+
+    /* (non-Javadoc)
+     * @see org.drools.rule.builder.dialect.java.RuleClassBuilder#buildRule(org.drools.rule.builder.BuildContext, org.drools.rule.builder.dialect.java.BuildUtils, org.drools.lang.descr.RuleDescr)
+     */
+    public String  buildRule(final ProcessBuildContext context) {
+        // If there is no compiled code, return
+        if ( context.getMethods().isEmpty() ) {
+            return null;
+        }
+        
+        final String lineSeparator = System.getProperty( "line.separator" );
+
+        final StringBuffer buffer = new StringBuffer();
+        buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
+
+        for ( ImportDeclaration decl : context.getPkg().getImports().values() ) {
+            buffer.append( "import " +  decl.getTarget() + ";" + lineSeparator );
+        }
+
+        for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
+            buffer.append( "import static " + it.next() + ";" + lineSeparator );
+        }
+
+        final ProcessDescr processDescr = context.getProcessDescr();
+        
+        buffer.append( "public class " + StringUtils.ucFirst( processDescr.getClassName() ) + " {" + lineSeparator );
+        buffer.append( "    private static final long serialVersionUID = 400L;" + lineSeparator );
+
+        // @TODO record line numbers for each Action method
+        for ( int i = 0, size = context.getMethods().size(); i < size; i++ ) {
+            buffer.append( context.getMethods().get( i ) + lineSeparator );           
+        }
+
+        final String[] lines = buffer.toString().split( lineSeparator );
+
+        buffer.append( "}" );
+
+        return buffer.toString();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.List;
+import java.util.Map;
+
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.ReturnValueRestriction;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+
+public class JavaReturnValueBuilder extends AbstractJavaRuleBuilder
+    implements
+    ReturnValueBuilder {
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final ReturnValueRestriction returnValueRestriction,
+                      final ReturnValueRestrictionDescr returnValueRestrictionDescr) {
+        final String className = "returnValue" + context.getNextId();
+        returnValueRestrictionDescr.setClassMethodName( className );
+
+        final Map map = createVariableContext( className,
+                                         (String) returnValueRestrictionDescr.getContent(),
+                                         context,
+                                         previousDeclarations,
+                                         localDeclarations,
+                                         (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+
+        map.put( "readLocalsFromTuple", Boolean.FALSE );
+
+        generatTemplates( "returnValueMethod",
+                          "returnValueInvoker",
+                          context,
+                          className,
+                          map,
+                          returnValueRestriction,
+                          returnValueRestrictionDescr );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.spi.PatternExtractor;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaReturnValueEvaluatorBuilder extends AbstractJavaProcessBuilder
+    implements
+    ReturnValueEvaluatorBuilder {
+
+    /* (non-Javadoc)
+     * @see org.drools.semantics.java.builder.ConsequenceBuilder#buildConsequence(org.drools.semantics.java.builder.BuildContext, org.drools.semantics.java.builder.BuildUtils, org.drools.lang.descr.RuleDescr)
+     */
+    public void build(final PackageBuildContext context,
+                      final ReturnValueConstraintEvaluator constraintNode,
+                      final ReturnValueDescr descr) {
+
+        final String className = "returnValueEvaluator" + context.getNextId();
+
+        JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
+
+        Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+                                                                descr,
+                                                                descr.getText(),
+                                                                new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()} );
+
+        if ( analysis == null ) {
+            // not possible to get the analysis results
+            return;
+        }
+
+        final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+
+        final Map map = createVariableContext( className,
+                                               descr.getText(),
+                                               (ProcessBuildContext) context,
+                                               (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+        map.put( "text",
+                 descr.getText() );
+
+        generatTemplates( "returnValueEvaluatorMethod",
+                          "returnValueEvaluatorInvoker",
+                          (ProcessBuildContext)context,
+                          className,
+                          map,
+                          constraintNode,
+                          descr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaRuleClassBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaRuleClassBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaRuleClassBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Iterator;
+
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleClassBuilder;
+import org.drools.util.StringUtils;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaRuleClassBuilder
+    implements
+    RuleClassBuilder {
+
+    /* (non-Javadoc)
+     * @see org.drools.rule.builder.dialect.java.RuleClassBuilder#buildRule(org.drools.rule.builder.BuildContext, org.drools.rule.builder.dialect.java.BuildUtils, org.drools.lang.descr.RuleDescr)
+     */
+    public String  buildRule(final RuleBuildContext context) {
+        // If there is no compiled code, return
+        if ( context.getMethods().isEmpty() ) {
+            return null;
+        }
+        
+        final String lineSeparator = System.getProperty( "line.separator" );
+
+        final StringBuffer buffer = new StringBuffer();
+        buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
+
+        for ( final Iterator it = context.getPkg().getImports().keySet().iterator(); it.hasNext(); ) {
+            buffer.append( "import " + it.next() + ";" + lineSeparator );
+        }
+
+        for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
+            buffer.append( "import static " + it.next() + ";" + lineSeparator );
+        }
+
+        final RuleDescr ruleDescr = context.getRuleDescr();
+        
+        buffer.append( "public class " + StringUtils.ucFirst( ruleDescr.getClassName() ) + " {" + lineSeparator );
+        buffer.append( "    private static final long serialVersionUID = 400L;" + lineSeparator );
+
+        for ( int i = 0, size = context.getMethods().size() - 1; i < size; i++ ) {
+            buffer.append( context.getMethods().get( i ) + lineSeparator );
+        }
+
+        final String[] lines = buffer.toString().split( lineSeparator, -1 );
+
+        ruleDescr.setConsequenceOffset( lines.length );
+
+        buffer.append( context.getMethods().get( context.getMethods().size() - 1 ) + lineSeparator );
+        buffer.append( "}" );
+
+        return buffer.toString();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaTimeWindowBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaTimeWindowBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/JavaTimeWindowBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.drools.base.accumulators.AccumulateFunction;
+import org.drools.base.accumulators.JavaAccumulatorFunctionExecutor;
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.TimeWindowDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Accumulate;
+import org.drools.rule.Declaration;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.TimeWindow;
+import org.drools.rule.builder.TimeWindowBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
+
+/**
+ * A builder for the java dialect timeWindow version
+ * 
+ * @author mgroch
+ */
+public class JavaTimeWindowBuilder extends AbstractJavaRuleBuilder
+    implements
+    TimeWindowBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+
+        final TimeWindowDescr twDescr = (TimeWindowDescr) descr;
+
+        if ( !twDescr.hasValidInput() ) {
+            return null;
+        }
+
+        final RuleConditionBuilder builder = context.getDialect().getBuilder( twDescr.getInput().getClass() );
+
+        final RuleConditionElement source = builder.build( context,
+                                                           twDescr.getInput() );
+
+        if ( source == null ) {
+            return null;
+        }
+        
+        final String windowSizeStr = twDescr.getWindowSize();
+        final long windowSize;
+        try {
+			windowSize = Long.parseLong(windowSizeStr);
+		} catch (NumberFormatException e) {
+			System.err.println ("Error while parsing window size (Long expected):\n");
+			e.printStackTrace();
+			return null;
+		} 
+
+        TimeWindow timeWindow = null;
+
+        if ( twDescr.isExternalFunction() ) {
+            // if it is an external function, build a method for it
+
+            final JavaAnalysisResult analysis = (JavaAnalysisResult) context.getDialect().analyzeBlock( context,
+                                                                                                        twDescr,
+                                                                                                        twDescr.getExpression(),
+                                                                                                        new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+            final List tupleDeclarations = new ArrayList();
+            for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+                tupleDeclarations.add( context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) ) );
+            }
+
+            final Declaration[] previousDeclarations = (Declaration[]) tupleDeclarations.toArray( new Declaration[tupleDeclarations.size()] );
+            final String[] requiredGlobals = (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] );
+            final Declaration[] sourceDeclArr = (Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[0] );
+
+            final String className = "accumulateExpression" + context.getNextId();
+
+            final Map map = createVariableContext( className,
+                                                   (String) twDescr.getExpression(),
+                                                   context,
+                                                   previousDeclarations,
+                                                   sourceDeclArr,
+                                                   requiredGlobals );
+            map.put( "readLocalsFromTuple", twDescr.isMultiPattern() ? Boolean.TRUE : Boolean.FALSE );
+
+            AccumulateFunction function = context.getConfiguration().getAccumulateFunction( twDescr.getFunctionIdentifier() );
+
+            JavaAccumulatorFunctionExecutor accumulator = new JavaAccumulatorFunctionExecutor( function );
+
+            timeWindow = new TimeWindow( source,
+                                         previousDeclarations,
+                                         sourceDeclArr,
+                                         accumulator,
+                                         windowSize);
+
+            generatTemplates( "returnValueMethod",
+                              "returnValueInvoker",
+                              context,
+                              className,
+                              map,
+                              accumulator,
+                              twDescr );
+        } else {
+            // ELSE, if it is not an external function, build it using the regular java builder
+            final String className = "Accumulate" + context.getNextId();
+            twDescr.setClassName( className );
+
+            final JavaAnalysisResult initCodeAnalysis = (JavaAnalysisResult) context.getDialect().analyzeBlock( context,
+                                                                                                                twDescr,
+                                                                                                                twDescr.getInitCode(),
+                                                                                                                new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+            final Dialect.AnalysisResult actionCodeAnalysis = context.getDialect().analyzeBlock( context,
+                                                                                                 twDescr,
+                                                                                                 twDescr.getActionCode(),
+                                                                                                 new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+            final Dialect.AnalysisResult resultCodeAnalysis = context.getDialect().analyzeExpression( context,
+                                                                                                      twDescr,
+                                                                                                      twDescr.getResultCode(),
+                                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final Set requiredDeclarations = new HashSet( initCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( actionCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( resultCodeAnalysis.getBoundIdentifiers()[0] );
+
+            final Set requiredGlobals = new HashSet( initCodeAnalysis.getBoundIdentifiers()[1] );
+            requiredGlobals.addAll( actionCodeAnalysis.getBoundIdentifiers()[1] );
+            requiredGlobals.addAll( resultCodeAnalysis.getBoundIdentifiers()[1] );
+
+            if ( twDescr.getReverseCode() != null ) {
+                final Dialect.AnalysisResult reverseCodeAnalysis = context.getDialect().analyzeBlock( context,
+                                                                                                      twDescr,
+                                                                                                      twDescr.getActionCode(),
+                                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+                requiredDeclarations.addAll( reverseCodeAnalysis.getBoundIdentifiers()[0] );
+                requiredGlobals.addAll( reverseCodeAnalysis.getBoundIdentifiers()[1] );
+            }
+
+            final Declaration[] declarations = new Declaration[requiredDeclarations.size()];
+            int i = 0;
+            for( Iterator it = requiredDeclarations.iterator(); it.hasNext(); i++ ) {
+                declarations[i] = context.getDeclarationResolver().getDeclaration( (String) it.next() );
+            }
+            final Declaration[] sourceDeclArr = (Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[0] );
+
+            final String[] globals = (String[]) requiredGlobals.toArray( new String[requiredGlobals.size()] );
+
+            final Map map = createVariableContext( className,
+                                                   null,
+                                                   context,
+                                                   declarations,
+                                                   null,
+                                                   globals );
+
+            map.put( "className",
+                     twDescr.getClassName() );
+            map.put( "innerDeclarations",
+                     sourceDeclArr );
+            map.put( "isMultiPattern",
+                     twDescr.isMultiPattern() ? Boolean.TRUE : Boolean.FALSE );
+
+            final String initCode = this.fixInitCode( initCodeAnalysis,
+                                                      twDescr.getInitCode() );
+            final String actionCode = twDescr.getActionCode();
+            final String resultCode = twDescr.getResultCode();
+
+            String[] attributesTypes = new String[initCodeAnalysis.getLocalVariablesMap().size()];
+            String[] attributes = new String[initCodeAnalysis.getLocalVariablesMap().size()];
+            int index = 0;
+            for ( Iterator it = initCodeAnalysis.getLocalVariablesMap().entrySet().iterator(); it.hasNext(); ) {
+                Map.Entry entry = (Map.Entry) it.next();
+                attributes[index] = (String) entry.getKey();
+                attributesTypes[index] = ((JavaLocalDeclarationDescr) entry.getValue()).getType();
+            }
+
+            map.put( "attributes",
+                     attributes );
+            map.put( "attributesTypes",
+                     attributesTypes );
+            
+            map.put("windowSize", 
+            		windowSizeStr);
+
+            map.put( "initCode",
+                     initCode );
+            map.put( "actionCode",
+                     actionCode );
+            map.put( "resultCode",
+                     resultCode );
+            if ( twDescr.getReverseCode() == null ) {
+                map.put( "reverseCode",
+                         "" );
+                map.put( "supportsReverse",
+                         "false" );
+            } else {
+                map.put( "reverseCode",
+                         twDescr.getReverseCode() );
+                map.put( "supportsReverse",
+                         "true" );
+            }
+
+            map.put( "hashCode",
+                     new Integer( actionCode.hashCode() ) );
+
+            timeWindow = new TimeWindow( source,
+                                         declarations,
+                                         sourceDeclArr,
+                                         windowSize);
+
+            generatTemplates( "accumulateInnerClass",
+                              "accumulateInvoker",
+                              context,
+                              className,
+                              map,
+                              timeWindow,
+                              twDescr );
+        }
+
+        return timeWindow;
+    }
+
+    protected String fixInitCode(JavaAnalysisResult analysis,
+                                 final String originalCode) {
+        TreeSet locals = new TreeSet( new Comparator() {
+            public int compare(Object o1,
+                               Object o2) {
+                JavaLocalDeclarationDescr d1 = (JavaLocalDeclarationDescr) o1;
+                JavaLocalDeclarationDescr d2 = (JavaLocalDeclarationDescr) o2;
+                return d1.getStart() - d2.getStart();
+            }
+        } );
+
+        for ( Iterator it = analysis.getLocalVariablesMap().values().iterator(); it.hasNext(); ) {
+            locals.add( it.next() );
+        }
+
+        StringBuffer initCode = new StringBuffer();
+        int lastAdded = 0;
+        for ( Iterator it = locals.iterator(); it.hasNext(); ) {
+            JavaLocalDeclarationDescr d = (JavaLocalDeclarationDescr) it.next();
+            // adding chunk
+            initCode.append( originalCode.substring( lastAdded,
+                                                     d.getStart() ) );
+            lastAdded = d.getEnd();
+            // adding variable initializations
+            for ( Iterator vars = d.getIdentifiers().iterator(); vars.hasNext(); ) {
+                JavaLocalDeclarationDescr.IdentifierDescr id = (JavaLocalDeclarationDescr.IdentifierDescr) vars.next();
+                initCode.append( originalCode.substring( id.getStart(),
+                                                         id.getEnd() ) );
+                initCode.append( ";" );
+                lastAdded = id.getEnd();
+                while ( lastAdded < originalCode.length() && (Character.isWhitespace( originalCode.charAt( lastAdded ) ) || originalCode.charAt( lastAdded ) == ';') ) {
+                    lastAdded++;
+                }
+            }
+        }
+        initCode.append( originalCode.substring( lastAdded ) );
+
+        return initCode.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package org.drools.rule.builder.dialect.java;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.mvel.Macro;
+import org.mvel.MacroProcessor;
+
+public class KnowledgeHelperFixer {
+    private static final Map macros;
+    
+    static {
+        macros = new HashMap(5);
+        
+        macros.put( "insert",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.insert";
+                        }
+                    } ); 
+        
+        macros.put( "insertLogical",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.insertLogical";
+                        }
+                    } );         
+        
+        macros.put( "modifyRetract",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.modifyRetract";
+                        }
+                    } );  
+        
+        macros.put( "modifyInsert",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.modifyInsert";
+                        }
+                    } );          
+        
+        macros.put( "update",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.update";
+                        }
+                    } );
+        
+        macros.put( "retract",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.retract";
+                        }
+                    } );          
+    }
+
+    public String fix(final String raw) {
+        if  ( raw == null || "".equals( raw.trim() )) {
+            return raw;
+        }
+        
+        MacroProcessor macroProcessor = new MacroProcessor();
+        macroProcessor.setMacros( macros );
+        return macroProcessor.parse( raw );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+package org.drools.rule.builder.dialect.java;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.drools.commons.jci.stores.ResourceStore;
+import org.drools.rule.PackageCompilationData;
+
+public class PackageStore
+    implements
+    ResourceStore {
+    private PackageCompilationData packageCompilationData;
+
+    private List                   errors;
+
+    public PackageStore() {
+    }
+
+    public PackageStore(final PackageCompilationData packageCompiationData,
+                        final List errors) {
+        this.packageCompilationData = packageCompiationData;
+        this.errors = errors;
+    }
+
+    public void setPackageCompilationData(final PackageCompilationData packageCompiationData) {
+        this.packageCompilationData = packageCompiationData;
+    }
+
+    public void write(final String resourceName,
+                      final byte[] clazzData) {
+        try {
+            this.packageCompilationData.write( resourceName,
+                                               clazzData );
+        } catch ( final Exception e ) {
+            e.printStackTrace();
+            this.errors.add( new JavaDialectError( "PackageStore was unable to write resourceName='" + resourceName + "'" ) );
+        }
+    }
+
+    public byte[] read(final String resourceName) {
+        byte[] clazz = null;
+        try {
+            clazz = this.packageCompilationData.read( resourceName );
+        } catch ( final Exception e ) {
+            this.errors.add( new JavaDialectError( "PackageStore was unable to read resourceName='" + resourceName + "'" ) );
+        }
+        return clazz;
+    }
+
+    public void remove(final String resourceName) {
+        try {
+            this.packageCompilationData.remove( resourceName );
+        } catch ( final Exception e ) {
+            this.errors.add( new JavaDialectError( "PackageStore was unable to remove resourceName='" + resourceName + "'"  ) );
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLexer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLexer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLexer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,4614 @@
+// $ANTLR 3.0.1 /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g 2007-12-19 16:46:02
+
+	package org.drools.rule.builder.dialect.java.parser;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+public class JavaLexer extends Lexer {
+    public static final int T29=29;
+    public static final int HexDigit=12;
+    public static final int T70=70;
+    public static final int T74=74;
+    public static final int T85=85;
+    public static final int T102=102;
+    public static final int Letter=19;
+    public static final int T114=114;
+    public static final int T103=103;
+    public static final int T32=32;
+    public static final int T81=81;
+    public static final int T41=41;
+    public static final int T24=24;
+    public static final int FloatTypeSuffix=15;
+    public static final int T113=113;
+    public static final int T62=62;
+    public static final int T109=109;
+    public static final int IntegerTypeSuffix=13;
+    public static final int T68=68;
+    public static final int T73=73;
+    public static final int T84=84;
+    public static final int T33=33;
+    public static final int Identifier=4;
+    public static final int T78=78;
+    public static final int WS=21;
+    public static final int T42=42;
+    public static final int T96=96;
+    public static final int T71=71;
+    public static final int LINE_COMMENT=23;
+    public static final int T72=72;
+    public static final int T94=94;
+    public static final int T76=76;
+    public static final int UnicodeEscape=17;
+    public static final int HexLiteral=9;
+    public static final int T75=75;
+    public static final int T89=89;
+    public static final int DecimalLiteral=11;
+    public static final int T67=67;
+    public static final int T31=31;
+    public static final int T60=60;
+    public static final int T82=82;
+    public static final int T100=100;
+    public static final int T49=49;
+    public static final int T30=30;
+    public static final int T79=79;
+    public static final int OctalLiteral=10;
+    public static final int T36=36;
+    public static final int T58=58;
+    public static final int T93=93;
+    public static final int T35=35;
+    public static final int T107=107;
+    public static final int T83=83;
+    public static final int T61=61;
+    public static final int T45=45;
+    public static final int T34=34;
+    public static final int T101=101;
+    public static final int T64=64;
+    public static final int T25=25;
+    public static final int T91=91;
+    public static final int T105=105;
+    public static final int T37=37;
+    public static final int T86=86;
+    public static final int EscapeSequence=16;
+    public static final int T26=26;
+    public static final int T51=51;
+    public static final int T111=111;
+    public static final int T46=46;
+    public static final int T77=77;
+    public static final int T38=38;
+    public static final int FloatingPointLiteral=6;
+    public static final int T106=106;
+    public static final int T112=112;
+    public static final int T69=69;
+    public static final int T39=39;
+    public static final int ENUM=5;
+    public static final int T44=44;
+    public static final int T55=55;
+    public static final int Exponent=14;
+    public static final int T95=95;
+    public static final int T50=50;
+    public static final int T110=110;
+    public static final int T108=108;
+    public static final int CharacterLiteral=7;
+    public static final int T92=92;
+    public static final int T43=43;
+    public static final int T28=28;
+    public static final int T40=40;
+    public static final int T66=66;
+    public static final int COMMENT=22;
+    public static final int T88=88;
+    public static final int StringLiteral=8;
+    public static final int T63=63;
+    public static final int T57=57;
+    public static final int T65=65;
+    public static final int T98=98;
+    public static final int T56=56;
+    public static final int T87=87;
+    public static final int T80=80;
+    public static final int JavaIDDigit=20;
+    public static final int T59=59;
+    public static final int T97=97;
+    public static final int T48=48;
+    public static final int T54=54;
+    public static final int EOF=-1;
+    public static final int T104=104;
+    public static final int T47=47;
+    public static final int Tokens=115;
+    public static final int T53=53;
+    public static final int OctalEscape=18;
+    public static final int T99=99;
+    public static final int T27=27;
+    public static final int T52=52;
+    public static final int T90=90;
+
+    	public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
+    	protected boolean enumIsKeyword = true;
+
+    public JavaLexer() {;} 
+    public JavaLexer(CharStream input) {
+        super(input);
+    }
+    public String getGrammarFileName() { return "/home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g"; }
+
+    // $ANTLR start T24
+    public final void mT24() throws RecognitionException {
+        try {
+            int _type = T24;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:10:5: ( 'package' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:10:7: 'package'
+            {
+            match("package"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T24
+
+    // $ANTLR start T25
+    public final void mT25() throws RecognitionException {
+        try {
+            int _type = T25;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:11:5: ( ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:11:7: ';'
+            {
+            match(';'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T25
+
+    // $ANTLR start T26
+    public final void mT26() throws RecognitionException {
+        try {
+            int _type = T26;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:12:5: ( 'import' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:12:7: 'import'
+            {
+            match("import"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T26
+
+    // $ANTLR start T27
+    public final void mT27() throws RecognitionException {
+        try {
+            int _type = T27;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:13:5: ( 'static' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:13:7: 'static'
+            {
+            match("static"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T27
+
+    // $ANTLR start T28
+    public final void mT28() throws RecognitionException {
+        try {
+            int _type = T28;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:14:5: ( '.' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:14:7: '.'
+            {
+            match('.'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T28
+
+    // $ANTLR start T29
+    public final void mT29() throws RecognitionException {
+        try {
+            int _type = T29;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:15:5: ( '*' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:15:7: '*'
+            {
+            match('*'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T29
+
+    // $ANTLR start T30
+    public final void mT30() throws RecognitionException {
+        try {
+            int _type = T30;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:16:5: ( 'class' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:16:7: 'class'
+            {
+            match("class"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T30
+
+    // $ANTLR start T31
+    public final void mT31() throws RecognitionException {
+        try {
+            int _type = T31;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:17:5: ( 'extends' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:17:7: 'extends'
+            {
+            match("extends"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T31
+
+    // $ANTLR start T32
+    public final void mT32() throws RecognitionException {
+        try {
+            int _type = T32;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:18:5: ( 'implements' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:18:7: 'implements'
+            {
+            match("implements"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T32
+
+    // $ANTLR start T33
+    public final void mT33() throws RecognitionException {
+        try {
+            int _type = T33;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:19:5: ( '<' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:19:7: '<'
+            {
+            match('<'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T33
+
+    // $ANTLR start T34
+    public final void mT34() throws RecognitionException {
+        try {
+            int _type = T34;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:20:5: ( ',' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:20:7: ','
+            {
+            match(','); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T34
+
+    // $ANTLR start T35
+    public final void mT35() throws RecognitionException {
+        try {
+            int _type = T35;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:21:5: ( '>' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:21:7: '>'
+            {
+            match('>'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T35
+
+    // $ANTLR start T36
+    public final void mT36() throws RecognitionException {
+        try {
+            int _type = T36;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:22:5: ( '&' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:22:7: '&'
+            {
+            match('&'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T36
+
+    // $ANTLR start T37
+    public final void mT37() throws RecognitionException {
+        try {
+            int _type = T37;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:23:5: ( '{' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:23:7: '{'
+            {
+            match('{'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T37
+
+    // $ANTLR start T38
+    public final void mT38() throws RecognitionException {
+        try {
+            int _type = T38;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:24:5: ( '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:24:7: '}'
+            {
+            match('}'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T38
+
+    // $ANTLR start T39
+    public final void mT39() throws RecognitionException {
+        try {
+            int _type = T39;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:25:5: ( 'interface' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:25:7: 'interface'
+            {
+            match("interface"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T39
+
+    // $ANTLR start T40
+    public final void mT40() throws RecognitionException {
+        try {
+            int _type = T40;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:26:5: ( 'void' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:26:7: 'void'
+            {
+            match("void"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T40
+
+    // $ANTLR start T41
+    public final void mT41() throws RecognitionException {
+        try {
+            int _type = T41;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:27:5: ( '[' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:27:7: '['
+            {
+            match('['); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T41
+
+    // $ANTLR start T42
+    public final void mT42() throws RecognitionException {
+        try {
+            int _type = T42;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:28:5: ( ']' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:28:7: ']'
+            {
+            match(']'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T42
+
+    // $ANTLR start T43
+    public final void mT43() throws RecognitionException {
+        try {
+            int _type = T43;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:29:5: ( 'throws' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:29:7: 'throws'
+            {
+            match("throws"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T43
+
+    // $ANTLR start T44
+    public final void mT44() throws RecognitionException {
+        try {
+            int _type = T44;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:30:5: ( '=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:30:7: '='
+            {
+            match('='); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T44
+
+    // $ANTLR start T45
+    public final void mT45() throws RecognitionException {
+        try {
+            int _type = T45;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:31:5: ( 'public' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:31:7: 'public'
+            {
+            match("public"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T45
+
+    // $ANTLR start T46
+    public final void mT46() throws RecognitionException {
+        try {
+            int _type = T46;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:32:5: ( 'protected' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:32:7: 'protected'
+            {
+            match("protected"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T46
+
+    // $ANTLR start T47
+    public final void mT47() throws RecognitionException {
+        try {
+            int _type = T47;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:33:5: ( 'private' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:33:7: 'private'
+            {
+            match("private"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T47
+
+    // $ANTLR start T48
+    public final void mT48() throws RecognitionException {
+        try {
+            int _type = T48;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:34:5: ( 'abstract' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:34:7: 'abstract'
+            {
+            match("abstract"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T48
+
+    // $ANTLR start T49
+    public final void mT49() throws RecognitionException {
+        try {
+            int _type = T49;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:35:5: ( 'final' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:35:7: 'final'
+            {
+            match("final"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T49
+
+    // $ANTLR start T50
+    public final void mT50() throws RecognitionException {
+        try {
+            int _type = T50;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:36:5: ( 'native' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:36:7: 'native'
+            {
+            match("native"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T50
+
+    // $ANTLR start T51
+    public final void mT51() throws RecognitionException {
+        try {
+            int _type = T51;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:37:5: ( 'synchronized' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:37:7: 'synchronized'
+            {
+            match("synchronized"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T51
+
+    // $ANTLR start T52
+    public final void mT52() throws RecognitionException {
+        try {
+            int _type = T52;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:38:5: ( 'transient' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:38:7: 'transient'
+            {
+            match("transient"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T52
+
+    // $ANTLR start T53
+    public final void mT53() throws RecognitionException {
+        try {
+            int _type = T53;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:39:5: ( 'volatile' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:39:7: 'volatile'
+            {
+            match("volatile"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T53
+
+    // $ANTLR start T54
+    public final void mT54() throws RecognitionException {
+        try {
+            int _type = T54;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:40:5: ( 'strictfp' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:40:7: 'strictfp'
+            {
+            match("strictfp"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T54
+
+    // $ANTLR start T55
+    public final void mT55() throws RecognitionException {
+        try {
+            int _type = T55;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:41:5: ( 'boolean' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:41:7: 'boolean'
+            {
+            match("boolean"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T55
+
+    // $ANTLR start T56
+    public final void mT56() throws RecognitionException {
+        try {
+            int _type = T56;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:42:5: ( 'char' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:42:7: 'char'
+            {
+            match("char"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T56
+
+    // $ANTLR start T57
+    public final void mT57() throws RecognitionException {
+        try {
+            int _type = T57;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:43:5: ( 'byte' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:43:7: 'byte'
+            {
+            match("byte"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T57
+
+    // $ANTLR start T58
+    public final void mT58() throws RecognitionException {
+        try {
+            int _type = T58;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:44:5: ( 'short' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:44:7: 'short'
+            {
+            match("short"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T58
+
+    // $ANTLR start T59
+    public final void mT59() throws RecognitionException {
+        try {
+            int _type = T59;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:45:5: ( 'int' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:45:7: 'int'
+            {
+            match("int"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T59
+
+    // $ANTLR start T60
+    public final void mT60() throws RecognitionException {
+        try {
+            int _type = T60;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:46:5: ( 'long' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:46:7: 'long'
+            {
+            match("long"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T60
+
+    // $ANTLR start T61
+    public final void mT61() throws RecognitionException {
+        try {
+            int _type = T61;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:47:5: ( 'float' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:47:7: 'float'
+            {
+            match("float"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T61
+
+    // $ANTLR start T62
+    public final void mT62() throws RecognitionException {
+        try {
+            int _type = T62;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:48:5: ( 'double' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:48:7: 'double'
+            {
+            match("double"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T62
+
+    // $ANTLR start T63
+    public final void mT63() throws RecognitionException {
+        try {
+            int _type = T63;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:49:5: ( '?' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:49:7: '?'
+            {
+            match('?'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T63
+
+    // $ANTLR start T64
+    public final void mT64() throws RecognitionException {
+        try {
+            int _type = T64;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:50:5: ( 'super' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:50:7: 'super'
+            {
+            match("super"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T64
+
+    // $ANTLR start T65
+    public final void mT65() throws RecognitionException {
+        try {
+            int _type = T65;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:51:5: ( '(' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:51:7: '('
+            {
+            match('('); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T65
+
+    // $ANTLR start T66
+    public final void mT66() throws RecognitionException {
+        try {
+            int _type = T66;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:52:5: ( ')' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:52:7: ')'
+            {
+            match(')'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T66
+
+    // $ANTLR start T67
+    public final void mT67() throws RecognitionException {
+        try {
+            int _type = T67;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:53:5: ( '...' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:53:7: '...'
+            {
+            match("..."); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T67
+
+    // $ANTLR start T68
+    public final void mT68() throws RecognitionException {
+        try {
+            int _type = T68;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:54:5: ( 'null' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:54:7: 'null'
+            {
+            match("null"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T68
+
+    // $ANTLR start T69
+    public final void mT69() throws RecognitionException {
+        try {
+            int _type = T69;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:55:5: ( 'true' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:55:7: 'true'
+            {
+            match("true"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T69
+
+    // $ANTLR start T70
+    public final void mT70() throws RecognitionException {
+        try {
+            int _type = T70;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:56:5: ( 'false' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:56:7: 'false'
+            {
+            match("false"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T70
+
+    // $ANTLR start T71
+    public final void mT71() throws RecognitionException {
+        try {
+            int _type = T71;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:57:5: ( '@' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:57:7: '@'
+            {
+            match('@'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T71
+
+    // $ANTLR start T72
+    public final void mT72() throws RecognitionException {
+        try {
+            int _type = T72;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:58:5: ( 'default' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:58:7: 'default'
+            {
+            match("default"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T72
+
+    // $ANTLR start T73
+    public final void mT73() throws RecognitionException {
+        try {
+            int _type = T73;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:59:5: ( 'assert' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:59:7: 'assert'
+            {
+            match("assert"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T73
+
+    // $ANTLR start T74
+    public final void mT74() throws RecognitionException {
+        try {
+            int _type = T74;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:60:5: ( ':' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:60:7: ':'
+            {
+            match(':'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T74
+
+    // $ANTLR start T75
+    public final void mT75() throws RecognitionException {
+        try {
+            int _type = T75;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:61:5: ( 'if' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:61:7: 'if'
+            {
+            match("if"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T75
+
+    // $ANTLR start T76
+    public final void mT76() throws RecognitionException {
+        try {
+            int _type = T76;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:62:5: ( 'else' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:62:7: 'else'
+            {
+            match("else"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T76
+
+    // $ANTLR start T77
+    public final void mT77() throws RecognitionException {
+        try {
+            int _type = T77;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:63:5: ( 'for' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:63:7: 'for'
+            {
+            match("for"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T77
+
+    // $ANTLR start T78
+    public final void mT78() throws RecognitionException {
+        try {
+            int _type = T78;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:64:5: ( 'while' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:64:7: 'while'
+            {
+            match("while"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T78
+
+    // $ANTLR start T79
+    public final void mT79() throws RecognitionException {
+        try {
+            int _type = T79;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:65:5: ( 'do' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:65:7: 'do'
+            {
+            match("do"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T79
+
+    // $ANTLR start T80
+    public final void mT80() throws RecognitionException {
+        try {
+            int _type = T80;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:66:5: ( 'try' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:66:7: 'try'
+            {
+            match("try"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T80
+
+    // $ANTLR start T81
+    public final void mT81() throws RecognitionException {
+        try {
+            int _type = T81;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:67:5: ( 'finally' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:67:7: 'finally'
+            {
+            match("finally"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T81
+
+    // $ANTLR start T82
+    public final void mT82() throws RecognitionException {
+        try {
+            int _type = T82;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:68:5: ( 'switch' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:68:7: 'switch'
+            {
+            match("switch"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T82
+
+    // $ANTLR start T83
+    public final void mT83() throws RecognitionException {
+        try {
+            int _type = T83;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:69:5: ( 'return' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:69:7: 'return'
+            {
+            match("return"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T83
+
+    // $ANTLR start T84
+    public final void mT84() throws RecognitionException {
+        try {
+            int _type = T84;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:70:5: ( 'throw' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:70:7: 'throw'
+            {
+            match("throw"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T84
+
+    // $ANTLR start T85
+    public final void mT85() throws RecognitionException {
+        try {
+            int _type = T85;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:71:5: ( 'break' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:71:7: 'break'
+            {
+            match("break"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T85
+
+    // $ANTLR start T86
+    public final void mT86() throws RecognitionException {
+        try {
+            int _type = T86;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:72:5: ( 'continue' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:72:7: 'continue'
+            {
+            match("continue"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T86
+
+    // $ANTLR start T87
+    public final void mT87() throws RecognitionException {
+        try {
+            int _type = T87;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:73:5: ( 'modify' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:73:7: 'modify'
+            {
+            match("modify"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T87
+
+    // $ANTLR start T88
+    public final void mT88() throws RecognitionException {
+        try {
+            int _type = T88;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:74:5: ( 'catch' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:74:7: 'catch'
+            {
+            match("catch"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T88
+
+    // $ANTLR start T89
+    public final void mT89() throws RecognitionException {
+        try {
+            int _type = T89;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:75:5: ( 'case' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:75:7: 'case'
+            {
+            match("case"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T89
+
+    // $ANTLR start T90
+    public final void mT90() throws RecognitionException {
+        try {
+            int _type = T90;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:76:5: ( '+=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:76:7: '+='
+            {
+            match("+="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T90
+
+    // $ANTLR start T91
+    public final void mT91() throws RecognitionException {
+        try {
+            int _type = T91;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:77:5: ( '-=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:77:7: '-='
+            {
+            match("-="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T91
+
+    // $ANTLR start T92
+    public final void mT92() throws RecognitionException {
+        try {
+            int _type = T92;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:78:5: ( '*=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:78:7: '*='
+            {
+            match("*="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T92
+
+    // $ANTLR start T93
+    public final void mT93() throws RecognitionException {
+        try {
+            int _type = T93;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:79:5: ( '/=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:79:7: '/='
+            {
+            match("/="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T93
+
+    // $ANTLR start T94
+    public final void mT94() throws RecognitionException {
+        try {
+            int _type = T94;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:80:5: ( '&=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:80:7: '&='
+            {
+            match("&="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T94
+
+    // $ANTLR start T95
+    public final void mT95() throws RecognitionException {
+        try {
+            int _type = T95;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:81:5: ( '|=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:81:7: '|='
+            {
+            match("|="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T95
+
+    // $ANTLR start T96
+    public final void mT96() throws RecognitionException {
+        try {
+            int _type = T96;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:82:5: ( '^=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:82:7: '^='
+            {
+            match("^="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T96
+
+    // $ANTLR start T97
+    public final void mT97() throws RecognitionException {
+        try {
+            int _type = T97;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:83:5: ( '%=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:83:7: '%='
+            {
+            match("%="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T97
+
+    // $ANTLR start T98
+    public final void mT98() throws RecognitionException {
+        try {
+            int _type = T98;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:84:5: ( '||' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:84:7: '||'
+            {
+            match("||"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T98
+
+    // $ANTLR start T99
+    public final void mT99() throws RecognitionException {
+        try {
+            int _type = T99;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:85:5: ( '&&' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:85:7: '&&'
+            {
+            match("&&"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T99
+
+    // $ANTLR start T100
+    public final void mT100() throws RecognitionException {
+        try {
+            int _type = T100;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:86:6: ( '|' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:86:8: '|'
+            {
+            match('|'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T100
+
+    // $ANTLR start T101
+    public final void mT101() throws RecognitionException {
+        try {
+            int _type = T101;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:87:6: ( '^' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:87:8: '^'
+            {
+            match('^'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T101
+
+    // $ANTLR start T102
+    public final void mT102() throws RecognitionException {
+        try {
+            int _type = T102;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:88:6: ( '==' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:88:8: '=='
+            {
+            match("=="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T102
+
+    // $ANTLR start T103
+    public final void mT103() throws RecognitionException {
+        try {
+            int _type = T103;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:89:6: ( '!=' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:89:8: '!='
+            {
+            match("!="); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T103
+
+    // $ANTLR start T104
+    public final void mT104() throws RecognitionException {
+        try {
+            int _type = T104;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:90:6: ( 'instanceof' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:90:8: 'instanceof'
+            {
+            match("instanceof"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T104
+
+    // $ANTLR start T105
+    public final void mT105() throws RecognitionException {
+        try {
+            int _type = T105;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:91:6: ( '+' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:91:8: '+'
+            {
+            match('+'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T105
+
+    // $ANTLR start T106
+    public final void mT106() throws RecognitionException {
+        try {
+            int _type = T106;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:92:6: ( '-' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:92:8: '-'
+            {
+            match('-'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T106
+
+    // $ANTLR start T107
+    public final void mT107() throws RecognitionException {
+        try {
+            int _type = T107;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:93:6: ( '/' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:93:8: '/'
+            {
+            match('/'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T107
+
+    // $ANTLR start T108
+    public final void mT108() throws RecognitionException {
+        try {
+            int _type = T108;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:94:6: ( '%' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:94:8: '%'
+            {
+            match('%'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T108
+
+    // $ANTLR start T109
+    public final void mT109() throws RecognitionException {
+        try {
+            int _type = T109;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:95:6: ( '++' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:95:8: '++'
+            {
+            match("++"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T109
+
+    // $ANTLR start T110
+    public final void mT110() throws RecognitionException {
+        try {
+            int _type = T110;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:96:6: ( '--' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:96:8: '--'
+            {
+            match("--"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T110
+
+    // $ANTLR start T111
+    public final void mT111() throws RecognitionException {
+        try {
+            int _type = T111;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:97:6: ( '~' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:97:8: '~'
+            {
+            match('~'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T111
+
+    // $ANTLR start T112
+    public final void mT112() throws RecognitionException {
+        try {
+            int _type = T112;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:98:6: ( '!' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:98:8: '!'
+            {
+            match('!'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T112
+
+    // $ANTLR start T113
+    public final void mT113() throws RecognitionException {
+        try {
+            int _type = T113;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:99:6: ( 'this' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:99:8: 'this'
+            {
+            match("this"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T113
+
+    // $ANTLR start T114
+    public final void mT114() throws RecognitionException {
+        try {
+            int _type = T114;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:100:6: ( 'new' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:100:8: 'new'
+            {
+            match("new"); 
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T114
+
+    // $ANTLR start HexLiteral
+    public final void mHexLiteral() throws RecognitionException {
+        try {
+            int _type = HexLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:12: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:14: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )?
+            {
+            match('0'); 
+            if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:28: ( HexDigit )+
+            int cnt1=0;
+            loop1:
+            do {
+                int alt1=2;
+                int LA1_0 = input.LA(1);
+
+                if ( ((LA1_0>='0' && LA1_0<='9')||(LA1_0>='A' && LA1_0<='F')||(LA1_0>='a' && LA1_0<='f')) ) {
+                    alt1=1;
+                }
+
+
+                switch (alt1) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:28: HexDigit
+            	    {
+            	    mHexDigit(); 
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt1 >= 1 ) break loop1;
+                        EarlyExitException eee =
+                            new EarlyExitException(1, input);
+                        throw eee;
+                }
+                cnt1++;
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:38: ( IntegerTypeSuffix )?
+            int alt2=2;
+            int LA2_0 = input.LA(1);
+
+            if ( (LA2_0=='L'||LA2_0=='l') ) {
+                alt2=1;
+            }
+            switch (alt2) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:960:38: IntegerTypeSuffix
+                    {
+                    mIntegerTypeSuffix(); 
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end HexLiteral
+
+    // $ANTLR start DecimalLiteral
+    public final void mDecimalLiteral() throws RecognitionException {
+        try {
+            int _type = DecimalLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:16: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:18: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )?
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:18: ( '0' | '1' .. '9' ( '0' .. '9' )* )
+            int alt4=2;
+            int LA4_0 = input.LA(1);
+
+            if ( (LA4_0=='0') ) {
+                alt4=1;
+            }
+            else if ( ((LA4_0>='1' && LA4_0<='9')) ) {
+                alt4=2;
+            }
+            else {
+                NoViableAltException nvae =
+                    new NoViableAltException("962:18: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 4, 0, input);
+
+                throw nvae;
+            }
+            switch (alt4) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:19: '0'
+                    {
+                    match('0'); 
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:25: '1' .. '9' ( '0' .. '9' )*
+                    {
+                    matchRange('1','9'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:34: ( '0' .. '9' )*
+                    loop3:
+                    do {
+                        int alt3=2;
+                        int LA3_0 = input.LA(1);
+
+                        if ( ((LA3_0>='0' && LA3_0<='9')) ) {
+                            alt3=1;
+                        }
+
+
+                        switch (alt3) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:34: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop3;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:45: ( IntegerTypeSuffix )?
+            int alt5=2;
+            int LA5_0 = input.LA(1);
+
+            if ( (LA5_0=='L'||LA5_0=='l') ) {
+                alt5=1;
+            }
+            switch (alt5) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:962:45: IntegerTypeSuffix
+                    {
+                    mIntegerTypeSuffix(); 
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DecimalLiteral
+
+    // $ANTLR start OctalLiteral
+    public final void mOctalLiteral() throws RecognitionException {
+        try {
+            int _type = OctalLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:14: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:16: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )?
+            {
+            match('0'); 
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:20: ( '0' .. '7' )+
+            int cnt6=0;
+            loop6:
+            do {
+                int alt6=2;
+                int LA6_0 = input.LA(1);
+
+                if ( ((LA6_0>='0' && LA6_0<='7')) ) {
+                    alt6=1;
+                }
+
+
+                switch (alt6) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:21: '0' .. '7'
+            	    {
+            	    matchRange('0','7'); 
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt6 >= 1 ) break loop6;
+                        EarlyExitException eee =
+                            new EarlyExitException(6, input);
+                        throw eee;
+                }
+                cnt6++;
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:32: ( IntegerTypeSuffix )?
+            int alt7=2;
+            int LA7_0 = input.LA(1);
+
+            if ( (LA7_0=='L'||LA7_0=='l') ) {
+                alt7=1;
+            }
+            switch (alt7) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:964:32: IntegerTypeSuffix
+                    {
+                    mIntegerTypeSuffix(); 
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OctalLiteral
+
+    // $ANTLR start HexDigit
+    public final void mHexDigit() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:967:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:967:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+            {
+            if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end HexDigit
+
+    // $ANTLR start IntegerTypeSuffix
+    public final void mIntegerTypeSuffix() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:970:19: ( ( 'l' | 'L' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:970:21: ( 'l' | 'L' )
+            {
+            if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end IntegerTypeSuffix
+
+    // $ANTLR start FloatingPointLiteral
+    public final void mFloatingPointLiteral() throws RecognitionException {
+        try {
+            int _type = FloatingPointLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix )
+            int alt19=4;
+            alt19 = dfa19.predict(input);
+            switch (alt19) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )?
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:9: ( '0' .. '9' )+
+                    int cnt8=0;
+                    loop8:
+                    do {
+                        int alt8=2;
+                        int LA8_0 = input.LA(1);
+
+                        if ( ((LA8_0>='0' && LA8_0<='9')) ) {
+                            alt8=1;
+                        }
+
+
+                        switch (alt8) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:10: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt8 >= 1 ) break loop8;
+                                EarlyExitException eee =
+                                    new EarlyExitException(8, input);
+                                throw eee;
+                        }
+                        cnt8++;
+                    } while (true);
+
+                    match('.'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:25: ( '0' .. '9' )*
+                    loop9:
+                    do {
+                        int alt9=2;
+                        int LA9_0 = input.LA(1);
+
+                        if ( ((LA9_0>='0' && LA9_0<='9')) ) {
+                            alt9=1;
+                        }
+
+
+                        switch (alt9) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:26: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop9;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:37: ( Exponent )?
+                    int alt10=2;
+                    int LA10_0 = input.LA(1);
+
+                    if ( (LA10_0=='E'||LA10_0=='e') ) {
+                        alt10=1;
+                    }
+                    switch (alt10) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:37: Exponent
+                            {
+                            mExponent(); 
+
+                            }
+                            break;
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:47: ( FloatTypeSuffix )?
+                    int alt11=2;
+                    int LA11_0 = input.LA(1);
+
+                    if ( (LA11_0=='D'||LA11_0=='F'||LA11_0=='d'||LA11_0=='f') ) {
+                        alt11=1;
+                    }
+                    switch (alt11) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:973:47: FloatTypeSuffix
+                            {
+                            mFloatTypeSuffix(); 
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )?
+                    {
+                    match('.'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:13: ( '0' .. '9' )+
+                    int cnt12=0;
+                    loop12:
+                    do {
+                        int alt12=2;
+                        int LA12_0 = input.LA(1);
+
+                        if ( ((LA12_0>='0' && LA12_0<='9')) ) {
+                            alt12=1;
+                        }
+
+
+                        switch (alt12) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:14: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt12 >= 1 ) break loop12;
+                                EarlyExitException eee =
+                                    new EarlyExitException(12, input);
+                                throw eee;
+                        }
+                        cnt12++;
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:25: ( Exponent )?
+                    int alt13=2;
+                    int LA13_0 = input.LA(1);
+
+                    if ( (LA13_0=='E'||LA13_0=='e') ) {
+                        alt13=1;
+                    }
+                    switch (alt13) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:25: Exponent
+                            {
+                            mExponent(); 
+
+                            }
+                            break;
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:35: ( FloatTypeSuffix )?
+                    int alt14=2;
+                    int LA14_0 = input.LA(1);
+
+                    if ( (LA14_0=='D'||LA14_0=='F'||LA14_0=='d'||LA14_0=='f') ) {
+                        alt14=1;
+                    }
+                    switch (alt14) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:974:35: FloatTypeSuffix
+                            {
+                            mFloatTypeSuffix(); 
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:975:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )?
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:975:9: ( '0' .. '9' )+
+                    int cnt15=0;
+                    loop15:
+                    do {
+                        int alt15=2;
+                        int LA15_0 = input.LA(1);
+
+                        if ( ((LA15_0>='0' && LA15_0<='9')) ) {
+                            alt15=1;
+                        }
+
+
+                        switch (alt15) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:975:10: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt15 >= 1 ) break loop15;
+                                EarlyExitException eee =
+                                    new EarlyExitException(15, input);
+                                throw eee;
+                        }
+                        cnt15++;
+                    } while (true);
+
+                    mExponent(); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:975:30: ( FloatTypeSuffix )?
+                    int alt16=2;
+                    int LA16_0 = input.LA(1);
+
+                    if ( (LA16_0=='D'||LA16_0=='F'||LA16_0=='d'||LA16_0=='f') ) {
+                        alt16=1;
+                    }
+                    switch (alt16) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:975:30: FloatTypeSuffix
+                            {
+                            mFloatTypeSuffix(); 
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:976:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:976:9: ( '0' .. '9' )+
+                    int cnt17=0;
+                    loop17:
+                    do {
+                        int alt17=2;
+                        int LA17_0 = input.LA(1);
+
+                        if ( ((LA17_0>='0' && LA17_0<='9')) ) {
+                            alt17=1;
+                        }
+
+
+                        switch (alt17) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:976:10: '0' .. '9'
+                    	    {
+                    	    matchRange('0','9'); 
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt17 >= 1 ) break loop17;
+                                EarlyExitException eee =
+                                    new EarlyExitException(17, input);
+                                throw eee;
+                        }
+                        cnt17++;
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:976:21: ( Exponent )?
+                    int alt18=2;
+                    int LA18_0 = input.LA(1);
+
+                    if ( (LA18_0=='E'||LA18_0=='e') ) {
+                        alt18=1;
+                    }
+                    switch (alt18) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:976:21: Exponent
+                            {
+                            mExponent(); 
+
+                            }
+                            break;
+
+                    }
+
+                    mFloatTypeSuffix(); 
+
+                    }
+                    break;
+
+            }
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FloatingPointLiteral
+
+    // $ANTLR start Exponent
+    public final void mExponent() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:980:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:980:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
+            {
+            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:980:22: ( '+' | '-' )?
+            int alt20=2;
+            int LA20_0 = input.LA(1);
+
+            if ( (LA20_0=='+'||LA20_0=='-') ) {
+                alt20=1;
+            }
+            switch (alt20) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+                    {
+                    if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
+                        input.consume();
+
+                    }
+                    else {
+                        MismatchedSetException mse =
+                            new MismatchedSetException(null,input);
+                        recover(mse);    throw mse;
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:980:33: ( '0' .. '9' )+
+            int cnt21=0;
+            loop21:
+            do {
+                int alt21=2;
+                int LA21_0 = input.LA(1);
+
+                if ( ((LA21_0>='0' && LA21_0<='9')) ) {
+                    alt21=1;
+                }
+
+
+                switch (alt21) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:980:34: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); 
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt21 >= 1 ) break loop21;
+                        EarlyExitException eee =
+                            new EarlyExitException(21, input);
+                        throw eee;
+                }
+                cnt21++;
+            } while (true);
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end Exponent
+
+    // $ANTLR start FloatTypeSuffix
+    public final void mFloatTypeSuffix() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:983:17: ( ( 'f' | 'F' | 'd' | 'D' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:983:19: ( 'f' | 'F' | 'd' | 'D' )
+            {
+            if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FloatTypeSuffix
+
+    // $ANTLR start CharacterLiteral
+    public final void mCharacterLiteral() throws RecognitionException {
+        try {
+            int _type = CharacterLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:986:5: ( '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:986:9: '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\''
+            {
+            match('\''); 
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:986:14: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )
+            int alt22=2;
+            int LA22_0 = input.LA(1);
+
+            if ( (LA22_0=='\\') ) {
+                alt22=1;
+            }
+            else if ( ((LA22_0>='\u0000' && LA22_0<='&')||(LA22_0>='(' && LA22_0<='[')||(LA22_0>=']' && LA22_0<='\uFFFE')) ) {
+                alt22=2;
+            }
+            else {
+                NoViableAltException nvae =
+                    new NoViableAltException("986:14: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 22, 0, input);
+
+                throw nvae;
+            }
+            switch (alt22) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:986:16: EscapeSequence
+                    {
+                    mEscapeSequence(); 
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:986:33: ~ ( '\\'' | '\\\\' )
+                    {
+                    if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+                        input.consume();
+
+                    }
+                    else {
+                        MismatchedSetException mse =
+                            new MismatchedSetException(null,input);
+                        recover(mse);    throw mse;
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            match('\''); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end CharacterLiteral
+
+    // $ANTLR start StringLiteral
+    public final void mStringLiteral() throws RecognitionException {
+        try {
+            int _type = StringLiteral;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:990:5: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:990:8: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+            {
+            match('\"'); 
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:990:12: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+            loop23:
+            do {
+                int alt23=3;
+                int LA23_0 = input.LA(1);
+
+                if ( (LA23_0=='\\') ) {
+                    alt23=1;
+                }
+                else if ( ((LA23_0>='\u0000' && LA23_0<='!')||(LA23_0>='#' && LA23_0<='[')||(LA23_0>=']' && LA23_0<='\uFFFE')) ) {
+                    alt23=2;
+                }
+
+
+                switch (alt23) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:990:14: EscapeSequence
+            	    {
+            	    mEscapeSequence(); 
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:990:31: ~ ( '\\\\' | '\"' )
+            	    {
+            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+            	        input.consume();
+
+            	    }
+            	    else {
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recover(mse);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop23;
+                }
+            } while (true);
+
+            match('\"'); 
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end StringLiteral
+
+    // $ANTLR start EscapeSequence
+    public final void mEscapeSequence() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:995:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape )
+            int alt24=3;
+            int LA24_0 = input.LA(1);
+
+            if ( (LA24_0=='\\') ) {
+                switch ( input.LA(2) ) {
+                case 'u':
+                    {
+                    alt24=2;
+                    }
+                    break;
+                case '\"':
+                case '\'':
+                case '\\':
+                case 'b':
+                case 'f':
+                case 'n':
+                case 'r':
+                case 't':
+                    {
+                    alt24=1;
+                    }
+                    break;
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                    {
+                    alt24=3;
+                    }
+                    break;
+                default:
+                    NoViableAltException nvae =
+                        new NoViableAltException("993:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 24, 1, input);
+
+                    throw nvae;
+                }
+
+            }
+            else {
+                NoViableAltException nvae =
+                    new NoViableAltException("993:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 24, 0, input);
+
+                throw nvae;
+            }
+            switch (alt24) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:995:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
+                    {
+                    match('\\'); 
+                    if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
+                        input.consume();
+
+                    }
+                    else {
+                        MismatchedSetException mse =
+                            new MismatchedSetException(null,input);
+                        recover(mse);    throw mse;
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:996:9: UnicodeEscape
+                    {
+                    mUnicodeEscape(); 
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:997:9: OctalEscape
+                    {
+                    mOctalEscape(); 
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EscapeSequence
+
+    // $ANTLR start OctalEscape
+    public final void mOctalEscape() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+            int alt25=3;
+            int LA25_0 = input.LA(1);
+
+            if ( (LA25_0=='\\') ) {
+                int LA25_1 = input.LA(2);
+
+                if ( ((LA25_1>='0' && LA25_1<='3')) ) {
+                    int LA25_2 = input.LA(3);
+
+                    if ( ((LA25_2>='0' && LA25_2<='7')) ) {
+                        int LA25_5 = input.LA(4);
+
+                        if ( ((LA25_5>='0' && LA25_5<='7')) ) {
+                            alt25=1;
+                        }
+                        else {
+                            alt25=2;}
+                    }
+                    else {
+                        alt25=3;}
+                }
+                else if ( ((LA25_1>='4' && LA25_1<='7')) ) {
+                    int LA25_3 = input.LA(3);
+
+                    if ( ((LA25_3>='0' && LA25_3<='7')) ) {
+                        alt25=2;
+                    }
+                    else {
+                        alt25=3;}
+                }
+                else {
+                    NoViableAltException nvae =
+                        new NoViableAltException("1000:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 25, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                NoViableAltException nvae =
+                    new NoViableAltException("1000:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 25, 0, input);
+
+                throw nvae;
+            }
+            switch (alt25) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:14: ( '0' .. '3' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:15: '0' .. '3'
+                    {
+                    matchRange('0','3'); 
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:25: ( '0' .. '7' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); 
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:36: ( '0' .. '7' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1002:37: '0' .. '7'
+                    {
+                    matchRange('0','7'); 
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1003:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1003:14: ( '0' .. '7' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1003:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); 
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1003:25: ( '0' .. '7' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1003:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); 
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1004:9: '\\\\' ( '0' .. '7' )
+                    {
+                    match('\\'); 
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1004:14: ( '0' .. '7' )
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1004:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); 
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OctalEscape
+
+    // $ANTLR start UnicodeEscape
+    public final void mUnicodeEscape() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1009:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1009:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+            {
+            match('\\'); 
+            match('u'); 
+            mHexDigit(); 
+            mHexDigit(); 
+            mHexDigit(); 
+            mHexDigit(); 
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end UnicodeEscape
+
+    // $ANTLR start ENUM
+    public final void mENUM() throws RecognitionException {
+        try {
+            int _type = ENUM;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1012:5: ( 'enum' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1012:7: 'enum'
+            {
+            match("enum"); 
+
+            if ( !enumIsKeyword ) _type=Identifier;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ENUM
+
+    // $ANTLR start Identifier
+    public final void mIdentifier() throws RecognitionException {
+        try {
+            int _type = Identifier;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1016:5: ( Letter ( Letter | JavaIDDigit )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1016:9: Letter ( Letter | JavaIDDigit )*
+            {
+            mLetter(); 
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1016:16: ( Letter | JavaIDDigit )*
+            loop26:
+            do {
+                int alt26=2;
+                int LA26_0 = input.LA(1);
+
+                if ( (LA26_0=='$'||(LA26_0>='0' && LA26_0<='9')||(LA26_0>='A' && LA26_0<='Z')||LA26_0=='_'||(LA26_0>='a' && LA26_0<='z')||(LA26_0>='\u00C0' && LA26_0<='\u00D6')||(LA26_0>='\u00D8' && LA26_0<='\u00F6')||(LA26_0>='\u00F8' && LA26_0<='\u1FFF')||(LA26_0>='\u3040' && LA26_0<='\u318F')||(LA26_0>='\u3300' && LA26_0<='\u337F')||(LA26_0>='\u3400' && LA26_0<='\u3D2D')||(LA26_0>='\u4E00' && LA26_0<='\u9FFF')||(LA26_0>='\uF900' && LA26_0<='\uFAFF')) ) {
+                    alt26=1;
+                }
+
+
+                switch (alt26) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            	    {
+            	    if ( input.LA(1)=='$'||(input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00D6')||(input.LA(1)>='\u00D8' && input.LA(1)<='\u00F6')||(input.LA(1)>='\u00F8' && input.LA(1)<='\u1FFF')||(input.LA(1)>='\u3040' && input.LA(1)<='\u318F')||(input.LA(1)>='\u3300' && input.LA(1)<='\u337F')||(input.LA(1)>='\u3400' && input.LA(1)<='\u3D2D')||(input.LA(1)>='\u4E00' && input.LA(1)<='\u9FFF')||(input.LA(1)>='\uF900' && input.LA(1)<='\uFAFF') ) {
+            	        input.consume();
+
+            	    }
+            	    else {
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recover(mse);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop26;
+                }
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end Identifier
+
+    // $ANTLR start Letter
+    public final void mLetter() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1024:5: ( '\\u0024' | '\\u0041' .. '\\u005a' | '\\u005f' | '\\u0061' .. '\\u007a' | '\\u00c0' .. '\\u00d6' | '\\u00d8' .. '\\u00f6' | '\\u00f8' .. '\\u00ff' | '\\u0100' .. '\\u1fff' | '\\u3040' .. '\\u318f' | '\\u3300' .. '\\u337f' | '\\u3400' .. '\\u3d2d' | '\\u4e00' .. '\\u9fff' | '\\uf900' .. '\\ufaff' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            {
+            if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00D6')||(input.LA(1)>='\u00D8' && input.LA(1)<='\u00F6')||(input.LA(1)>='\u00F8' && input.LA(1)<='\u1FFF')||(input.LA(1)>='\u3040' && input.LA(1)<='\u318F')||(input.LA(1)>='\u3300' && input.LA(1)<='\u337F')||(input.LA(1)>='\u3400' && input.LA(1)<='\u3D2D')||(input.LA(1)>='\u4E00' && input.LA(1)<='\u9FFF')||(input.LA(1)>='\uF900' && input.LA(1)<='\uFAFF') ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end Letter
+
+    // $ANTLR start JavaIDDigit
+    public final void mJavaIDDigit() throws RecognitionException {
+        try {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1041:5: ( '\\u0030' .. '\\u0039' | '\\u0660' .. '\\u0669' | '\\u06f0' .. '\\u06f9' | '\\u0966' .. '\\u096f' | '\\u09e6' .. '\\u09ef' | '\\u0a66' .. '\\u0a6f' | '\\u0ae6' .. '\\u0aef' | '\\u0b66' .. '\\u0b6f' | '\\u0be7' .. '\\u0bef' | '\\u0c66' .. '\\u0c6f' | '\\u0ce6' .. '\\u0cef' | '\\u0d66' .. '\\u0d6f' | '\\u0e50' .. '\\u0e59' | '\\u0ed0' .. '\\u0ed9' | '\\u1040' .. '\\u1049' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            {
+            if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='\u0660' && input.LA(1)<='\u0669')||(input.LA(1)>='\u06F0' && input.LA(1)<='\u06F9')||(input.LA(1)>='\u0966' && input.LA(1)<='\u096F')||(input.LA(1)>='\u09E6' && input.LA(1)<='\u09EF')||(input.LA(1)>='\u0A66' && input.LA(1)<='\u0A6F')||(input.LA(1)>='\u0AE6' && input.LA(1)<='\u0AEF')||(input.LA(1)>='\u0B66' && input.LA(1)<='\u0B6F')||(input.LA(1)>='\u0BE7' && input.LA(1)<='\u0BEF')||(input.LA(1)>='\u0C66' && input.LA(1)<='\u0C6F')||(input.LA(1)>='\u0CE6' && input.LA(1)<='\u0CEF')||(input.LA(1)>='\u0D66' && input.LA(1)<='\u0D6F')||(input.LA(1)>='\u0E50' && input.LA(1)<='\u0E59')||(input.LA(1)>='\u0ED0' && input.LA(1)<='\u0ED9')||(input.LA(1)>='\u1040' && input.LA(1)<='\u1049') ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end JavaIDDigit
+
+    // $ANTLR start WS
+    public final void mWS() throws RecognitionException {
+        try {
+            int _type = WS;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1058:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1058:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )
+            {
+            if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) {
+                input.consume();
+
+            }
+            else {
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+            channel=HIDDEN;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end WS
+
+    // $ANTLR start COMMENT
+    public final void mCOMMENT() throws RecognitionException {
+        try {
+            int _type = COMMENT;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1062:5: ( '/*' ( options {greedy=false; } : . )* '*/' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1062:9: '/*' ( options {greedy=false; } : . )* '*/'
+            {
+            match("/*"); 
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1062:14: ( options {greedy=false; } : . )*
+            loop27:
+            do {
+                int alt27=2;
+                int LA27_0 = input.LA(1);
+
+                if ( (LA27_0=='*') ) {
+                    int LA27_1 = input.LA(2);
+
+                    if ( (LA27_1=='/') ) {
+                        alt27=2;
+                    }
+                    else if ( ((LA27_1>='\u0000' && LA27_1<='.')||(LA27_1>='0' && LA27_1<='\uFFFE')) ) {
+                        alt27=1;
+                    }
+
+
+                }
+                else if ( ((LA27_0>='\u0000' && LA27_0<=')')||(LA27_0>='+' && LA27_0<='\uFFFE')) ) {
+                    alt27=1;
+                }
+
+
+                switch (alt27) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1062:42: .
+            	    {
+            	    matchAny(); 
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop27;
+                }
+            } while (true);
+
+            match("*/"); 
+
+            channel=HIDDEN;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end COMMENT
+
+    // $ANTLR start LINE_COMMENT
+    public final void mLINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = LINE_COMMENT;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n'
+            {
+            match("//"); 
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:12: (~ ( '\\n' | '\\r' ) )*
+            loop28:
+            do {
+                int alt28=2;
+                int LA28_0 = input.LA(1);
+
+                if ( ((LA28_0>='\u0000' && LA28_0<='\t')||(LA28_0>='\u000B' && LA28_0<='\f')||(LA28_0>='\u000E' && LA28_0<='\uFFFE')) ) {
+                    alt28=1;
+                }
+
+
+                switch (alt28) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:12: ~ ( '\\n' | '\\r' )
+            	    {
+            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) {
+            	        input.consume();
+
+            	    }
+            	    else {
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recover(mse);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop28;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:26: ( '\\r' )?
+            int alt29=2;
+            int LA29_0 = input.LA(1);
+
+            if ( (LA29_0=='\r') ) {
+                alt29=1;
+            }
+            switch (alt29) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1066:26: '\\r'
+                    {
+                    match('\r'); 
+
+                    }
+                    break;
+
+            }
+
+            match('\n'); 
+            channel=HIDDEN;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LINE_COMMENT
+
+    public void mTokens() throws RecognitionException {
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:8: ( T24 | T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | HexLiteral | DecimalLiteral | OctalLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | ENUM | Identifier | WS | COMMENT | LINE_COMMENT )
+        int alt30=102;
+        alt30 = dfa30.predict(input);
+        switch (alt30) {
+            case 1 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:10: T24
+                {
+                mT24(); 
+
+                }
+                break;
+            case 2 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:14: T25
+                {
+                mT25(); 
+
+                }
+                break;
+            case 3 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:18: T26
+                {
+                mT26(); 
+
+                }
+                break;
+            case 4 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:22: T27
+                {
+                mT27(); 
+
+                }
+                break;
+            case 5 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:26: T28
+                {
+                mT28(); 
+
+                }
+                break;
+            case 6 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:30: T29
+                {
+                mT29(); 
+
+                }
+                break;
+            case 7 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:34: T30
+                {
+                mT30(); 
+
+                }
+                break;
+            case 8 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:38: T31
+                {
+                mT31(); 
+
+                }
+                break;
+            case 9 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:42: T32
+                {
+                mT32(); 
+
+                }
+                break;
+            case 10 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:46: T33
+                {
+                mT33(); 
+
+                }
+                break;
+            case 11 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:50: T34
+                {
+                mT34(); 
+
+                }
+                break;
+            case 12 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:54: T35
+                {
+                mT35(); 
+
+                }
+                break;
+            case 13 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:58: T36
+                {
+                mT36(); 
+
+                }
+                break;
+            case 14 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:62: T37
+                {
+                mT37(); 
+
+                }
+                break;
+            case 15 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:66: T38
+                {
+                mT38(); 
+
+                }
+                break;
+            case 16 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:70: T39
+                {
+                mT39(); 
+
+                }
+                break;
+            case 17 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:74: T40
+                {
+                mT40(); 
+
+                }
+                break;
+            case 18 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:78: T41
+                {
+                mT41(); 
+
+                }
+                break;
+            case 19 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:82: T42
+                {
+                mT42(); 
+
+                }
+                break;
+            case 20 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:86: T43
+                {
+                mT43(); 
+
+                }
+                break;
+            case 21 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:90: T44
+                {
+                mT44(); 
+
+                }
+                break;
+            case 22 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:94: T45
+                {
+                mT45(); 
+
+                }
+                break;
+            case 23 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:98: T46
+                {
+                mT46(); 
+
+                }
+                break;
+            case 24 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:102: T47
+                {
+                mT47(); 
+
+                }
+                break;
+            case 25 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:106: T48
+                {
+                mT48(); 
+
+                }
+                break;
+            case 26 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:110: T49
+                {
+                mT49(); 
+
+                }
+                break;
+            case 27 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:114: T50
+                {
+                mT50(); 
+
+                }
+                break;
+            case 28 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:118: T51
+                {
+                mT51(); 
+
+                }
+                break;
+            case 29 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:122: T52
+                {
+                mT52(); 
+
+                }
+                break;
+            case 30 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:126: T53
+                {
+                mT53(); 
+
+                }
+                break;
+            case 31 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:130: T54
+                {
+                mT54(); 
+
+                }
+                break;
+            case 32 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:134: T55
+                {
+                mT55(); 
+
+                }
+                break;
+            case 33 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:138: T56
+                {
+                mT56(); 
+
+                }
+                break;
+            case 34 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:142: T57
+                {
+                mT57(); 
+
+                }
+                break;
+            case 35 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:146: T58
+                {
+                mT58(); 
+
+                }
+                break;
+            case 36 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:150: T59
+                {
+                mT59(); 
+
+                }
+                break;
+            case 37 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:154: T60
+                {
+                mT60(); 
+
+                }
+                break;
+            case 38 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:158: T61
+                {
+                mT61(); 
+
+                }
+                break;
+            case 39 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:162: T62
+                {
+                mT62(); 
+
+                }
+                break;
+            case 40 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:166: T63
+                {
+                mT63(); 
+
+                }
+                break;
+            case 41 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:170: T64
+                {
+                mT64(); 
+
+                }
+                break;
+            case 42 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:174: T65
+                {
+                mT65(); 
+
+                }
+                break;
+            case 43 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:178: T66
+                {
+                mT66(); 
+
+                }
+                break;
+            case 44 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:182: T67
+                {
+                mT67(); 
+
+                }
+                break;
+            case 45 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:186: T68
+                {
+                mT68(); 
+
+                }
+                break;
+            case 46 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:190: T69
+                {
+                mT69(); 
+
+                }
+                break;
+            case 47 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:194: T70
+                {
+                mT70(); 
+
+                }
+                break;
+            case 48 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:198: T71
+                {
+                mT71(); 
+
+                }
+                break;
+            case 49 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:202: T72
+                {
+                mT72(); 
+
+                }
+                break;
+            case 50 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:206: T73
+                {
+                mT73(); 
+
+                }
+                break;
+            case 51 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:210: T74
+                {
+                mT74(); 
+
+                }
+                break;
+            case 52 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:214: T75
+                {
+                mT75(); 
+
+                }
+                break;
+            case 53 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:218: T76
+                {
+                mT76(); 
+
+                }
+                break;
+            case 54 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:222: T77
+                {
+                mT77(); 
+
+                }
+                break;
+            case 55 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:226: T78
+                {
+                mT78(); 
+
+                }
+                break;
+            case 56 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:230: T79
+                {
+                mT79(); 
+
+                }
+                break;
+            case 57 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:234: T80
+                {
+                mT80(); 
+
+                }
+                break;
+            case 58 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:238: T81
+                {
+                mT81(); 
+
+                }
+                break;
+            case 59 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:242: T82
+                {
+                mT82(); 
+
+                }
+                break;
+            case 60 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:246: T83
+                {
+                mT83(); 
+
+                }
+                break;
+            case 61 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:250: T84
+                {
+                mT84(); 
+
+                }
+                break;
+            case 62 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:254: T85
+                {
+                mT85(); 
+
+                }
+                break;
+            case 63 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:258: T86
+                {
+                mT86(); 
+
+                }
+                break;
+            case 64 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:262: T87
+                {
+                mT87(); 
+
+                }
+                break;
+            case 65 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:266: T88
+                {
+                mT88(); 
+
+                }
+                break;
+            case 66 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:270: T89
+                {
+                mT89(); 
+
+                }
+                break;
+            case 67 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:274: T90
+                {
+                mT90(); 
+
+                }
+                break;
+            case 68 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:278: T91
+                {
+                mT91(); 
+
+                }
+                break;
+            case 69 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:282: T92
+                {
+                mT92(); 
+
+                }
+                break;
+            case 70 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:286: T93
+                {
+                mT93(); 
+
+                }
+                break;
+            case 71 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:290: T94
+                {
+                mT94(); 
+
+                }
+                break;
+            case 72 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:294: T95
+                {
+                mT95(); 
+
+                }
+                break;
+            case 73 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:298: T96
+                {
+                mT96(); 
+
+                }
+                break;
+            case 74 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:302: T97
+                {
+                mT97(); 
+
+                }
+                break;
+            case 75 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:306: T98
+                {
+                mT98(); 
+
+                }
+                break;
+            case 76 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:310: T99
+                {
+                mT99(); 
+
+                }
+                break;
+            case 77 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:314: T100
+                {
+                mT100(); 
+
+                }
+                break;
+            case 78 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:319: T101
+                {
+                mT101(); 
+
+                }
+                break;
+            case 79 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:324: T102
+                {
+                mT102(); 
+
+                }
+                break;
+            case 80 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:329: T103
+                {
+                mT103(); 
+
+                }
+                break;
+            case 81 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:334: T104
+                {
+                mT104(); 
+
+                }
+                break;
+            case 82 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:339: T105
+                {
+                mT105(); 
+
+                }
+                break;
+            case 83 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:344: T106
+                {
+                mT106(); 
+
+                }
+                break;
+            case 84 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:349: T107
+                {
+                mT107(); 
+
+                }
+                break;
+            case 85 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:354: T108
+                {
+                mT108(); 
+
+                }
+                break;
+            case 86 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:359: T109
+                {
+                mT109(); 
+
+                }
+                break;
+            case 87 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:364: T110
+                {
+                mT110(); 
+
+                }
+                break;
+            case 88 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:369: T111
+                {
+                mT111(); 
+
+                }
+                break;
+            case 89 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:374: T112
+                {
+                mT112(); 
+
+                }
+                break;
+            case 90 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:379: T113
+                {
+                mT113(); 
+
+                }
+                break;
+            case 91 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:384: T114
+                {
+                mT114(); 
+
+                }
+                break;
+            case 92 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:389: HexLiteral
+                {
+                mHexLiteral(); 
+
+                }
+                break;
+            case 93 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:400: DecimalLiteral
+                {
+                mDecimalLiteral(); 
+
+                }
+                break;
+            case 94 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:415: OctalLiteral
+                {
+                mOctalLiteral(); 
+
+                }
+                break;
+            case 95 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:428: FloatingPointLiteral
+                {
+                mFloatingPointLiteral(); 
+
+                }
+                break;
+            case 96 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:449: CharacterLiteral
+                {
+                mCharacterLiteral(); 
+
+                }
+                break;
+            case 97 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:466: StringLiteral
+                {
+                mStringLiteral(); 
+
+                }
+                break;
+            case 98 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:480: ENUM
+                {
+                mENUM(); 
+
+                }
+                break;
+            case 99 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:485: Identifier
+                {
+                mIdentifier(); 
+
+                }
+                break;
+            case 100 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:496: WS
+                {
+                mWS(); 
+
+                }
+                break;
+            case 101 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:499: COMMENT
+                {
+                mCOMMENT(); 
+
+                }
+                break;
+            case 102 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:1:507: LINE_COMMENT
+                {
+                mLINE_COMMENT(); 
+
+                }
+                break;
+
+        }
+
+    }
+
+
+    protected DFA19 dfa19 = new DFA19(this);
+    protected DFA30 dfa30 = new DFA30(this);
+    static final String DFA19_eotS =
+        "\7\uffff\1\10\2\uffff";
+    static final String DFA19_eofS =
+        "\12\uffff";
+    static final String DFA19_minS =
+        "\2\56\1\uffff\1\53\2\uffff\2\60\2\uffff";
+    static final String DFA19_maxS =
+        "\1\71\1\146\1\uffff\1\71\2\uffff\1\71\1\146\2\uffff";
+    static final String DFA19_acceptS =
+        "\2\uffff\1\2\1\uffff\1\4\1\1\2\uffff\2\3";
+    static final String DFA19_specialS =
+        "\12\uffff}>";
+    static final String[] DFA19_transitionS = {
+            "\1\2\1\uffff\12\1",
+            "\1\5\1\uffff\12\1\12\uffff\1\4\1\3\1\4\35\uffff\1\4\1\3\1\4",
+            "",
+            "\1\6\1\uffff\1\6\2\uffff\12\7",
+            "",
+            "",
+            "\12\7",
+            "\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff\1\11",
+            "",
+            ""
+    };
+
+    static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
+    static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
+    static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
+    static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
+    static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
+    static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
+    static final short[][] DFA19_transition;
+
+    static {
+        int numStates = DFA19_transitionS.length;
+        DFA19_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
+        }
+    }
+
+    class DFA19 extends DFA {
+
+        public DFA19(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 19;
+            this.eot = DFA19_eot;
+            this.eof = DFA19_eof;
+            this.min = DFA19_min;
+            this.max = DFA19_max;
+            this.accept = DFA19_accept;
+            this.special = DFA19_special;
+            this.transition = DFA19_transition;
+        }
+        public String getDescription() {
+            return "972:1: FloatingPointLiteral : ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix );";
+        }
+    }
+    static final String DFA30_eotS =
+        "\1\uffff\1\56\1\uffff\2\56\1\74\1\77\2\56\3\uffff\1\111\2\uffff"+
+        "\1\56\2\uffff\1\56\1\116\6\56\5\uffff\3\56\1\143\1\146\1\152\1\155"+
+        "\1\157\1\161\1\163\1\uffff\2\165\4\uffff\3\56\1\174\7\56\5\uffff"+
+        "\7\56\3\uffff\3\56\2\uffff\16\56\1\u00a4\3\56\25\uffff\1\u00a8\1"+
+        "\165\4\56\1\uffff\1\u00ae\23\56\1\u00c3\10\56\1\u00cc\1\56\1\u00ce"+
+        "\7\56\1\uffff\3\56\1\uffff\5\56\1\uffff\11\56\1\u00e7\1\56\1\u00e9"+
+        "\2\56\1\u00ec\1\u00ed\1\56\1\u00ef\1\56\1\u00f1\1\uffff\1\56\1\u00f3"+
+        "\6\56\1\uffff\1\u00fa\1\uffff\3\56\1\u00fe\1\u00ff\20\56\1\u0110"+
+        "\1\56\1\u0112\1\uffff\1\u0113\1\uffff\1\u0114\1\56\2\uffff\1\56"+
+        "\1\uffff\1\56\1\uffff\1\56\1\uffff\1\u011a\2\56\1\u011d\1\u011f"+
+        "\1\u0120\1\uffff\2\56\1\u0123\2\uffff\2\56\1\u0126\4\56\1\u012b"+
+        "\3\56\1\u012f\2\56\1\u0132\1\u0133\1\uffff\1\56\3\uffff\4\56\1\u0139"+
+        "\1\uffff\1\u013a\1\56\1\uffff\1\56\2\uffff\1\u013d\1\56\1\uffff"+
+        "\1\56\1\u0140\1\uffff\1\u0141\1\u0142\1\u0143\1\56\1\uffff\1\u0145"+
+        "\2\56\1\uffff\2\56\2\uffff\2\56\1\u014c\2\56\2\uffff\1\56\1\u0150"+
+        "\1\uffff\1\u0151\1\u0152\4\uffff\1\56\1\uffff\3\56\1\u0157\1\56"+
+        "\1\u0159\1\uffff\1\u015a\1\56\1\u015c\3\uffff\1\u015d\1\u015e\2"+
+        "\56\1\uffff\1\56\2\uffff\1\u0162\3\uffff\1\u0163\1\u0164\1\56\3"+
+        "\uffff\1\56\1\u0167\1\uffff";
+    static final String DFA30_eofS =
+        "\u0168\uffff";
+    static final String DFA30_minS =
+        "\1\11\1\141\1\uffff\1\146\1\150\1\56\1\75\1\141\1\154\3\uffff\1"+
+        "\46\2\uffff\1\157\2\uffff\1\150\1\75\1\142\2\141\2\157\1\145\5\uffff"+
+        "\1\150\1\145\1\157\1\53\1\55\1\52\4\75\1\uffff\2\56\4\uffff\1\151"+
+        "\1\142\1\143\1\44\1\163\1\160\1\141\1\151\1\157\1\156\1\160\5\uffff"+
+        "\1\141\1\163\1\141\1\156\1\163\1\165\1\164\3\uffff\1\151\1\141\1"+
+        "\151\2\uffff\2\163\1\154\1\156\1\157\1\162\1\154\1\167\1\164\1\157"+
+        "\1\145\1\164\1\156\1\146\1\44\1\151\1\164\1\144\25\uffff\2\56\1"+
+        "\166\1\164\1\154\1\153\1\uffff\1\44\1\164\1\154\1\151\2\164\1\162"+
+        "\1\143\1\145\1\162\1\143\1\145\1\163\1\164\1\145\1\155\1\145\1\144"+
+        "\1\141\1\145\1\44\1\156\1\163\1\157\1\145\1\164\1\163\2\141\1\44"+
+        "\1\154\1\44\1\151\1\154\1\141\1\145\1\147\1\141\1\142\1\uffff\1"+
+        "\154\1\165\1\151\1\uffff\1\141\1\145\1\151\1\141\1\162\1\uffff\1"+
+        "\141\1\162\1\145\1\143\1\151\1\143\1\164\1\150\1\162\1\44\1\150"+
+        "\1\44\1\163\1\151\2\44\1\156\1\44\1\164\1\44\1\uffff\1\163\1\44"+
+        "\1\167\2\162\1\145\1\154\1\164\1\uffff\1\44\1\uffff\1\166\1\145"+
+        "\1\153\2\44\1\165\1\154\1\145\1\162\1\146\1\164\2\143\1\147\1\146"+
+        "\1\156\1\164\1\155\1\164\1\143\1\150\1\44\1\162\1\44\1\uffff\1\44"+
+        "\1\uffff\1\44\1\156\2\uffff\1\144\1\uffff\1\151\1\uffff\1\151\1"+
+        "\uffff\1\44\1\164\1\141\3\44\1\uffff\1\145\1\141\1\44\2\uffff\1"+
+        "\154\1\145\1\44\1\156\1\171\1\145\1\164\1\44\1\145\1\141\1\143\1"+
+        "\44\1\145\1\146\2\44\1\uffff\1\157\3\uffff\1\165\1\163\1\154\1\145"+
+        "\1\44\1\uffff\1\44\1\143\1\uffff\1\171\2\uffff\1\44\1\156\1\uffff"+
+        "\1\164\1\44\1\uffff\3\44\1\145\1\uffff\1\44\1\143\1\145\1\uffff"+
+        "\1\156\1\160\2\uffff\1\156\1\145\1\44\1\145\1\156\2\uffff\1\164"+
+        "\1\44\1\uffff\2\44\4\uffff\1\144\1\uffff\1\145\1\157\1\164\1\44"+
+        "\1\151\1\44\1\uffff\1\44\1\164\1\44\3\uffff\2\44\1\146\1\163\1\uffff"+
+        "\1\172\2\uffff\1\44\3\uffff\2\44\1\145\3\uffff\1\144\1\44\1\uffff";
+    static final String DFA30_maxS =
+        "\1\ufaff\1\165\1\uffff\1\156\1\171\1\71\1\75\1\157\1\170\3\uffff"+
+        "\1\75\2\uffff\1\157\2\uffff\1\162\1\75\1\163\1\157\1\165\1\171\2"+
+        "\157\5\uffff\1\150\1\145\1\157\3\75\1\174\3\75\1\uffff\1\170\1\146"+
+        "\4\uffff\1\157\1\142\1\143\1\ufaff\1\164\1\160\1\162\1\151\1\157"+
+        "\1\156\1\160\5\uffff\1\141\1\164\1\141\1\156\1\163\1\165\1\164\3"+
+        "\uffff\1\154\1\171\1\162\2\uffff\2\163\1\154\1\156\1\157\1\162\1"+
+        "\154\1\167\1\164\1\157\1\145\1\164\1\156\1\146\1\ufaff\1\151\1\164"+
+        "\1\144\25\uffff\2\146\1\166\1\164\1\154\1\153\1\uffff\1\ufaff\1"+
+        "\164\1\157\1\151\2\164\1\162\1\143\1\145\1\162\1\143\1\145\1\163"+
+        "\1\164\1\145\1\155\1\145\1\144\1\141\1\145\1\ufaff\1\156\1\163\1"+
+        "\157\1\145\1\164\1\163\2\141\1\ufaff\1\154\1\ufaff\1\151\1\154\1"+
+        "\141\1\145\1\147\1\141\1\142\1\uffff\1\154\1\165\1\151\1\uffff\1"+
+        "\141\1\145\1\151\1\141\1\162\1\uffff\1\141\1\162\1\145\1\143\1\151"+
+        "\1\143\1\164\1\150\1\162\1\ufaff\1\150\1\ufaff\1\163\1\151\2\ufaff"+
+        "\1\156\1\ufaff\1\164\1\ufaff\1\uffff\1\163\1\ufaff\1\167\2\162\1"+
+        "\145\1\154\1\164\1\uffff\1\ufaff\1\uffff\1\166\1\145\1\153\2\ufaff"+
+        "\1\165\1\154\1\145\1\162\1\146\1\164\2\143\1\147\1\146\1\156\1\164"+
+        "\1\155\1\164\1\143\1\150\1\ufaff\1\162\1\ufaff\1\uffff\1\ufaff\1"+
+        "\uffff\1\ufaff\1\156\2\uffff\1\144\1\uffff\1\151\1\uffff\1\151\1"+
+        "\uffff\1\ufaff\1\164\1\141\3\ufaff\1\uffff\1\145\1\141\1\ufaff\2"+
+        "\uffff\1\154\1\145\1\ufaff\1\156\1\171\1\145\1\164\1\ufaff\1\145"+
+        "\1\141\1\143\1\ufaff\1\145\1\146\2\ufaff\1\uffff\1\157\3\uffff\1"+
+        "\165\1\163\1\154\1\145\1\ufaff\1\uffff\1\ufaff\1\143\1\uffff\1\171"+
+        "\2\uffff\1\ufaff\1\156\1\uffff\1\164\1\ufaff\1\uffff\3\ufaff\1\145"+
+        "\1\uffff\1\ufaff\1\143\1\145\1\uffff\1\156\1\160\2\uffff\1\156\1"+
+        "\145\1\ufaff\1\145\1\156\2\uffff\1\164\1\ufaff\1\uffff\2\ufaff\4"+
+        "\uffff\1\144\1\uffff\1\145\1\157\1\164\1\ufaff\1\151\1\ufaff\1\uffff"+
+        "\1\ufaff\1\164\1\ufaff\3\uffff\2\ufaff\1\146\1\163\1\uffff\1\172"+
+        "\2\uffff\1\ufaff\3\uffff\2\ufaff\1\145\3\uffff\1\144\1\ufaff\1\uffff";
+    static final String DFA30_acceptS =
+        "\2\uffff\1\2\6\uffff\1\12\1\13\1\14\1\uffff\1\16\1\17\1\uffff\1"+
+        "\22\1\23\10\uffff\1\50\1\52\1\53\1\60\1\63\12\uffff\1\130\2\uffff"+
+        "\1\140\1\141\1\143\1\144\13\uffff\1\54\1\5\1\137\1\105\1\6\7\uffff"+
+        "\1\114\1\107\1\15\3\uffff\1\117\1\25\22\uffff\1\103\1\126\1\122"+
+        "\1\104\1\127\1\123\1\106\1\146\1\145\1\124\1\110\1\113\1\115\1\111"+
+        "\1\116\1\112\1\125\1\120\1\131\1\134\1\135\6\uffff\1\64\47\uffff"+
+        "\1\70\3\uffff\1\136\5\uffff\1\44\24\uffff\1\71\10\uffff\1\66\1\uffff"+
+        "\1\133\30\uffff\1\41\1\uffff\1\102\2\uffff\1\65\1\142\1\uffff\1"+
+        "\21\1\uffff\1\56\1\uffff\1\132\6\uffff\1\55\3\uffff\1\42\1\45\20"+
+        "\uffff\1\43\1\uffff\1\51\1\101\1\7\5\uffff\1\75\2\uffff\1\57\1\uffff"+
+        "\1\32\1\46\2\uffff\1\76\2\uffff\1\67\4\uffff\1\26\3\uffff\1\3\2"+
+        "\uffff\1\4\1\73\5\uffff\1\24\1\62\2\uffff\1\33\2\uffff\1\47\1\74"+
+        "\1\100\1\30\1\uffff\1\1\6\uffff\1\10\3\uffff\1\72\1\40\1\61\4\uffff"+
+        "\1\37\1\uffff\1\77\1\36\1\uffff\1\31\1\27\1\20\3\uffff\1\35\1\121"+
+        "\1\11\2\uffff\1\34";
+    static final String DFA30_specialS =
+        "\u0168\uffff}>";
+    static final String[] DFA30_transitionS = {
+            "\2\57\1\uffff\2\57\22\uffff\1\57\1\50\1\55\1\uffff\1\56\1\47"+
+            "\1\14\1\54\1\33\1\34\1\6\1\42\1\12\1\43\1\5\1\44\1\52\11\53"+
+            "\1\36\1\2\1\11\1\23\1\13\1\32\1\35\32\56\1\20\1\uffff\1\21\1"+
+            "\46\1\56\1\uffff\1\24\1\27\1\7\1\31\1\10\1\25\2\56\1\3\2\56"+
+            "\1\30\1\41\1\26\1\56\1\1\1\56\1\40\1\4\1\22\1\56\1\17\1\37\3"+
+            "\56\1\15\1\45\1\16\1\51\101\uffff\27\56\1\uffff\37\56\1\uffff"+
+            "\u1f08\56\u1040\uffff\u0150\56\u0170\uffff\u0080\56\u0080\uffff"+
+            "\u092e\56\u10d2\uffff\u5200\56\u5900\uffff\u0200\56",
+            "\1\62\20\uffff\1\60\2\uffff\1\61",
+            "",
+            "\1\63\6\uffff\1\65\1\64",
+            "\1\70\13\uffff\1\66\1\72\1\uffff\1\67\1\uffff\1\71",
+            "\1\73\1\uffff\12\75",
+            "\1\76",
+            "\1\101\6\uffff\1\100\3\uffff\1\102\2\uffff\1\103",
+            "\1\104\1\uffff\1\105\11\uffff\1\106",
+            "",
+            "",
+            "",
+            "\1\107\26\uffff\1\110",
+            "",
+            "",
+            "\1\112",
+            "",
+            "",
+            "\1\114\11\uffff\1\113",
+            "\1\115",
+            "\1\120\20\uffff\1\117",
+            "\1\121\7\uffff\1\122\2\uffff\1\123\2\uffff\1\124",
+            "\1\127\3\uffff\1\126\17\uffff\1\125",
+            "\1\130\2\uffff\1\131\6\uffff\1\132",
+            "\1\133",
+            "\1\134\11\uffff\1\135",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\136",
+            "\1\137",
+            "\1\140",
+            "\1\142\21\uffff\1\141",
+            "\1\145\17\uffff\1\144",
+            "\1\151\4\uffff\1\150\15\uffff\1\147",
+            "\1\153\76\uffff\1\154",
+            "\1\156",
+            "\1\160",
+            "\1\162",
+            "",
+            "\1\75\1\uffff\10\166\2\75\12\uffff\3\75\21\uffff\1\164\13\uffff"+
+            "\3\75\21\uffff\1\164",
+            "\1\75\1\uffff\12\167\12\uffff\3\75\35\uffff\3\75",
+            "",
+            "",
+            "",
+            "",
+            "\1\170\5\uffff\1\171",
+            "\1\172",
+            "\1\173",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\176\1\175",
+            "\1\177",
+            "\1\u0081\20\uffff\1\u0080",
+            "\1\u0082",
+            "\1\u0083",
+            "\1\u0084",
+            "\1\u0085",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\u0086",
+            "\1\u0088\1\u0087",
+            "\1\u0089",
+            "\1\u008a",
+            "\1\u008b",
+            "\1\u008c",
+            "\1\u008d",
+            "",
+            "",
+            "",
+            "\1\u008e\2\uffff\1\u008f",
+            "\1\u0092\23\uffff\1\u0090\3\uffff\1\u0091",
+            "\1\u0093\10\uffff\1\u0094",
+            "",
+            "",
+            "\1\u0095",
+            "\1\u0096",
+            "\1\u0097",
+            "\1\u0098",
+            "\1\u0099",
+            "\1\u009a",
+            "\1\u009b",
+            "\1\u009c",
+            "\1\u009d",
+            "\1\u009e",
+            "\1\u009f",
+            "\1\u00a0",
+            "\1\u00a1",
+            "\1\u00a2",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\24\56"+
+            "\1\u00a3\5\56\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56"+
+            "\u1040\uffff\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e"+
+            "\56\u10d2\uffff\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00a5",
+            "\1\u00a6",
+            "\1\u00a7",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\75\1\uffff\10\166\2\75\12\uffff\3\75\35\uffff\3\75",
+            "\1\75\1\uffff\12\167\12\uffff\3\75\35\uffff\3\75",
+            "\1\u00a9",
+            "\1\u00aa",
+            "\1\u00ab",
+            "\1\u00ac",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\4\56"+
+            "\1\u00ad\25\56\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56"+
+            "\u1040\uffff\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e"+
+            "\56\u10d2\uffff\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00af",
+            "\1\u00b1\2\uffff\1\u00b0",
+            "\1\u00b2",
+            "\1\u00b3",
+            "\1\u00b4",
+            "\1\u00b5",
+            "\1\u00b6",
+            "\1\u00b7",
+            "\1\u00b8",
+            "\1\u00b9",
+            "\1\u00ba",
+            "\1\u00bb",
+            "\1\u00bc",
+            "\1\u00bd",
+            "\1\u00be",
+            "\1\u00bf",
+            "\1\u00c0",
+            "\1\u00c1",
+            "\1\u00c2",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00c4",
+            "\1\u00c5",
+            "\1\u00c6",
+            "\1\u00c7",
+            "\1\u00c8",
+            "\1\u00c9",
+            "\1\u00ca",
+            "\1\u00cb",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00cd",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00cf",
+            "\1\u00d0",
+            "\1\u00d1",
+            "\1\u00d2",
+            "\1\u00d3",
+            "\1\u00d4",
+            "\1\u00d5",
+            "",
+            "\1\u00d6",
+            "\1\u00d7",
+            "\1\u00d8",
+            "",
+            "\1\u00d9",
+            "\1\u00da",
+            "\1\u00db",
+            "\1\u00dc",
+            "\1\u00dd",
+            "",
+            "\1\u00de",
+            "\1\u00df",
+            "\1\u00e0",
+            "\1\u00e1",
+            "\1\u00e2",
+            "\1\u00e3",
+            "\1\u00e4",
+            "\1\u00e5",
+            "\1\u00e6",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00e8",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00ea",
+            "\1\u00eb",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00ee",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00f0",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\u00f2",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u00f4",
+            "\1\u00f5",
+            "\1\u00f6",
+            "\1\u00f7",
+            "\1\u00f8",
+            "\1\u00f9",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\u00fb",
+            "\1\u00fc",
+            "\1\u00fd",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0100",
+            "\1\u0101",
+            "\1\u0102",
+            "\1\u0103",
+            "\1\u0104",
+            "\1\u0105",
+            "\1\u0106",
+            "\1\u0107",
+            "\1\u0108",
+            "\1\u0109",
+            "\1\u010a",
+            "\1\u010b",
+            "\1\u010c",
+            "\1\u010d",
+            "\1\u010e",
+            "\1\u010f",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0111",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0115",
+            "",
+            "",
+            "\1\u0116",
+            "",
+            "\1\u0117",
+            "",
+            "\1\u0118",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\22\56"+
+            "\1\u0119\7\56\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56"+
+            "\u1040\uffff\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e"+
+            "\56\u10d2\uffff\u5200\56\u5900\uffff\u0200\56",
+            "\1\u011b",
+            "\1\u011c",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\13\56"+
+            "\1\u011e\16\56\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56"+
+            "\u1040\uffff\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e"+
+            "\56\u10d2\uffff\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\u0121",
+            "\1\u0122",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "",
+            "\1\u0124",
+            "\1\u0125",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0127",
+            "\1\u0128",
+            "\1\u0129",
+            "\1\u012a",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u012c",
+            "\1\u012d",
+            "\1\u012e",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0130",
+            "\1\u0131",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\u0134",
+            "",
+            "",
+            "",
+            "\1\u0135",
+            "\1\u0136",
+            "\1\u0137",
+            "\1\u0138",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u013b",
+            "",
+            "\1\u013c",
+            "",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u013e",
+            "",
+            "\1\u013f",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0144",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0146",
+            "\1\u0147",
+            "",
+            "\1\u0148",
+            "\1\u0149",
+            "",
+            "",
+            "\1\u014a",
+            "\1\u014b",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u014d",
+            "\1\u014e",
+            "",
+            "",
+            "\1\u014f",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "",
+            "",
+            "",
+            "\1\u0153",
+            "",
+            "\1\u0154",
+            "\1\u0155",
+            "\1\u0156",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0158",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u015b",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u015f",
+            "\1\u0160",
+            "",
+            "\1\u0161",
+            "",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "",
+            "",
+            "",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            "\1\u0165",
+            "",
+            "",
+            "",
+            "\1\u0166",
+            "\1\56\13\uffff\12\56\7\uffff\32\56\4\uffff\1\56\1\uffff\32\56"+
+            "\105\uffff\27\56\1\uffff\37\56\1\uffff\u1f08\56\u1040\uffff"+
+            "\u0150\56\u0170\uffff\u0080\56\u0080\uffff\u092e\56\u10d2\uffff"+
+            "\u5200\56\u5900\uffff\u0200\56",
+            ""
+    };
+
+    static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
+    static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
+    static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
+    static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
+    static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
+    static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
+    static final short[][] DFA30_transition;
+
+    static {
+        int numStates = DFA30_transitionS.length;
+        DFA30_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
+        }
+    }
+
+    class DFA30 extends DFA {
+
+        public DFA30(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 30;
+            this.eot = DFA30_eot;
+            this.eof = DFA30_eof;
+            this.min = DFA30_min;
+            this.max = DFA30_max;
+            this.accept = DFA30_accept;
+            this.special = DFA30_special;
+            this.transition = DFA30_transition;
+        }
+        public String getDescription() {
+            return "1:1: Tokens : ( T24 | T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | HexLiteral | DecimalLiteral | OctalLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | ENUM | Identifier | WS | COMMENT | LINE_COMMENT );";
+        }
+    }
+ 
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLocalDeclarationDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLocalDeclarationDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaLocalDeclarationDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 18, 2007
+ */
+package org.drools.rule.builder.dialect.java.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * A descriptor class for a local variable declaration in a java code block
+ * 
+ * @author etirelli
+ */
+public class JavaLocalDeclarationDescr {
+    private int start;
+    private int end;
+    private String type;
+    private List modifiers;
+    private List identifiers;
+    
+    public JavaLocalDeclarationDescr() {
+        this( -1, -1, "" );
+    }
+
+    public JavaLocalDeclarationDescr( int start, int end, String type ) {
+        this.start = start;
+        this.end = end;
+        this.type = type;
+        this.modifiers = new LinkedList();
+        this.identifiers = new LinkedList();
+    }
+
+    public int getEnd() {
+        return end;
+    }
+
+    public void setEnd(int finalOffset) {
+        this.end = finalOffset;
+    }
+
+    public List getIdentifiers() {
+        return identifiers;
+    }
+
+    public void setIdentifiers(List identifiers) {
+        this.identifiers = identifiers;
+    }
+    
+    public void addIdentifier(IdentifierDescr identifier) {
+        this.identifiers.add( identifier );
+    }
+    public void addIdentifier(String identifier, int start, int end) {
+        this.identifiers.add( new IdentifierDescr( identifier, start, end ) );
+    }
+
+    public List getModifiers() {
+        return modifiers;
+    }
+
+    public void setModifiers(List modifiers) {
+        this.modifiers = modifiers;
+    }
+    
+    public void addModifier(String modifier) {
+        this.modifiers.add( modifier );
+    }
+
+    public int getStart() {
+        return start;
+    }
+
+    public void setStart(int startingOffset) {
+        this.start = startingOffset;
+    }
+    
+    public void updateStart( int start ) {
+        if( this.start == -1 ) {
+            this.setStart( start );
+        }
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+    
+    public static class IdentifierDescr {
+        private String identifier;
+        private int start;
+        private int end;
+        
+        public IdentifierDescr() {
+            this( "", -1, -1 );
+        }
+        public IdentifierDescr( String identifier, int start, int end ) {
+            this.identifier = identifier;
+            this.start = start;
+            this.end = end;
+        }
+        public int getEnd() {
+            return end;
+        }
+        public void setEnd(int end) {
+            this.end = end;
+        }
+        public String getIdentifier() {
+            return identifier;
+        }
+        public void setIdentifier(String identifier) {
+            this.identifier = identifier;
+        }
+        public int getStart() {
+            return start;
+        }
+        public void setStart(int start) {
+            this.start = start;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaModifyBlockDescr.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaModifyBlockDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaModifyBlockDescr.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,55 @@
+/**
+ * 
+ */
+package org.drools.rule.builder.dialect.java.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A helper class used during java code parsing to identify
+ * and handle modify(){} blocks
+ * 
+ * @author etirelli
+ */
+public class JavaModifyBlockDescr {
+    private int start;
+    private int end;
+    private String modifyExpression;
+    private List expressions;
+    
+    public JavaModifyBlockDescr( String modifyExpression ) {
+        this.modifyExpression = modifyExpression;
+        this.expressions = new ArrayList();
+    }
+    
+    public int getStart() {
+        return start;
+    }
+    public void setStart(int start) {
+        this.start = start;
+    }
+    public int getEnd() {
+        return end;
+    }
+    public void setEnd(int end) {
+        this.end = end;
+    }
+    public String getModifyExpression() {
+        return modifyExpression;
+    }
+    public void setModifyExpression(String modifyExpression) {
+        this.modifyExpression = modifyExpression;
+    }
+    public List getExpressions() {
+        return expressions;
+    }
+    public void setExpressions(List expressions) {
+        this.expressions = expressions;
+    }
+    
+    public String toString() {
+        return "ModifyBlock( start="+start+" end="+end+" expression="+modifyExpression+" )";
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaParser.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaParser.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/java/parser/JavaParser.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15527 @@
+// $ANTLR 3.0.1 /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g 2007-12-19 16:46:01
+
+	package org.drools.rule.builder.dialect.java.parser;
+	import java.util.Iterator;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+/** A Java 1.5 grammar for ANTLR v3 derived from the spec
+ *
+ *  This is a very close representation of the spec; the changes
+ *  are comestic (remove left recursion) and also fixes (the spec
+ *  isn't exactly perfect).  I have run this on the 1.4.2 source
+ *  and some nasty looking enums from 1.5, but have not really
+ *  tested for 1.5 compatibility.
+ *
+ *  I built this with: java -Xmx100M org.antlr.Tool java.g 
+ *  and got two errors that are ok (for now):
+ *  java.g:691:9: Decision can match input such as
+ *    "'0'..'9'{'E', 'e'}{'+', '-'}'0'..'9'{'D', 'F', 'd', 'f'}"
+ *    using multiple alternatives: 3, 4
+ *  As a result, alternative(s) 4 were disabled for that input
+ *  java.g:734:35: Decision can match input such as "{'$', 'A'..'Z',
+ *    '_', 'a'..'z', '\u00C0'..'\u00D6', '\u00D8'..'\u00F6',
+ *    '\u00F8'..'\u1FFF', '\u3040'..'\u318F', '\u3300'..'\u337F',
+ *    '\u3400'..'\u3D2D', '\u4E00'..'\u9FFF', '\uF900'..'\uFAFF'}"
+ *    using multiple alternatives: 1, 2
+ *  As a result, alternative(s) 2 were disabled for that input
+ *
+ *  You can turn enum on/off as a keyword :)
+ *
+ *  Version 1.0 -- initial release July 5, 2006 (requires 3.0b2 or higher)
+ *
+ *  Primary author: Terence Parr, July 2006
+ *
+ *  Version 1.0.1 -- corrections by Koen Vanderkimpen & Marko van Dooren,
+ *      October 25, 2006;
+ *      fixed normalInterfaceDeclaration: now uses typeParameters instead
+ *          of typeParameter (according to JLS, 3rd edition)
+ *      fixed castExpression: no longer allows expression next to type
+ *          (according to semantics in JLS, in contrast with syntax in JLS)
+ *
+ *  Version 1.0.2 -- Terence Parr, Nov 27, 2006
+ *      java spec I built this from had some bizarre for-loop control.
+ *          Looked weird and so I looked elsewhere...Yep, it's messed up.
+ *          simplified.
+ *
+ *  Version 1.0.3 -- Chris Hogue, Feb 26, 2007
+ *      Factored out an annotationName rule and used it in the annotation rule.
+ *          Not sure why, but typeName wasn't recognizing references to inner
+ *          annotations (e.g. @InterfaceName.InnerAnnotation())
+ *      Factored out the elementValue section of an annotation reference.  Created 
+ *          elementValuePair and elementValuePairs rules, then used them in the 
+ *          annotation rule.  Allows it to recognize annotation references with 
+ *          multiple, comma separated attributes.
+ *      Updated elementValueArrayInitializer so that it allows multiple elements.
+ *          (It was only allowing 0 or 1 element).
+ *      Updated localVariableDeclaration to allow annotations.  Interestingly the JLS
+ *          doesn't appear to indicate this is legal, but it does work as of at least
+ *          JDK 1.5.0_06.
+ *      Moved the Identifier portion of annotationTypeElementRest to annotationMethodRest.
+ *          Because annotationConstantRest already references variableDeclarator which 
+ *          has the Identifier portion in it, the parser would fail on constants in 
+ *          annotation definitions because it expected two identifiers.  
+ *      Added optional trailing ';' to the alternatives in annotationTypeElementRest.
+ *          Wouldn't handle an inner interface that has a trailing ';'.
+ *      Swapped the expression and type rule reference order in castExpression to 
+ *          make it check for genericized casts first.  It was failing to recognize a
+ *          statement like  "Class<Byte> TYPE = (Class<Byte>)...;" because it was seeing
+ *          'Class<Byte' in the cast expression as a less than expression, then failing 
+ *          on the '>'.
+ *      Changed createdName to use typeArguments instead of nonWildcardTypeArguments.
+ *          Again, JLS doesn't seem to allow this, but java.lang.Class has an example of
+ *          of this construct.
+ *      Changed the 'this' alternative in primary to allow 'identifierSuffix' rather than
+ *          just 'arguments'.  The case it couldn't handle was a call to an explicit
+ *          generic method invocation (e.g. this.<E>doSomething()).  Using identifierSuffix
+ *          may be overly aggressive--perhaps should create a more constrained thisSuffix rule?
+ * 		
+ *  Version 1.0.4 -- Hiroaki Nakamura, May 3, 2007
+ *
+ *	Fixed formalParameterDecls, localVariableDeclaration, forInit,
+ *	and forVarControl to use variableModifier* not 'final'? (annotation)?
+ */
+public class JavaParser extends Parser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "Identifier", "ENUM", "FloatingPointLiteral", "CharacterLiteral", "StringLiteral", "HexLiteral", "OctalLiteral", "DecimalLiteral", "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "EscapeSequence", "UnicodeEscape", "OctalEscape", "Letter", "JavaIDDigit", "WS", "COMMENT", "LINE_COMMENT", "'package'", "';'", "'import'", "'static'", "'.'", "'*'", "'class'", "'extends'", "'implements'", "'<'", "','", "'>'", "'&'", "'{'", "'}'", "'interface'", "'void'", "'['", "']'", "'throws'", "'='", "'public'", "'protected'", "'private'", "'abstract'", "'final'", "'native'", "'synchronized'", "'transient'", "'volatile'", "'strictfp'", "'boolean'", "'char'", "'byte'", "'short'", "'int'", "'long'", "'float'", "'double'", "'?'", "'super'", "'('", "')'", "'...'", "'null'", "'true'", "'false'", "'@'", "'default'", "'assert'", "':'", "'if'", "'else'", "'for'", "'while'", "'do'", "'try'", "'finally'", "'switch'", "'return'", "'throw'", "!
 'break'", "'continue'", "'modify'", "'catch'", "'case'", "'+='", "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'%='", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'instanceof'", "'+'", "'-'", "'/'", "'%'", "'++'", "'--'", "'~'", "'!'", "'this'", "'new'"
+    };
+    public static final int Exponent=14;
+    public static final int OctalLiteral=10;
+    public static final int IntegerTypeSuffix=13;
+    public static final int Identifier=4;
+    public static final int HexDigit=12;
+    public static final int WS=21;
+    public static final int CharacterLiteral=7;
+    public static final int COMMENT=22;
+    public static final int StringLiteral=8;
+    public static final int LINE_COMMENT=23;
+    public static final int JavaIDDigit=20;
+    public static final int Letter=19;
+    public static final int UnicodeEscape=17;
+    public static final int HexLiteral=9;
+    public static final int EscapeSequence=16;
+    public static final int EOF=-1;
+    public static final int DecimalLiteral=11;
+    public static final int OctalEscape=18;
+    public static final int FloatingPointLiteral=6;
+    public static final int FloatTypeSuffix=15;
+    public static final int ENUM=5;
+
+        public JavaParser(TokenStream input) {
+            super(input);
+            ruleMemo = new HashMap[407+1];
+         }
+        
+
+    public String[] getTokenNames() { return tokenNames; }
+    public String getGrammarFileName() { return "/home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g"; }
+
+
+    	private List identifiers = new ArrayList();
+    	public List getIdentifiers() { return identifiers; }
+    	private List localDeclarations = new ArrayList();
+    	public List getLocalDeclarations() { return localDeclarations; }
+    	public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
+    	private List errors = new ArrayList();
+    	private int localVariableLevel = 0;
+    	private List modifyBlocks = new ArrayList();
+    	public List getModifyBlocks() { return modifyBlocks; }
+    	
+    	private String source = "unknown";
+    	
+    	public void setSource(String source) {
+    		this.source = source;
+    	}
+    	
+    	public String getSource() {
+    		return this.source;
+    	}
+    		
+    	public void reportError(RecognitionException ex) {
+    	        // if we've already reported an error and have not matched a token
+                    // yet successfully, don't report any errors.
+                    if ( errorRecovery ) {
+                            //System.err.print("[SPURIOUS] ");
+                            return;
+                    }
+                    errorRecovery = true;
+
+    		errors.add( ex ); 
+    	}
+         	
+         	/** return the raw RecognitionException errors */
+         	public List getErrors() {
+         		return errors;
+         	}
+         	
+         	/** Return a list of pretty strings summarising the errors */
+         	public List getErrorMessages() {
+         		List messages = new ArrayList();
+     		for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+         	     		messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+         	     	}
+         	     	return messages;
+         	}
+         	
+         	/** return true if any parser errors were accumulated */
+         	public boolean hasErrors() {
+      		return ! errors.isEmpty();
+         	}
+         	
+         	/** This will take a RecognitionException, and create a sensible error message out of it */
+         	public String createErrorMessage(RecognitionException e)
+            {
+    		StringBuffer message = new StringBuffer();		
+                    message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+                    if ( e instanceof MismatchedTokenException ) {
+                            MismatchedTokenException mte = (MismatchedTokenException)e;
+                            message.append("mismatched token: "+
+                                                               e.token+
+                                                               "; expecting type "+
+                                                               tokenNames[mte.expecting]);
+                    }
+                    else if ( e instanceof MismatchedTreeNodeException ) {
+                            MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+                            message.append("mismatched tree node: "+
+                                                               mtne.node+
+                                                               "; expecting type "+
+                                                               tokenNames[mtne.expecting]);
+                    }
+                    else if ( e instanceof NoViableAltException ) {
+                            NoViableAltException nvae = (NoViableAltException)e;
+    			message.append( "Unexpected token '" + e.token.getText() + "'" );
+                            /*
+                            message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+                                                               " state "+nvae.stateNumber+
+                                                               " (decision="+nvae.decisionNumber+
+                                                               ") no viable alt; token="+
+                                                               e.token);
+                                                               */
+                    }
+                    else if ( e instanceof EarlyExitException ) {
+                            EarlyExitException eee = (EarlyExitException)e;
+                            message.append("required (...)+ loop (decision="+
+                                                               eee.decisionNumber+
+                                                               ") did not match anything; token="+
+                                                               e.token);
+                    }
+                    else if ( e instanceof MismatchedSetException ) {
+                            MismatchedSetException mse = (MismatchedSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof MismatchedNotSetException ) {
+                            MismatchedNotSetException mse = (MismatchedNotSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof FailedPredicateException ) {
+                            FailedPredicateException fpe = (FailedPredicateException)e;
+                            message.append("rule "+fpe.ruleName+" failed predicate: {"+
+                                                               fpe.predicateText+"}?");
+    		}
+                   	return message.toString();
+            }   
+
+
+
+    // $ANTLR start compilationUnit
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:206:1: compilationUnit : ( annotations )? ( packageDeclaration )? ( importDeclaration )* ( typeDeclaration )* ;
+    public final void compilationUnit() throws RecognitionException {
+        int compilationUnit_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 1) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:207:2: ( ( annotations )? ( packageDeclaration )? ( importDeclaration )* ( typeDeclaration )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:207:4: ( annotations )? ( packageDeclaration )? ( importDeclaration )* ( typeDeclaration )*
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:207:4: ( annotations )?
+            int alt1=2;
+            int LA1_0 = input.LA(1);
+
+            if ( (LA1_0==71) ) {
+                int LA1_1 = input.LA(2);
+
+                if ( (LA1_1==Identifier) ) {
+                    int LA1_21 = input.LA(3);
+
+                    if ( (synpred1()) ) {
+                        alt1=1;
+                    }
+                }
+            }
+            switch (alt1) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: annotations
+                    {
+                    pushFollow(FOLLOW_annotations_in_compilationUnit70);
+                    annotations();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:208:3: ( packageDeclaration )?
+            int alt2=2;
+            int LA2_0 = input.LA(1);
+
+            if ( (LA2_0==24) ) {
+                alt2=1;
+            }
+            switch (alt2) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: packageDeclaration
+                    {
+                    pushFollow(FOLLOW_packageDeclaration_in_compilationUnit75);
+                    packageDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:209:9: ( importDeclaration )*
+            loop3:
+            do {
+                int alt3=2;
+                int LA3_0 = input.LA(1);
+
+                if ( (LA3_0==26) ) {
+                    alt3=1;
+                }
+
+
+                switch (alt3) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: importDeclaration
+            	    {
+            	    pushFollow(FOLLOW_importDeclaration_in_compilationUnit86);
+            	    importDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop3;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:210:9: ( typeDeclaration )*
+            loop4:
+            do {
+                int alt4=2;
+                int LA4_0 = input.LA(1);
+
+                if ( (LA4_0==ENUM||LA4_0==25||LA4_0==27||LA4_0==30||LA4_0==39||(LA4_0>=45 && LA4_0<=54)||LA4_0==71) ) {
+                    alt4=1;
+                }
+
+
+                switch (alt4) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: typeDeclaration
+            	    {
+            	    pushFollow(FOLLOW_typeDeclaration_in_compilationUnit97);
+            	    typeDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop4;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 1, compilationUnit_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end compilationUnit
+
+
+    // $ANTLR start packageDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:213:1: packageDeclaration : 'package' qualifiedName ';' ;
+    public final void packageDeclaration() throws RecognitionException {
+        int packageDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 2) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:214:2: ( 'package' qualifiedName ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:214:4: 'package' qualifiedName ';'
+            {
+            match(input,24,FOLLOW_24_in_packageDeclaration109); if (failed) return ;
+            pushFollow(FOLLOW_qualifiedName_in_packageDeclaration111);
+            qualifiedName();
+            _fsp--;
+            if (failed) return ;
+            match(input,25,FOLLOW_25_in_packageDeclaration113); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 2, packageDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end packageDeclaration
+
+
+    // $ANTLR start importDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:217:1: importDeclaration : 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' ;
+    public final void importDeclaration() throws RecognitionException {
+        int importDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 3) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:2: ( 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:4: 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';'
+            {
+            match(input,26,FOLLOW_26_in_importDeclaration125); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:13: ( 'static' )?
+            int alt5=2;
+            int LA5_0 = input.LA(1);
+
+            if ( (LA5_0==27) ) {
+                alt5=1;
+            }
+            switch (alt5) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: 'static'
+                    {
+                    match(input,27,FOLLOW_27_in_importDeclaration127); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,Identifier,FOLLOW_Identifier_in_importDeclaration130); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:34: ( '.' Identifier )*
+            loop6:
+            do {
+                int alt6=2;
+                int LA6_0 = input.LA(1);
+
+                if ( (LA6_0==28) ) {
+                    int LA6_1 = input.LA(2);
+
+                    if ( (LA6_1==Identifier) ) {
+                        alt6=1;
+                    }
+
+
+                }
+
+
+                switch (alt6) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:35: '.' Identifier
+            	    {
+            	    match(input,28,FOLLOW_28_in_importDeclaration133); if (failed) return ;
+            	    match(input,Identifier,FOLLOW_Identifier_in_importDeclaration135); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop6;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:52: ( '.' '*' )?
+            int alt7=2;
+            int LA7_0 = input.LA(1);
+
+            if ( (LA7_0==28) ) {
+                alt7=1;
+            }
+            switch (alt7) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:218:53: '.' '*'
+                    {
+                    match(input,28,FOLLOW_28_in_importDeclaration140); if (failed) return ;
+                    match(input,29,FOLLOW_29_in_importDeclaration142); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,25,FOLLOW_25_in_importDeclaration146); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 3, importDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end importDeclaration
+
+
+    // $ANTLR start typeDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:221:1: typeDeclaration : ( classOrInterfaceDeclaration | ';' );
+    public final void typeDeclaration() throws RecognitionException {
+        int typeDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 4) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:222:2: ( classOrInterfaceDeclaration | ';' )
+            int alt8=2;
+            int LA8_0 = input.LA(1);
+
+            if ( (LA8_0==ENUM||LA8_0==27||LA8_0==30||LA8_0==39||(LA8_0>=45 && LA8_0<=54)||LA8_0==71) ) {
+                alt8=1;
+            }
+            else if ( (LA8_0==25) ) {
+                alt8=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("221:1: typeDeclaration : ( classOrInterfaceDeclaration | ';' );", 8, 0, input);
+
+                throw nvae;
+            }
+            switch (alt8) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:222:4: classOrInterfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_classOrInterfaceDeclaration_in_typeDeclaration158);
+                    classOrInterfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:223:9: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_typeDeclaration168); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 4, typeDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeDeclaration
+
+
+    // $ANTLR start classOrInterfaceDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:226:1: classOrInterfaceDeclaration : ( modifier )* ( classDeclaration | interfaceDeclaration ) ;
+    public final void classOrInterfaceDeclaration() throws RecognitionException {
+        int classOrInterfaceDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 5) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:2: ( ( modifier )* ( classDeclaration | interfaceDeclaration ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:4: ( modifier )* ( classDeclaration | interfaceDeclaration )
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:4: ( modifier )*
+            loop9:
+            do {
+                int alt9=2;
+                int LA9_0 = input.LA(1);
+
+                if ( (LA9_0==71) ) {
+                    int LA9_4 = input.LA(2);
+
+                    if ( (LA9_4==Identifier) ) {
+                        alt9=1;
+                    }
+
+
+                }
+                else if ( (LA9_0==27||(LA9_0>=45 && LA9_0<=54)) ) {
+                    alt9=1;
+                }
+
+
+                switch (alt9) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: modifier
+            	    {
+            	    pushFollow(FOLLOW_modifier_in_classOrInterfaceDeclaration180);
+            	    modifier();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop9;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:14: ( classDeclaration | interfaceDeclaration )
+            int alt10=2;
+            int LA10_0 = input.LA(1);
+
+            if ( (LA10_0==ENUM||LA10_0==30) ) {
+                alt10=1;
+            }
+            else if ( (LA10_0==39||LA10_0==71) ) {
+                alt10=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("227:14: ( classDeclaration | interfaceDeclaration )", 10, 0, input);
+
+                throw nvae;
+            }
+            switch (alt10) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:15: classDeclaration
+                    {
+                    pushFollow(FOLLOW_classDeclaration_in_classOrInterfaceDeclaration184);
+                    classDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:227:34: interfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_interfaceDeclaration_in_classOrInterfaceDeclaration188);
+                    interfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 5, classOrInterfaceDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end classOrInterfaceDeclaration
+
+
+    // $ANTLR start classDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:230:1: classDeclaration : ( normalClassDeclaration | enumDeclaration );
+    public final void classDeclaration() throws RecognitionException {
+        int classDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 6) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:231:2: ( normalClassDeclaration | enumDeclaration )
+            int alt11=2;
+            int LA11_0 = input.LA(1);
+
+            if ( (LA11_0==30) ) {
+                alt11=1;
+            }
+            else if ( (LA11_0==ENUM) ) {
+                alt11=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("230:1: classDeclaration : ( normalClassDeclaration | enumDeclaration );", 11, 0, input);
+
+                throw nvae;
+            }
+            switch (alt11) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:231:4: normalClassDeclaration
+                    {
+                    pushFollow(FOLLOW_normalClassDeclaration_in_classDeclaration201);
+                    normalClassDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:232:9: enumDeclaration
+                    {
+                    pushFollow(FOLLOW_enumDeclaration_in_classDeclaration211);
+                    enumDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 6, classDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end classDeclaration
+
+
+    // $ANTLR start normalClassDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:235:1: normalClassDeclaration : 'class' Identifier ( typeParameters )? ( 'extends' type )? ( 'implements' typeList )? classBody ;
+    public final void normalClassDeclaration() throws RecognitionException {
+        int normalClassDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 7) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:236:2: ( 'class' Identifier ( typeParameters )? ( 'extends' type )? ( 'implements' typeList )? classBody )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:236:4: 'class' Identifier ( typeParameters )? ( 'extends' type )? ( 'implements' typeList )? classBody
+            {
+            match(input,30,FOLLOW_30_in_normalClassDeclaration223); if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_normalClassDeclaration225); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:236:23: ( typeParameters )?
+            int alt12=2;
+            int LA12_0 = input.LA(1);
+
+            if ( (LA12_0==33) ) {
+                alt12=1;
+            }
+            switch (alt12) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:236:24: typeParameters
+                    {
+                    pushFollow(FOLLOW_typeParameters_in_normalClassDeclaration228);
+                    typeParameters();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:237:9: ( 'extends' type )?
+            int alt13=2;
+            int LA13_0 = input.LA(1);
+
+            if ( (LA13_0==31) ) {
+                alt13=1;
+            }
+            switch (alt13) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:237:10: 'extends' type
+                    {
+                    match(input,31,FOLLOW_31_in_normalClassDeclaration241); if (failed) return ;
+                    pushFollow(FOLLOW_type_in_normalClassDeclaration243);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:238:9: ( 'implements' typeList )?
+            int alt14=2;
+            int LA14_0 = input.LA(1);
+
+            if ( (LA14_0==32) ) {
+                alt14=1;
+            }
+            switch (alt14) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:238:10: 'implements' typeList
+                    {
+                    match(input,32,FOLLOW_32_in_normalClassDeclaration256); if (failed) return ;
+                    pushFollow(FOLLOW_typeList_in_normalClassDeclaration258);
+                    typeList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_classBody_in_normalClassDeclaration270);
+            classBody();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 7, normalClassDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end normalClassDeclaration
+
+
+    // $ANTLR start typeParameters
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:242:1: typeParameters : '<' typeParameter ( ',' typeParameter )* '>' ;
+    public final void typeParameters() throws RecognitionException {
+        int typeParameters_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 8) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:243:2: ( '<' typeParameter ( ',' typeParameter )* '>' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:243:4: '<' typeParameter ( ',' typeParameter )* '>'
+            {
+            match(input,33,FOLLOW_33_in_typeParameters282); if (failed) return ;
+            pushFollow(FOLLOW_typeParameter_in_typeParameters284);
+            typeParameter();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:243:22: ( ',' typeParameter )*
+            loop15:
+            do {
+                int alt15=2;
+                int LA15_0 = input.LA(1);
+
+                if ( (LA15_0==34) ) {
+                    alt15=1;
+                }
+
+
+                switch (alt15) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:243:23: ',' typeParameter
+            	    {
+            	    match(input,34,FOLLOW_34_in_typeParameters287); if (failed) return ;
+            	    pushFollow(FOLLOW_typeParameter_in_typeParameters289);
+            	    typeParameter();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop15;
+                }
+            } while (true);
+
+            match(input,35,FOLLOW_35_in_typeParameters293); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 8, typeParameters_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeParameters
+
+
+    // $ANTLR start typeParameter
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:246:1: typeParameter : Identifier ( 'extends' bound )? ;
+    public final void typeParameter() throws RecognitionException {
+        int typeParameter_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 9) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:247:2: ( Identifier ( 'extends' bound )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:247:4: Identifier ( 'extends' bound )?
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_typeParameter304); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:247:15: ( 'extends' bound )?
+            int alt16=2;
+            int LA16_0 = input.LA(1);
+
+            if ( (LA16_0==31) ) {
+                alt16=1;
+            }
+            switch (alt16) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:247:16: 'extends' bound
+                    {
+                    match(input,31,FOLLOW_31_in_typeParameter307); if (failed) return ;
+                    pushFollow(FOLLOW_bound_in_typeParameter309);
+                    bound();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 9, typeParameter_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeParameter
+
+
+    // $ANTLR start bound
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:250:1: bound : type ( '&' type )* ;
+    public final void bound() throws RecognitionException {
+        int bound_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 10) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:251:2: ( type ( '&' type )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:251:4: type ( '&' type )*
+            {
+            pushFollow(FOLLOW_type_in_bound324);
+            type();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:251:9: ( '&' type )*
+            loop17:
+            do {
+                int alt17=2;
+                int LA17_0 = input.LA(1);
+
+                if ( (LA17_0==36) ) {
+                    alt17=1;
+                }
+
+
+                switch (alt17) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:251:10: '&' type
+            	    {
+            	    match(input,36,FOLLOW_36_in_bound327); if (failed) return ;
+            	    pushFollow(FOLLOW_type_in_bound329);
+            	    type();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop17;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 10, bound_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end bound
+
+
+    // $ANTLR start enumDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:254:1: enumDeclaration : ENUM Identifier ( 'implements' typeList )? enumBody ;
+    public final void enumDeclaration() throws RecognitionException {
+        int enumDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 11) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:255:2: ( ENUM Identifier ( 'implements' typeList )? enumBody )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:255:4: ENUM Identifier ( 'implements' typeList )? enumBody
+            {
+            match(input,ENUM,FOLLOW_ENUM_in_enumDeclaration342); if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_enumDeclaration344); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:255:20: ( 'implements' typeList )?
+            int alt18=2;
+            int LA18_0 = input.LA(1);
+
+            if ( (LA18_0==32) ) {
+                alt18=1;
+            }
+            switch (alt18) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:255:21: 'implements' typeList
+                    {
+                    match(input,32,FOLLOW_32_in_enumDeclaration347); if (failed) return ;
+                    pushFollow(FOLLOW_typeList_in_enumDeclaration349);
+                    typeList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_enumBody_in_enumDeclaration353);
+            enumBody();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 11, enumDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumDeclaration
+
+
+    // $ANTLR start enumBody
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:258:1: enumBody : '{' ( enumConstants )? ( ',' )? ( enumBodyDeclarations )? '}' ;
+    public final void enumBody() throws RecognitionException {
+        int enumBody_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 12) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:259:2: ( '{' ( enumConstants )? ( ',' )? ( enumBodyDeclarations )? '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:259:4: '{' ( enumConstants )? ( ',' )? ( enumBodyDeclarations )? '}'
+            {
+            match(input,37,FOLLOW_37_in_enumBody365); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:259:8: ( enumConstants )?
+            int alt19=2;
+            int LA19_0 = input.LA(1);
+
+            if ( (LA19_0==Identifier||LA19_0==71) ) {
+                alt19=1;
+            }
+            switch (alt19) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: enumConstants
+                    {
+                    pushFollow(FOLLOW_enumConstants_in_enumBody367);
+                    enumConstants();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:259:23: ( ',' )?
+            int alt20=2;
+            int LA20_0 = input.LA(1);
+
+            if ( (LA20_0==34) ) {
+                alt20=1;
+            }
+            switch (alt20) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ','
+                    {
+                    match(input,34,FOLLOW_34_in_enumBody370); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:259:28: ( enumBodyDeclarations )?
+            int alt21=2;
+            int LA21_0 = input.LA(1);
+
+            if ( (LA21_0==25) ) {
+                alt21=1;
+            }
+            switch (alt21) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: enumBodyDeclarations
+                    {
+                    pushFollow(FOLLOW_enumBodyDeclarations_in_enumBody373);
+                    enumBodyDeclarations();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,38,FOLLOW_38_in_enumBody376); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 12, enumBody_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumBody
+
+
+    // $ANTLR start enumConstants
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:262:1: enumConstants : enumConstant ( ',' enumConstant )* ;
+    public final void enumConstants() throws RecognitionException {
+        int enumConstants_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 13) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:263:2: ( enumConstant ( ',' enumConstant )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:263:4: enumConstant ( ',' enumConstant )*
+            {
+            pushFollow(FOLLOW_enumConstant_in_enumConstants387);
+            enumConstant();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:263:17: ( ',' enumConstant )*
+            loop22:
+            do {
+                int alt22=2;
+                int LA22_0 = input.LA(1);
+
+                if ( (LA22_0==34) ) {
+                    int LA22_1 = input.LA(2);
+
+                    if ( (LA22_1==Identifier||LA22_1==71) ) {
+                        alt22=1;
+                    }
+
+
+                }
+
+
+                switch (alt22) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:263:18: ',' enumConstant
+            	    {
+            	    match(input,34,FOLLOW_34_in_enumConstants390); if (failed) return ;
+            	    pushFollow(FOLLOW_enumConstant_in_enumConstants392);
+            	    enumConstant();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop22;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 13, enumConstants_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumConstants
+
+
+    // $ANTLR start enumConstant
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:266:1: enumConstant : ( annotations )? Identifier ( arguments )? ( classBody )? ;
+    public final void enumConstant() throws RecognitionException {
+        int enumConstant_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 14) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:2: ( ( annotations )? Identifier ( arguments )? ( classBody )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:4: ( annotations )? Identifier ( arguments )? ( classBody )?
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:4: ( annotations )?
+            int alt23=2;
+            int LA23_0 = input.LA(1);
+
+            if ( (LA23_0==71) ) {
+                alt23=1;
+            }
+            switch (alt23) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: annotations
+                    {
+                    pushFollow(FOLLOW_annotations_in_enumConstant406);
+                    annotations();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,Identifier,FOLLOW_Identifier_in_enumConstant409); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:28: ( arguments )?
+            int alt24=2;
+            int LA24_0 = input.LA(1);
+
+            if ( (LA24_0==65) ) {
+                alt24=1;
+            }
+            switch (alt24) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:29: arguments
+                    {
+                    pushFollow(FOLLOW_arguments_in_enumConstant412);
+                    arguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:41: ( classBody )?
+            int alt25=2;
+            int LA25_0 = input.LA(1);
+
+            if ( (LA25_0==37) ) {
+                alt25=1;
+            }
+            switch (alt25) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:267:42: classBody
+                    {
+                    pushFollow(FOLLOW_classBody_in_enumConstant417);
+                    classBody();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 14, enumConstant_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumConstant
+
+
+    // $ANTLR start enumBodyDeclarations
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:270:1: enumBodyDeclarations : ';' ( classBodyDeclaration )* ;
+    public final void enumBodyDeclarations() throws RecognitionException {
+        int enumBodyDeclarations_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 15) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:271:2: ( ';' ( classBodyDeclaration )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:271:4: ';' ( classBodyDeclaration )*
+            {
+            match(input,25,FOLLOW_25_in_enumBodyDeclarations431); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:271:8: ( classBodyDeclaration )*
+            loop26:
+            do {
+                int alt26=2;
+                int LA26_0 = input.LA(1);
+
+                if ( ((LA26_0>=Identifier && LA26_0<=ENUM)||LA26_0==25||LA26_0==27||LA26_0==30||LA26_0==33||LA26_0==37||(LA26_0>=39 && LA26_0<=40)||(LA26_0>=45 && LA26_0<=62)||LA26_0==71) ) {
+                    alt26=1;
+                }
+
+
+                switch (alt26) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:271:9: classBodyDeclaration
+            	    {
+            	    pushFollow(FOLLOW_classBodyDeclaration_in_enumBodyDeclarations434);
+            	    classBodyDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop26;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 15, enumBodyDeclarations_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumBodyDeclarations
+
+
+    // $ANTLR start interfaceDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:274:1: interfaceDeclaration : ( normalInterfaceDeclaration | annotationTypeDeclaration );
+    public final void interfaceDeclaration() throws RecognitionException {
+        int interfaceDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 16) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:275:2: ( normalInterfaceDeclaration | annotationTypeDeclaration )
+            int alt27=2;
+            int LA27_0 = input.LA(1);
+
+            if ( (LA27_0==39) ) {
+                alt27=1;
+            }
+            else if ( (LA27_0==71) ) {
+                alt27=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("274:1: interfaceDeclaration : ( normalInterfaceDeclaration | annotationTypeDeclaration );", 27, 0, input);
+
+                throw nvae;
+            }
+            switch (alt27) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:275:4: normalInterfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_normalInterfaceDeclaration_in_interfaceDeclaration448);
+                    normalInterfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:276:5: annotationTypeDeclaration
+                    {
+                    pushFollow(FOLLOW_annotationTypeDeclaration_in_interfaceDeclaration454);
+                    annotationTypeDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 16, interfaceDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceDeclaration
+
+
+    // $ANTLR start normalInterfaceDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:279:1: normalInterfaceDeclaration : 'interface' Identifier ( typeParameters )? ( 'extends' typeList )? interfaceBody ;
+    public final void normalInterfaceDeclaration() throws RecognitionException {
+        int normalInterfaceDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 17) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:280:2: ( 'interface' Identifier ( typeParameters )? ( 'extends' typeList )? interfaceBody )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:280:4: 'interface' Identifier ( typeParameters )? ( 'extends' typeList )? interfaceBody
+            {
+            match(input,39,FOLLOW_39_in_normalInterfaceDeclaration466); if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_normalInterfaceDeclaration468); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:280:27: ( typeParameters )?
+            int alt28=2;
+            int LA28_0 = input.LA(1);
+
+            if ( (LA28_0==33) ) {
+                alt28=1;
+            }
+            switch (alt28) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: typeParameters
+                    {
+                    pushFollow(FOLLOW_typeParameters_in_normalInterfaceDeclaration470);
+                    typeParameters();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:280:43: ( 'extends' typeList )?
+            int alt29=2;
+            int LA29_0 = input.LA(1);
+
+            if ( (LA29_0==31) ) {
+                alt29=1;
+            }
+            switch (alt29) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:280:44: 'extends' typeList
+                    {
+                    match(input,31,FOLLOW_31_in_normalInterfaceDeclaration474); if (failed) return ;
+                    pushFollow(FOLLOW_typeList_in_normalInterfaceDeclaration476);
+                    typeList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_interfaceBody_in_normalInterfaceDeclaration480);
+            interfaceBody();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 17, normalInterfaceDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end normalInterfaceDeclaration
+
+
+    // $ANTLR start typeList
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:283:1: typeList : type ( ',' type )* ;
+    public final void typeList() throws RecognitionException {
+        int typeList_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 18) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:284:2: ( type ( ',' type )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:284:4: type ( ',' type )*
+            {
+            pushFollow(FOLLOW_type_in_typeList492);
+            type();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:284:9: ( ',' type )*
+            loop30:
+            do {
+                int alt30=2;
+                int LA30_0 = input.LA(1);
+
+                if ( (LA30_0==34) ) {
+                    alt30=1;
+                }
+
+
+                switch (alt30) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:284:10: ',' type
+            	    {
+            	    match(input,34,FOLLOW_34_in_typeList495); if (failed) return ;
+            	    pushFollow(FOLLOW_type_in_typeList497);
+            	    type();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop30;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 18, typeList_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeList
+
+
+    // $ANTLR start classBody
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:287:1: classBody : '{' ( classBodyDeclaration )* '}' ;
+    public final void classBody() throws RecognitionException {
+        int classBody_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 19) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:288:2: ( '{' ( classBodyDeclaration )* '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:288:4: '{' ( classBodyDeclaration )* '}'
+            {
+            match(input,37,FOLLOW_37_in_classBody511); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:288:8: ( classBodyDeclaration )*
+            loop31:
+            do {
+                int alt31=2;
+                int LA31_0 = input.LA(1);
+
+                if ( ((LA31_0>=Identifier && LA31_0<=ENUM)||LA31_0==25||LA31_0==27||LA31_0==30||LA31_0==33||LA31_0==37||(LA31_0>=39 && LA31_0<=40)||(LA31_0>=45 && LA31_0<=62)||LA31_0==71) ) {
+                    alt31=1;
+                }
+
+
+                switch (alt31) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: classBodyDeclaration
+            	    {
+            	    pushFollow(FOLLOW_classBodyDeclaration_in_classBody513);
+            	    classBodyDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop31;
+                }
+            } while (true);
+
+            match(input,38,FOLLOW_38_in_classBody516); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 19, classBody_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end classBody
+
+
+    // $ANTLR start interfaceBody
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:291:1: interfaceBody : '{' ( interfaceBodyDeclaration )* '}' ;
+    public final void interfaceBody() throws RecognitionException {
+        int interfaceBody_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 20) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:292:2: ( '{' ( interfaceBodyDeclaration )* '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:292:4: '{' ( interfaceBodyDeclaration )* '}'
+            {
+            match(input,37,FOLLOW_37_in_interfaceBody528); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:292:8: ( interfaceBodyDeclaration )*
+            loop32:
+            do {
+                int alt32=2;
+                int LA32_0 = input.LA(1);
+
+                if ( ((LA32_0>=Identifier && LA32_0<=ENUM)||LA32_0==25||LA32_0==27||LA32_0==30||LA32_0==33||(LA32_0>=39 && LA32_0<=40)||(LA32_0>=45 && LA32_0<=62)||LA32_0==71) ) {
+                    alt32=1;
+                }
+
+
+                switch (alt32) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: interfaceBodyDeclaration
+            	    {
+            	    pushFollow(FOLLOW_interfaceBodyDeclaration_in_interfaceBody530);
+            	    interfaceBodyDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop32;
+                }
+            } while (true);
+
+            match(input,38,FOLLOW_38_in_interfaceBody533); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 20, interfaceBody_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceBody
+
+
+    // $ANTLR start classBodyDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:295:1: classBodyDeclaration : ( ';' | ( 'static' )? block | ( modifier )* memberDecl );
+    public final void classBodyDeclaration() throws RecognitionException {
+        int classBodyDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 21) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:296:2: ( ';' | ( 'static' )? block | ( modifier )* memberDecl )
+            int alt35=3;
+            switch ( input.LA(1) ) {
+            case 25:
+                {
+                alt35=1;
+                }
+                break;
+            case 27:
+                {
+                int LA35_2 = input.LA(2);
+
+                if ( ((LA35_2>=Identifier && LA35_2<=ENUM)||LA35_2==27||LA35_2==30||LA35_2==33||(LA35_2>=39 && LA35_2<=40)||(LA35_2>=45 && LA35_2<=62)||LA35_2==71) ) {
+                    alt35=3;
+                }
+                else if ( (LA35_2==37) ) {
+                    alt35=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("295:1: classBodyDeclaration : ( ';' | ( 'static' )? block | ( modifier )* memberDecl );", 35, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case 37:
+                {
+                alt35=2;
+                }
+                break;
+            case Identifier:
+            case ENUM:
+            case 30:
+            case 33:
+            case 39:
+            case 40:
+            case 45:
+            case 46:
+            case 47:
+            case 48:
+            case 49:
+            case 50:
+            case 51:
+            case 52:
+            case 53:
+            case 54:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+            case 71:
+                {
+                alt35=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("295:1: classBodyDeclaration : ( ';' | ( 'static' )? block | ( modifier )* memberDecl );", 35, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt35) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:296:4: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_classBodyDeclaration544); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:297:4: ( 'static' )? block
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:297:4: ( 'static' )?
+                    int alt33=2;
+                    int LA33_0 = input.LA(1);
+
+                    if ( (LA33_0==27) ) {
+                        alt33=1;
+                    }
+                    switch (alt33) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: 'static'
+                            {
+                            match(input,27,FOLLOW_27_in_classBodyDeclaration549); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    pushFollow(FOLLOW_block_in_classBodyDeclaration552);
+                    block();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:298:4: ( modifier )* memberDecl
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:298:4: ( modifier )*
+                    loop34:
+                    do {
+                        int alt34=2;
+                        int LA34_0 = input.LA(1);
+
+                        if ( (LA34_0==71) ) {
+                            int LA34_6 = input.LA(2);
+
+                            if ( (LA34_6==Identifier) ) {
+                                alt34=1;
+                            }
+
+
+                        }
+                        else if ( (LA34_0==27||(LA34_0>=45 && LA34_0<=54)) ) {
+                            alt34=1;
+                        }
+
+
+                        switch (alt34) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: modifier
+                    	    {
+                    	    pushFollow(FOLLOW_modifier_in_classBodyDeclaration557);
+                    	    modifier();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop34;
+                        }
+                    } while (true);
+
+                    pushFollow(FOLLOW_memberDecl_in_classBodyDeclaration560);
+                    memberDecl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 21, classBodyDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end classBodyDeclaration
+
+
+    // $ANTLR start memberDecl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );
+    public final void memberDecl() throws RecognitionException {
+        int memberDecl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 22) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:302:2: ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration )
+            int alt36=7;
+            switch ( input.LA(1) ) {
+            case 33:
+                {
+                alt36=1;
+                }
+                break;
+            case Identifier:
+                {
+                switch ( input.LA(2) ) {
+                case 33:
+                    {
+                    int LA36_9 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 9, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 28:
+                    {
+                    int LA36_10 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 10, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 41:
+                    {
+                    int LA36_11 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 11, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case Identifier:
+                    {
+                    int LA36_12 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 12, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 65:
+                    {
+                    alt36=5;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 2, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                int LA36_3 = input.LA(2);
+
+                if ( (LA36_3==41) ) {
+                    int LA36_14 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 14, input);
+
+                        throw nvae;
+                    }
+                }
+                else if ( (LA36_3==Identifier) ) {
+                    int LA36_15 = input.LA(3);
+
+                    if ( (synpred38()) ) {
+                        alt36=2;
+                    }
+                    else if ( (synpred39()) ) {
+                        alt36=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 15, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 3, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case 40:
+                {
+                alt36=4;
+                }
+                break;
+            case 39:
+            case 71:
+                {
+                alt36=6;
+                }
+                break;
+            case ENUM:
+            case 30:
+                {
+                alt36=7;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("301:1: memberDecl : ( genericMethodOrConstructorDecl | methodDeclaration | fieldDeclaration | 'void' Identifier voidMethodDeclaratorRest | Identifier constructorDeclaratorRest | interfaceDeclaration | classDeclaration );", 36, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt36) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:302:4: genericMethodOrConstructorDecl
+                    {
+                    pushFollow(FOLLOW_genericMethodOrConstructorDecl_in_memberDecl572);
+                    genericMethodOrConstructorDecl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:303:4: methodDeclaration
+                    {
+                    pushFollow(FOLLOW_methodDeclaration_in_memberDecl577);
+                    methodDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:304:4: fieldDeclaration
+                    {
+                    pushFollow(FOLLOW_fieldDeclaration_in_memberDecl582);
+                    fieldDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:305:4: 'void' Identifier voidMethodDeclaratorRest
+                    {
+                    match(input,40,FOLLOW_40_in_memberDecl587); if (failed) return ;
+                    match(input,Identifier,FOLLOW_Identifier_in_memberDecl589); if (failed) return ;
+                    pushFollow(FOLLOW_voidMethodDeclaratorRest_in_memberDecl591);
+                    voidMethodDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:306:4: Identifier constructorDeclaratorRest
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_memberDecl596); if (failed) return ;
+                    pushFollow(FOLLOW_constructorDeclaratorRest_in_memberDecl598);
+                    constructorDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:307:4: interfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_interfaceDeclaration_in_memberDecl603);
+                    interfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:308:4: classDeclaration
+                    {
+                    pushFollow(FOLLOW_classDeclaration_in_memberDecl608);
+                    classDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 22, memberDecl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end memberDecl
+
+
+    // $ANTLR start genericMethodOrConstructorDecl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:311:1: genericMethodOrConstructorDecl : typeParameters genericMethodOrConstructorRest ;
+    public final void genericMethodOrConstructorDecl() throws RecognitionException {
+        int genericMethodOrConstructorDecl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 23) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:312:2: ( typeParameters genericMethodOrConstructorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:312:4: typeParameters genericMethodOrConstructorRest
+            {
+            pushFollow(FOLLOW_typeParameters_in_genericMethodOrConstructorDecl620);
+            typeParameters();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_genericMethodOrConstructorRest_in_genericMethodOrConstructorDecl622);
+            genericMethodOrConstructorRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 23, genericMethodOrConstructorDecl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end genericMethodOrConstructorDecl
+
+
+    // $ANTLR start genericMethodOrConstructorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:315:1: genericMethodOrConstructorRest : ( ( type | 'void' ) Identifier methodDeclaratorRest | Identifier constructorDeclaratorRest );
+    public final void genericMethodOrConstructorRest() throws RecognitionException {
+        int genericMethodOrConstructorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 24) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:316:2: ( ( type | 'void' ) Identifier methodDeclaratorRest | Identifier constructorDeclaratorRest )
+            int alt38=2;
+            int LA38_0 = input.LA(1);
+
+            if ( (LA38_0==Identifier) ) {
+                int LA38_1 = input.LA(2);
+
+                if ( (LA38_1==Identifier||LA38_1==28||LA38_1==33||LA38_1==41) ) {
+                    alt38=1;
+                }
+                else if ( (LA38_1==65) ) {
+                    alt38=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("315:1: genericMethodOrConstructorRest : ( ( type | 'void' ) Identifier methodDeclaratorRest | Identifier constructorDeclaratorRest );", 38, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA38_0==40||(LA38_0>=55 && LA38_0<=62)) ) {
+                alt38=1;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("315:1: genericMethodOrConstructorRest : ( ( type | 'void' ) Identifier methodDeclaratorRest | Identifier constructorDeclaratorRest );", 38, 0, input);
+
+                throw nvae;
+            }
+            switch (alt38) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:316:4: ( type | 'void' ) Identifier methodDeclaratorRest
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:316:4: ( type | 'void' )
+                    int alt37=2;
+                    int LA37_0 = input.LA(1);
+
+                    if ( (LA37_0==Identifier||(LA37_0>=55 && LA37_0<=62)) ) {
+                        alt37=1;
+                    }
+                    else if ( (LA37_0==40) ) {
+                        alt37=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("316:4: ( type | 'void' )", 37, 0, input);
+
+                        throw nvae;
+                    }
+                    switch (alt37) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:316:5: type
+                            {
+                            pushFollow(FOLLOW_type_in_genericMethodOrConstructorRest635);
+                            type();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+                        case 2 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:316:12: 'void'
+                            {
+                            match(input,40,FOLLOW_40_in_genericMethodOrConstructorRest639); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,Identifier,FOLLOW_Identifier_in_genericMethodOrConstructorRest642); if (failed) return ;
+                    pushFollow(FOLLOW_methodDeclaratorRest_in_genericMethodOrConstructorRest644);
+                    methodDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:317:4: Identifier constructorDeclaratorRest
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_genericMethodOrConstructorRest649); if (failed) return ;
+                    pushFollow(FOLLOW_constructorDeclaratorRest_in_genericMethodOrConstructorRest651);
+                    constructorDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 24, genericMethodOrConstructorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end genericMethodOrConstructorRest
+
+
+    // $ANTLR start methodDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:320:1: methodDeclaration : type Identifier methodDeclaratorRest ;
+    public final void methodDeclaration() throws RecognitionException {
+        int methodDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 25) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:321:2: ( type Identifier methodDeclaratorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:321:4: type Identifier methodDeclaratorRest
+            {
+            pushFollow(FOLLOW_type_in_methodDeclaration662);
+            type();
+            _fsp--;
+            if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_methodDeclaration664); if (failed) return ;
+            pushFollow(FOLLOW_methodDeclaratorRest_in_methodDeclaration666);
+            methodDeclaratorRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 25, methodDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end methodDeclaration
+
+
+    // $ANTLR start fieldDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:324:1: fieldDeclaration : type variableDeclarators ';' ;
+    public final void fieldDeclaration() throws RecognitionException {
+        int fieldDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 26) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:325:2: ( type variableDeclarators ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:325:4: type variableDeclarators ';'
+            {
+            pushFollow(FOLLOW_type_in_fieldDeclaration677);
+            type();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_variableDeclarators_in_fieldDeclaration679);
+            variableDeclarators();
+            _fsp--;
+            if (failed) return ;
+            match(input,25,FOLLOW_25_in_fieldDeclaration681); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 26, fieldDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end fieldDeclaration
+
+
+    // $ANTLR start interfaceBodyDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:328:1: interfaceBodyDeclaration : ( ( modifier )* interfaceMemberDecl | ';' );
+    public final void interfaceBodyDeclaration() throws RecognitionException {
+        int interfaceBodyDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 27) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:329:2: ( ( modifier )* interfaceMemberDecl | ';' )
+            int alt40=2;
+            int LA40_0 = input.LA(1);
+
+            if ( ((LA40_0>=Identifier && LA40_0<=ENUM)||LA40_0==27||LA40_0==30||LA40_0==33||(LA40_0>=39 && LA40_0<=40)||(LA40_0>=45 && LA40_0<=62)||LA40_0==71) ) {
+                alt40=1;
+            }
+            else if ( (LA40_0==25) ) {
+                alt40=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("328:1: interfaceBodyDeclaration : ( ( modifier )* interfaceMemberDecl | ';' );", 40, 0, input);
+
+                throw nvae;
+            }
+            switch (alt40) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:329:4: ( modifier )* interfaceMemberDecl
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:329:4: ( modifier )*
+                    loop39:
+                    do {
+                        int alt39=2;
+                        int LA39_0 = input.LA(1);
+
+                        if ( (LA39_0==71) ) {
+                            int LA39_6 = input.LA(2);
+
+                            if ( (LA39_6==Identifier) ) {
+                                alt39=1;
+                            }
+
+
+                        }
+                        else if ( (LA39_0==27||(LA39_0>=45 && LA39_0<=54)) ) {
+                            alt39=1;
+                        }
+
+
+                        switch (alt39) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: modifier
+                    	    {
+                    	    pushFollow(FOLLOW_modifier_in_interfaceBodyDeclaration694);
+                    	    modifier();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop39;
+                        }
+                    } while (true);
+
+                    pushFollow(FOLLOW_interfaceMemberDecl_in_interfaceBodyDeclaration697);
+                    interfaceMemberDecl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:330:6: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_interfaceBodyDeclaration704); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 27, interfaceBodyDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceBodyDeclaration
+
+
+    // $ANTLR start interfaceMemberDecl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:333:1: interfaceMemberDecl : ( interfaceMethodOrFieldDecl | interfaceGenericMethodDecl | 'void' Identifier voidInterfaceMethodDeclaratorRest | interfaceDeclaration | classDeclaration );
+    public final void interfaceMemberDecl() throws RecognitionException {
+        int interfaceMemberDecl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 28) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:334:2: ( interfaceMethodOrFieldDecl | interfaceGenericMethodDecl | 'void' Identifier voidInterfaceMethodDeclaratorRest | interfaceDeclaration | classDeclaration )
+            int alt41=5;
+            switch ( input.LA(1) ) {
+            case Identifier:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                alt41=1;
+                }
+                break;
+            case 33:
+                {
+                alt41=2;
+                }
+                break;
+            case 40:
+                {
+                alt41=3;
+                }
+                break;
+            case 39:
+            case 71:
+                {
+                alt41=4;
+                }
+                break;
+            case ENUM:
+            case 30:
+                {
+                alt41=5;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("333:1: interfaceMemberDecl : ( interfaceMethodOrFieldDecl | interfaceGenericMethodDecl | 'void' Identifier voidInterfaceMethodDeclaratorRest | interfaceDeclaration | classDeclaration );", 41, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt41) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:334:4: interfaceMethodOrFieldDecl
+                    {
+                    pushFollow(FOLLOW_interfaceMethodOrFieldDecl_in_interfaceMemberDecl715);
+                    interfaceMethodOrFieldDecl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:335:6: interfaceGenericMethodDecl
+                    {
+                    pushFollow(FOLLOW_interfaceGenericMethodDecl_in_interfaceMemberDecl722);
+                    interfaceGenericMethodDecl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:336:9: 'void' Identifier voidInterfaceMethodDeclaratorRest
+                    {
+                    match(input,40,FOLLOW_40_in_interfaceMemberDecl732); if (failed) return ;
+                    match(input,Identifier,FOLLOW_Identifier_in_interfaceMemberDecl734); if (failed) return ;
+                    pushFollow(FOLLOW_voidInterfaceMethodDeclaratorRest_in_interfaceMemberDecl736);
+                    voidInterfaceMethodDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:337:9: interfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_interfaceDeclaration_in_interfaceMemberDecl746);
+                    interfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:338:9: classDeclaration
+                    {
+                    pushFollow(FOLLOW_classDeclaration_in_interfaceMemberDecl756);
+                    classDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 28, interfaceMemberDecl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceMemberDecl
+
+
+    // $ANTLR start interfaceMethodOrFieldDecl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:341:1: interfaceMethodOrFieldDecl : type Identifier interfaceMethodOrFieldRest ;
+    public final void interfaceMethodOrFieldDecl() throws RecognitionException {
+        int interfaceMethodOrFieldDecl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 29) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:342:2: ( type Identifier interfaceMethodOrFieldRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:342:4: type Identifier interfaceMethodOrFieldRest
+            {
+            pushFollow(FOLLOW_type_in_interfaceMethodOrFieldDecl768);
+            type();
+            _fsp--;
+            if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_interfaceMethodOrFieldDecl770); if (failed) return ;
+            pushFollow(FOLLOW_interfaceMethodOrFieldRest_in_interfaceMethodOrFieldDecl772);
+            interfaceMethodOrFieldRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 29, interfaceMethodOrFieldDecl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceMethodOrFieldDecl
+
+
+    // $ANTLR start interfaceMethodOrFieldRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:345:1: interfaceMethodOrFieldRest : ( constantDeclaratorsRest ';' | interfaceMethodDeclaratorRest );
+    public final void interfaceMethodOrFieldRest() throws RecognitionException {
+        int interfaceMethodOrFieldRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 30) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:346:2: ( constantDeclaratorsRest ';' | interfaceMethodDeclaratorRest )
+            int alt42=2;
+            int LA42_0 = input.LA(1);
+
+            if ( (LA42_0==41||LA42_0==44) ) {
+                alt42=1;
+            }
+            else if ( (LA42_0==65) ) {
+                alt42=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("345:1: interfaceMethodOrFieldRest : ( constantDeclaratorsRest ';' | interfaceMethodDeclaratorRest );", 42, 0, input);
+
+                throw nvae;
+            }
+            switch (alt42) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:346:4: constantDeclaratorsRest ';'
+                    {
+                    pushFollow(FOLLOW_constantDeclaratorsRest_in_interfaceMethodOrFieldRest784);
+                    constantDeclaratorsRest();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,25,FOLLOW_25_in_interfaceMethodOrFieldRest786); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:347:4: interfaceMethodDeclaratorRest
+                    {
+                    pushFollow(FOLLOW_interfaceMethodDeclaratorRest_in_interfaceMethodOrFieldRest791);
+                    interfaceMethodDeclaratorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 30, interfaceMethodOrFieldRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceMethodOrFieldRest
+
+
+    // $ANTLR start methodDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:350:1: methodDeclaratorRest : formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ( methodBody | ';' ) ;
+    public final void methodDeclaratorRest() throws RecognitionException {
+        int methodDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 31) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:351:2: ( formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ( methodBody | ';' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:351:4: formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ( methodBody | ';' )
+            {
+            pushFollow(FOLLOW_formalParameters_in_methodDeclaratorRest803);
+            formalParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:351:21: ( '[' ']' )*
+            loop43:
+            do {
+                int alt43=2;
+                int LA43_0 = input.LA(1);
+
+                if ( (LA43_0==41) ) {
+                    alt43=1;
+                }
+
+
+                switch (alt43) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:351:22: '[' ']'
+            	    {
+            	    match(input,41,FOLLOW_41_in_methodDeclaratorRest806); if (failed) return ;
+            	    match(input,42,FOLLOW_42_in_methodDeclaratorRest808); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop43;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:352:9: ( 'throws' qualifiedNameList )?
+            int alt44=2;
+            int LA44_0 = input.LA(1);
+
+            if ( (LA44_0==43) ) {
+                alt44=1;
+            }
+            switch (alt44) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:352:10: 'throws' qualifiedNameList
+                    {
+                    match(input,43,FOLLOW_43_in_methodDeclaratorRest821); if (failed) return ;
+                    pushFollow(FOLLOW_qualifiedNameList_in_methodDeclaratorRest823);
+                    qualifiedNameList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:353:9: ( methodBody | ';' )
+            int alt45=2;
+            int LA45_0 = input.LA(1);
+
+            if ( (LA45_0==37) ) {
+                alt45=1;
+            }
+            else if ( (LA45_0==25) ) {
+                alt45=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("353:9: ( methodBody | ';' )", 45, 0, input);
+
+                throw nvae;
+            }
+            switch (alt45) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:353:13: methodBody
+                    {
+                    pushFollow(FOLLOW_methodBody_in_methodDeclaratorRest839);
+                    methodBody();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:354:13: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_methodDeclaratorRest853); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 31, methodDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end methodDeclaratorRest
+
+
+    // $ANTLR start voidMethodDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:358:1: voidMethodDeclaratorRest : formalParameters ( 'throws' qualifiedNameList )? ( methodBody | ';' ) ;
+    public final void voidMethodDeclaratorRest() throws RecognitionException {
+        int voidMethodDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 32) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:359:2: ( formalParameters ( 'throws' qualifiedNameList )? ( methodBody | ';' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:359:4: formalParameters ( 'throws' qualifiedNameList )? ( methodBody | ';' )
+            {
+            pushFollow(FOLLOW_formalParameters_in_voidMethodDeclaratorRest875);
+            formalParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:359:21: ( 'throws' qualifiedNameList )?
+            int alt46=2;
+            int LA46_0 = input.LA(1);
+
+            if ( (LA46_0==43) ) {
+                alt46=1;
+            }
+            switch (alt46) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:359:22: 'throws' qualifiedNameList
+                    {
+                    match(input,43,FOLLOW_43_in_voidMethodDeclaratorRest878); if (failed) return ;
+                    pushFollow(FOLLOW_qualifiedNameList_in_voidMethodDeclaratorRest880);
+                    qualifiedNameList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:360:9: ( methodBody | ';' )
+            int alt47=2;
+            int LA47_0 = input.LA(1);
+
+            if ( (LA47_0==37) ) {
+                alt47=1;
+            }
+            else if ( (LA47_0==25) ) {
+                alt47=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("360:9: ( methodBody | ';' )", 47, 0, input);
+
+                throw nvae;
+            }
+            switch (alt47) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:360:13: methodBody
+                    {
+                    pushFollow(FOLLOW_methodBody_in_voidMethodDeclaratorRest896);
+                    methodBody();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:361:13: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_voidMethodDeclaratorRest910); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 32, voidMethodDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end voidMethodDeclaratorRest
+
+
+    // $ANTLR start interfaceMethodDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:365:1: interfaceMethodDeclaratorRest : formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ';' ;
+    public final void interfaceMethodDeclaratorRest() throws RecognitionException {
+        int interfaceMethodDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 33) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:2: ( formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:4: formalParameters ( '[' ']' )* ( 'throws' qualifiedNameList )? ';'
+            {
+            pushFollow(FOLLOW_formalParameters_in_interfaceMethodDeclaratorRest932);
+            formalParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:21: ( '[' ']' )*
+            loop48:
+            do {
+                int alt48=2;
+                int LA48_0 = input.LA(1);
+
+                if ( (LA48_0==41) ) {
+                    alt48=1;
+                }
+
+
+                switch (alt48) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:22: '[' ']'
+            	    {
+            	    match(input,41,FOLLOW_41_in_interfaceMethodDeclaratorRest935); if (failed) return ;
+            	    match(input,42,FOLLOW_42_in_interfaceMethodDeclaratorRest937); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop48;
+                }
+            } while (true);
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:32: ( 'throws' qualifiedNameList )?
+            int alt49=2;
+            int LA49_0 = input.LA(1);
+
+            if ( (LA49_0==43) ) {
+                alt49=1;
+            }
+            switch (alt49) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:366:33: 'throws' qualifiedNameList
+                    {
+                    match(input,43,FOLLOW_43_in_interfaceMethodDeclaratorRest942); if (failed) return ;
+                    pushFollow(FOLLOW_qualifiedNameList_in_interfaceMethodDeclaratorRest944);
+                    qualifiedNameList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,25,FOLLOW_25_in_interfaceMethodDeclaratorRest948); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 33, interfaceMethodDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceMethodDeclaratorRest
+
+
+    // $ANTLR start interfaceGenericMethodDecl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:369:1: interfaceGenericMethodDecl : typeParameters ( type | 'void' ) Identifier interfaceMethodDeclaratorRest ;
+    public final void interfaceGenericMethodDecl() throws RecognitionException {
+        int interfaceGenericMethodDecl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 34) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:370:2: ( typeParameters ( type | 'void' ) Identifier interfaceMethodDeclaratorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:370:4: typeParameters ( type | 'void' ) Identifier interfaceMethodDeclaratorRest
+            {
+            pushFollow(FOLLOW_typeParameters_in_interfaceGenericMethodDecl960);
+            typeParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:370:19: ( type | 'void' )
+            int alt50=2;
+            int LA50_0 = input.LA(1);
+
+            if ( (LA50_0==Identifier||(LA50_0>=55 && LA50_0<=62)) ) {
+                alt50=1;
+            }
+            else if ( (LA50_0==40) ) {
+                alt50=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("370:19: ( type | 'void' )", 50, 0, input);
+
+                throw nvae;
+            }
+            switch (alt50) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:370:20: type
+                    {
+                    pushFollow(FOLLOW_type_in_interfaceGenericMethodDecl963);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:370:27: 'void'
+                    {
+                    match(input,40,FOLLOW_40_in_interfaceGenericMethodDecl967); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,Identifier,FOLLOW_Identifier_in_interfaceGenericMethodDecl970); if (failed) return ;
+            pushFollow(FOLLOW_interfaceMethodDeclaratorRest_in_interfaceGenericMethodDecl980);
+            interfaceMethodDeclaratorRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 34, interfaceGenericMethodDecl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end interfaceGenericMethodDecl
+
+
+    // $ANTLR start voidInterfaceMethodDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:374:1: voidInterfaceMethodDeclaratorRest : formalParameters ( 'throws' qualifiedNameList )? ';' ;
+    public final void voidInterfaceMethodDeclaratorRest() throws RecognitionException {
+        int voidInterfaceMethodDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 35) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:375:2: ( formalParameters ( 'throws' qualifiedNameList )? ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:375:4: formalParameters ( 'throws' qualifiedNameList )? ';'
+            {
+            pushFollow(FOLLOW_formalParameters_in_voidInterfaceMethodDeclaratorRest992);
+            formalParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:375:21: ( 'throws' qualifiedNameList )?
+            int alt51=2;
+            int LA51_0 = input.LA(1);
+
+            if ( (LA51_0==43) ) {
+                alt51=1;
+            }
+            switch (alt51) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:375:22: 'throws' qualifiedNameList
+                    {
+                    match(input,43,FOLLOW_43_in_voidInterfaceMethodDeclaratorRest995); if (failed) return ;
+                    pushFollow(FOLLOW_qualifiedNameList_in_voidInterfaceMethodDeclaratorRest997);
+                    qualifiedNameList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,25,FOLLOW_25_in_voidInterfaceMethodDeclaratorRest1001); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 35, voidInterfaceMethodDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end voidInterfaceMethodDeclaratorRest
+
+
+    // $ANTLR start constructorDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:378:1: constructorDeclaratorRest : formalParameters ( 'throws' qualifiedNameList )? methodBody ;
+    public final void constructorDeclaratorRest() throws RecognitionException {
+        int constructorDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 36) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:379:2: ( formalParameters ( 'throws' qualifiedNameList )? methodBody )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:379:4: formalParameters ( 'throws' qualifiedNameList )? methodBody
+            {
+            pushFollow(FOLLOW_formalParameters_in_constructorDeclaratorRest1013);
+            formalParameters();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:379:21: ( 'throws' qualifiedNameList )?
+            int alt52=2;
+            int LA52_0 = input.LA(1);
+
+            if ( (LA52_0==43) ) {
+                alt52=1;
+            }
+            switch (alt52) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:379:22: 'throws' qualifiedNameList
+                    {
+                    match(input,43,FOLLOW_43_in_constructorDeclaratorRest1016); if (failed) return ;
+                    pushFollow(FOLLOW_qualifiedNameList_in_constructorDeclaratorRest1018);
+                    qualifiedNameList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_methodBody_in_constructorDeclaratorRest1022);
+            methodBody();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 36, constructorDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end constructorDeclaratorRest
+
+
+    // $ANTLR start constantDeclarator
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:382:1: constantDeclarator : Identifier constantDeclaratorRest ;
+    public final void constantDeclarator() throws RecognitionException {
+        int constantDeclarator_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 37) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:383:2: ( Identifier constantDeclaratorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:383:4: Identifier constantDeclaratorRest
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_constantDeclarator1033); if (failed) return ;
+            pushFollow(FOLLOW_constantDeclaratorRest_in_constantDeclarator1035);
+            constantDeclaratorRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 37, constantDeclarator_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end constantDeclarator
+
+
+    // $ANTLR start variableDeclarators
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:386:1: variableDeclarators : variableDeclarator ( ',' variableDeclarator )* ;
+    public final void variableDeclarators() throws RecognitionException {
+        int variableDeclarators_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 38) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:387:2: ( variableDeclarator ( ',' variableDeclarator )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:387:4: variableDeclarator ( ',' variableDeclarator )*
+            {
+            pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1047);
+            variableDeclarator();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:387:23: ( ',' variableDeclarator )*
+            loop53:
+            do {
+                int alt53=2;
+                int LA53_0 = input.LA(1);
+
+                if ( (LA53_0==34) ) {
+                    alt53=1;
+                }
+
+
+                switch (alt53) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:387:24: ',' variableDeclarator
+            	    {
+            	    match(input,34,FOLLOW_34_in_variableDeclarators1050); if (failed) return ;
+            	    pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1052);
+            	    variableDeclarator();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop53;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 38, variableDeclarators_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end variableDeclarators
+
+    protected static class variableDeclarator_scope {
+        JavaLocalDeclarationDescr.IdentifierDescr ident;
+    }
+    protected Stack variableDeclarator_stack = new Stack();
+
+
+    // $ANTLR start variableDeclarator
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:390:1: variableDeclarator : id= Identifier rest= variableDeclaratorRest ;
+    public final void variableDeclarator() throws RecognitionException {
+        variableDeclarator_stack.push(new variableDeclarator_scope());
+        int variableDeclarator_StartIndex = input.index();
+        Token id=null;
+        variableDeclaratorRest_return rest = null;
+
+
+
+        		if( this.localVariableLevel == 1 ) { // we only want top level local vars
+        			((variableDeclarator_scope)variableDeclarator_stack.peek()).ident = new JavaLocalDeclarationDescr.IdentifierDescr();
+        		}
+        	
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 39) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:404:2: (id= Identifier rest= variableDeclaratorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:404:4: id= Identifier rest= variableDeclaratorRest
+            {
+            id=(Token)input.LT(1);
+            match(input,Identifier,FOLLOW_Identifier_in_variableDeclarator1084); if (failed) return ;
+            pushFollow(FOLLOW_variableDeclaratorRest_in_variableDeclarator1088);
+            rest=variableDeclaratorRest();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+               
+              			if( this.localVariableLevel == 1 ) { // we only want top level local vars
+              				((variableDeclarator_scope)variableDeclarator_stack.peek()).ident.setIdentifier( id.getText() );
+              				((variableDeclarator_scope)variableDeclarator_stack.peek()).ident.setStart( ((CommonToken)id).getStartIndex() - 1 );
+              				if( ((Token)rest.stop) != null ) {
+                 					((variableDeclarator_scope)variableDeclarator_stack.peek()).ident.setEnd( ((CommonToken)((Token)rest.stop)).getStopIndex() );
+              				}
+              			}
+              		
+            }
+
+            }
+
+            if ( backtracking==0 ) {
+
+              	        if( this.localVariableLevel == 1 ) { // we only want top level local vars
+              	        	((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.addIdentifier( ((variableDeclarator_scope)variableDeclarator_stack.peek()).ident );
+              	        }
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 39, variableDeclarator_StartIndex); }
+            variableDeclarator_stack.pop();
+        }
+        return ;
+    }
+    // $ANTLR end variableDeclarator
+
+    public static class variableDeclaratorRest_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start variableDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:416:1: variableDeclaratorRest : ( ( '[' ']' )+ ( '=' variableInitializer )? | '=' variableInitializer | );
+    public final variableDeclaratorRest_return variableDeclaratorRest() throws RecognitionException {
+        variableDeclaratorRest_return retval = new variableDeclaratorRest_return();
+        retval.start = input.LT(1);
+        int variableDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 40) ) { return retval; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:2: ( ( '[' ']' )+ ( '=' variableInitializer )? | '=' variableInitializer | )
+            int alt56=3;
+            switch ( input.LA(1) ) {
+            case 41:
+                {
+                alt56=1;
+                }
+                break;
+            case 44:
+                {
+                alt56=2;
+                }
+                break;
+            case EOF:
+            case 25:
+            case 34:
+                {
+                alt56=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("416:1: variableDeclaratorRest : ( ( '[' ']' )+ ( '=' variableInitializer )? | '=' variableInitializer | );", 56, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt56) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:4: ( '[' ']' )+ ( '=' variableInitializer )?
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:4: ( '[' ']' )+
+                    int cnt54=0;
+                    loop54:
+                    do {
+                        int alt54=2;
+                        int LA54_0 = input.LA(1);
+
+                        if ( (LA54_0==41) ) {
+                            alt54=1;
+                        }
+
+
+                        switch (alt54) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:5: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_variableDeclaratorRest1106); if (failed) return retval;
+                    	    match(input,42,FOLLOW_42_in_variableDeclaratorRest1108); if (failed) return retval;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt54 >= 1 ) break loop54;
+                    	    if (backtracking>0) {failed=true; return retval;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(54, input);
+                                throw eee;
+                        }
+                        cnt54++;
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:15: ( '=' variableInitializer )?
+                    int alt55=2;
+                    int LA55_0 = input.LA(1);
+
+                    if ( (LA55_0==44) ) {
+                        alt55=1;
+                    }
+                    switch (alt55) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:417:16: '=' variableInitializer
+                            {
+                            match(input,44,FOLLOW_44_in_variableDeclaratorRest1113); if (failed) return retval;
+                            pushFollow(FOLLOW_variableInitializer_in_variableDeclaratorRest1115);
+                            variableInitializer();
+                            _fsp--;
+                            if (failed) return retval;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:418:4: '=' variableInitializer
+                    {
+                    match(input,44,FOLLOW_44_in_variableDeclaratorRest1122); if (failed) return retval;
+                    pushFollow(FOLLOW_variableInitializer_in_variableDeclaratorRest1124);
+                    variableInitializer();
+                    _fsp--;
+                    if (failed) return retval;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:420:2: 
+                    {
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 40, variableDeclaratorRest_StartIndex); }
+        }
+        return retval;
+    }
+    // $ANTLR end variableDeclaratorRest
+
+
+    // $ANTLR start constantDeclaratorsRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:422:1: constantDeclaratorsRest : constantDeclaratorRest ( ',' constantDeclarator )* ;
+    public final void constantDeclaratorsRest() throws RecognitionException {
+        int constantDeclaratorsRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 41) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:423:5: ( constantDeclaratorRest ( ',' constantDeclarator )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:423:9: constantDeclaratorRest ( ',' constantDeclarator )*
+            {
+            pushFollow(FOLLOW_constantDeclaratorRest_in_constantDeclaratorsRest1144);
+            constantDeclaratorRest();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:423:32: ( ',' constantDeclarator )*
+            loop57:
+            do {
+                int alt57=2;
+                int LA57_0 = input.LA(1);
+
+                if ( (LA57_0==34) ) {
+                    alt57=1;
+                }
+
+
+                switch (alt57) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:423:33: ',' constantDeclarator
+            	    {
+            	    match(input,34,FOLLOW_34_in_constantDeclaratorsRest1147); if (failed) return ;
+            	    pushFollow(FOLLOW_constantDeclarator_in_constantDeclaratorsRest1149);
+            	    constantDeclarator();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop57;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 41, constantDeclaratorsRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end constantDeclaratorsRest
+
+
+    // $ANTLR start constantDeclaratorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:426:1: constantDeclaratorRest : ( '[' ']' )* '=' variableInitializer ;
+    public final void constantDeclaratorRest() throws RecognitionException {
+        int constantDeclaratorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 42) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:427:2: ( ( '[' ']' )* '=' variableInitializer )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:427:4: ( '[' ']' )* '=' variableInitializer
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:427:4: ( '[' ']' )*
+            loop58:
+            do {
+                int alt58=2;
+                int LA58_0 = input.LA(1);
+
+                if ( (LA58_0==41) ) {
+                    alt58=1;
+                }
+
+
+                switch (alt58) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:427:5: '[' ']'
+            	    {
+            	    match(input,41,FOLLOW_41_in_constantDeclaratorRest1166); if (failed) return ;
+            	    match(input,42,FOLLOW_42_in_constantDeclaratorRest1168); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop58;
+                }
+            } while (true);
+
+            match(input,44,FOLLOW_44_in_constantDeclaratorRest1172); if (failed) return ;
+            pushFollow(FOLLOW_variableInitializer_in_constantDeclaratorRest1174);
+            variableInitializer();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 42, constantDeclaratorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end constantDeclaratorRest
+
+
+    // $ANTLR start variableDeclaratorId
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:430:1: variableDeclaratorId : Identifier ( '[' ']' )* ;
+    public final void variableDeclaratorId() throws RecognitionException {
+        int variableDeclaratorId_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 43) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:431:2: ( Identifier ( '[' ']' )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:431:4: Identifier ( '[' ']' )*
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_variableDeclaratorId1186); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:431:15: ( '[' ']' )*
+            loop59:
+            do {
+                int alt59=2;
+                int LA59_0 = input.LA(1);
+
+                if ( (LA59_0==41) ) {
+                    alt59=1;
+                }
+
+
+                switch (alt59) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:431:16: '[' ']'
+            	    {
+            	    match(input,41,FOLLOW_41_in_variableDeclaratorId1189); if (failed) return ;
+            	    match(input,42,FOLLOW_42_in_variableDeclaratorId1191); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop59;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 43, variableDeclaratorId_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end variableDeclaratorId
+
+
+    // $ANTLR start variableInitializer
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:434:1: variableInitializer : ( arrayInitializer | expression );
+    public final void variableInitializer() throws RecognitionException {
+        int variableInitializer_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 44) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:435:2: ( arrayInitializer | expression )
+            int alt60=2;
+            int LA60_0 = input.LA(1);
+
+            if ( (LA60_0==37) ) {
+                alt60=1;
+            }
+            else if ( (LA60_0==Identifier||(LA60_0>=FloatingPointLiteral && LA60_0<=DecimalLiteral)||LA60_0==33||LA60_0==40||(LA60_0>=55 && LA60_0<=62)||(LA60_0>=64 && LA60_0<=65)||(LA60_0>=68 && LA60_0<=70)||(LA60_0>=105 && LA60_0<=106)||(LA60_0>=109 && LA60_0<=114)) ) {
+                alt60=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("434:1: variableInitializer : ( arrayInitializer | expression );", 60, 0, input);
+
+                throw nvae;
+            }
+            switch (alt60) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:435:4: arrayInitializer
+                    {
+                    pushFollow(FOLLOW_arrayInitializer_in_variableInitializer1204);
+                    arrayInitializer();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:436:9: expression
+                    {
+                    pushFollow(FOLLOW_expression_in_variableInitializer1214);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 44, variableInitializer_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end variableInitializer
+
+
+    // $ANTLR start arrayInitializer
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:439:1: arrayInitializer : '{' ( variableInitializer ( ',' variableInitializer )* ( ',' )? )? '}' ;
+    public final void arrayInitializer() throws RecognitionException {
+        int arrayInitializer_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 45) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:2: ( '{' ( variableInitializer ( ',' variableInitializer )* ( ',' )? )? '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:4: '{' ( variableInitializer ( ',' variableInitializer )* ( ',' )? )? '}'
+            {
+            match(input,37,FOLLOW_37_in_arrayInitializer1226); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:8: ( variableInitializer ( ',' variableInitializer )* ( ',' )? )?
+            int alt63=2;
+            int LA63_0 = input.LA(1);
+
+            if ( (LA63_0==Identifier||(LA63_0>=FloatingPointLiteral && LA63_0<=DecimalLiteral)||LA63_0==33||LA63_0==37||LA63_0==40||(LA63_0>=55 && LA63_0<=62)||(LA63_0>=64 && LA63_0<=65)||(LA63_0>=68 && LA63_0<=70)||(LA63_0>=105 && LA63_0<=106)||(LA63_0>=109 && LA63_0<=114)) ) {
+                alt63=1;
+            }
+            switch (alt63) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:9: variableInitializer ( ',' variableInitializer )* ( ',' )?
+                    {
+                    pushFollow(FOLLOW_variableInitializer_in_arrayInitializer1229);
+                    variableInitializer();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:29: ( ',' variableInitializer )*
+                    loop61:
+                    do {
+                        int alt61=2;
+                        int LA61_0 = input.LA(1);
+
+                        if ( (LA61_0==34) ) {
+                            int LA61_1 = input.LA(2);
+
+                            if ( (LA61_1==Identifier||(LA61_1>=FloatingPointLiteral && LA61_1<=DecimalLiteral)||LA61_1==33||LA61_1==37||LA61_1==40||(LA61_1>=55 && LA61_1<=62)||(LA61_1>=64 && LA61_1<=65)||(LA61_1>=68 && LA61_1<=70)||(LA61_1>=105 && LA61_1<=106)||(LA61_1>=109 && LA61_1<=114)) ) {
+                                alt61=1;
+                            }
+
+
+                        }
+
+
+                        switch (alt61) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:30: ',' variableInitializer
+                    	    {
+                    	    match(input,34,FOLLOW_34_in_arrayInitializer1232); if (failed) return ;
+                    	    pushFollow(FOLLOW_variableInitializer_in_arrayInitializer1234);
+                    	    variableInitializer();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop61;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:56: ( ',' )?
+                    int alt62=2;
+                    int LA62_0 = input.LA(1);
+
+                    if ( (LA62_0==34) ) {
+                        alt62=1;
+                    }
+                    switch (alt62) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:440:57: ','
+                            {
+                            match(input,34,FOLLOW_34_in_arrayInitializer1239); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            match(input,38,FOLLOW_38_in_arrayInitializer1246); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 45, arrayInitializer_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end arrayInitializer
+
+
+    // $ANTLR start modifier
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:443:1: modifier : ( annotation | 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp' );
+    public final void modifier() throws RecognitionException {
+        int modifier_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 46) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:444:5: ( annotation | 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp' )
+            int alt64=12;
+            switch ( input.LA(1) ) {
+            case 71:
+                {
+                alt64=1;
+                }
+                break;
+            case 45:
+                {
+                alt64=2;
+                }
+                break;
+            case 46:
+                {
+                alt64=3;
+                }
+                break;
+            case 47:
+                {
+                alt64=4;
+                }
+                break;
+            case 27:
+                {
+                alt64=5;
+                }
+                break;
+            case 48:
+                {
+                alt64=6;
+                }
+                break;
+            case 49:
+                {
+                alt64=7;
+                }
+                break;
+            case 50:
+                {
+                alt64=8;
+                }
+                break;
+            case 51:
+                {
+                alt64=9;
+                }
+                break;
+            case 52:
+                {
+                alt64=10;
+                }
+                break;
+            case 53:
+                {
+                alt64=11;
+                }
+                break;
+            case 54:
+                {
+                alt64=12;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("443:1: modifier : ( annotation | 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp' );", 64, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt64) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:444:9: annotation
+                    {
+                    pushFollow(FOLLOW_annotation_in_modifier1262);
+                    annotation();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:445:9: 'public'
+                    {
+                    match(input,45,FOLLOW_45_in_modifier1272); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:446:9: 'protected'
+                    {
+                    match(input,46,FOLLOW_46_in_modifier1282); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:447:9: 'private'
+                    {
+                    match(input,47,FOLLOW_47_in_modifier1292); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:448:9: 'static'
+                    {
+                    match(input,27,FOLLOW_27_in_modifier1302); if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:449:9: 'abstract'
+                    {
+                    match(input,48,FOLLOW_48_in_modifier1312); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:450:9: 'final'
+                    {
+                    match(input,49,FOLLOW_49_in_modifier1322); if (failed) return ;
+
+                    }
+                    break;
+                case 8 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:451:9: 'native'
+                    {
+                    match(input,50,FOLLOW_50_in_modifier1332); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:452:9: 'synchronized'
+                    {
+                    match(input,51,FOLLOW_51_in_modifier1342); if (failed) return ;
+
+                    }
+                    break;
+                case 10 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:453:9: 'transient'
+                    {
+                    match(input,52,FOLLOW_52_in_modifier1352); if (failed) return ;
+
+                    }
+                    break;
+                case 11 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:454:9: 'volatile'
+                    {
+                    match(input,53,FOLLOW_53_in_modifier1362); if (failed) return ;
+
+                    }
+                    break;
+                case 12 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:455:9: 'strictfp'
+                    {
+                    match(input,54,FOLLOW_54_in_modifier1372); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 46, modifier_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end modifier
+
+
+    // $ANTLR start packageOrTypeName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:458:1: packageOrTypeName : Identifier ( '.' Identifier )* ;
+    public final void packageOrTypeName() throws RecognitionException {
+        int packageOrTypeName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 47) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:2: ( Identifier ( '.' Identifier )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:4: Identifier ( '.' Identifier )*
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_packageOrTypeName1386); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:15: ( '.' Identifier )*
+            loop65:
+            do {
+                int alt65=2;
+                int LA65_0 = input.LA(1);
+
+                if ( (LA65_0==28) ) {
+                    int LA65_1 = input.LA(2);
+
+                    if ( (LA65_1==Identifier) ) {
+                        int LA65_2 = input.LA(3);
+
+                        if ( (synpred85()) ) {
+                            alt65=1;
+                        }
+
+
+                    }
+
+
+                }
+
+
+                switch (alt65) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:16: '.' Identifier
+            	    {
+            	    match(input,28,FOLLOW_28_in_packageOrTypeName1389); if (failed) return ;
+            	    match(input,Identifier,FOLLOW_Identifier_in_packageOrTypeName1391); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop65;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 47, packageOrTypeName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end packageOrTypeName
+
+
+    // $ANTLR start enumConstantName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:462:1: enumConstantName : Identifier ;
+    public final void enumConstantName() throws RecognitionException {
+        int enumConstantName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 48) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:463:5: ( Identifier )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:463:9: Identifier
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_enumConstantName1409); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 48, enumConstantName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end enumConstantName
+
+
+    // $ANTLR start typeName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:466:1: typeName : ( Identifier | packageOrTypeName '.' Identifier );
+    public final void typeName() throws RecognitionException {
+        int typeName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 49) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:467:2: ( Identifier | packageOrTypeName '.' Identifier )
+            int alt66=2;
+            int LA66_0 = input.LA(1);
+
+            if ( (LA66_0==Identifier) ) {
+                int LA66_1 = input.LA(2);
+
+                if ( (LA66_1==EOF) ) {
+                    alt66=1;
+                }
+                else if ( (LA66_1==28) ) {
+                    alt66=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("466:1: typeName : ( Identifier | packageOrTypeName '.' Identifier );", 66, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("466:1: typeName : ( Identifier | packageOrTypeName '.' Identifier );", 66, 0, input);
+
+                throw nvae;
+            }
+            switch (alt66) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:467:6: Identifier
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_typeName1425); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:468:9: packageOrTypeName '.' Identifier
+                    {
+                    pushFollow(FOLLOW_packageOrTypeName_in_typeName1435);
+                    packageOrTypeName();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,28,FOLLOW_28_in_typeName1437); if (failed) return ;
+                    match(input,Identifier,FOLLOW_Identifier_in_typeName1439); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 49, typeName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeName
+
+    public static class type_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start type
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:471:1: type : ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* ( '[' ']' )* | primitiveType ( '[' ']' )* );
+    public final type_return type() throws RecognitionException {
+        type_return retval = new type_return();
+        retval.start = input.LT(1);
+        int type_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 50) ) { return retval; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:2: ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* ( '[' ']' )* | primitiveType ( '[' ']' )* )
+            int alt72=2;
+            int LA72_0 = input.LA(1);
+
+            if ( (LA72_0==Identifier) ) {
+                alt72=1;
+            }
+            else if ( ((LA72_0>=55 && LA72_0<=62)) ) {
+                alt72=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("471:1: type : ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* ( '[' ']' )* | primitiveType ( '[' ']' )* );", 72, 0, input);
+
+                throw nvae;
+            }
+            switch (alt72) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:4: Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* ( '[' ']' )*
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_type1450); if (failed) return retval;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:15: ( typeArguments )?
+                    int alt67=2;
+                    int LA67_0 = input.LA(1);
+
+                    if ( (LA67_0==33) ) {
+                        int LA67_1 = input.LA(2);
+
+                        if ( (LA67_1==Identifier||(LA67_1>=55 && LA67_1<=63)) ) {
+                            alt67=1;
+                        }
+                    }
+                    switch (alt67) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:16: typeArguments
+                            {
+                            pushFollow(FOLLOW_typeArguments_in_type1453);
+                            typeArguments();
+                            _fsp--;
+                            if (failed) return retval;
+
+                            }
+                            break;
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:32: ( '.' Identifier ( typeArguments )? )*
+                    loop69:
+                    do {
+                        int alt69=2;
+                        int LA69_0 = input.LA(1);
+
+                        if ( (LA69_0==28) ) {
+                            alt69=1;
+                        }
+
+
+                        switch (alt69) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:33: '.' Identifier ( typeArguments )?
+                    	    {
+                    	    match(input,28,FOLLOW_28_in_type1458); if (failed) return retval;
+                    	    match(input,Identifier,FOLLOW_Identifier_in_type1460); if (failed) return retval;
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:48: ( typeArguments )?
+                    	    int alt68=2;
+                    	    int LA68_0 = input.LA(1);
+
+                    	    if ( (LA68_0==33) ) {
+                    	        int LA68_1 = input.LA(2);
+
+                    	        if ( (LA68_1==Identifier||(LA68_1>=55 && LA68_1<=63)) ) {
+                    	            alt68=1;
+                    	        }
+                    	    }
+                    	    switch (alt68) {
+                    	        case 1 :
+                    	            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:49: typeArguments
+                    	            {
+                    	            pushFollow(FOLLOW_typeArguments_in_type1463);
+                    	            typeArguments();
+                    	            _fsp--;
+                    	            if (failed) return retval;
+
+                    	            }
+                    	            break;
+
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop69;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:68: ( '[' ']' )*
+                    loop70:
+                    do {
+                        int alt70=2;
+                        int LA70_0 = input.LA(1);
+
+                        if ( (LA70_0==41) ) {
+                            alt70=1;
+                        }
+
+
+                        switch (alt70) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:472:69: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_type1471); if (failed) return retval;
+                    	    match(input,42,FOLLOW_42_in_type1473); if (failed) return retval;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop70;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:473:4: primitiveType ( '[' ']' )*
+                    {
+                    pushFollow(FOLLOW_primitiveType_in_type1480);
+                    primitiveType();
+                    _fsp--;
+                    if (failed) return retval;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:473:18: ( '[' ']' )*
+                    loop71:
+                    do {
+                        int alt71=2;
+                        int LA71_0 = input.LA(1);
+
+                        if ( (LA71_0==41) ) {
+                            alt71=1;
+                        }
+
+
+                        switch (alt71) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:473:19: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_type1483); if (failed) return retval;
+                    	    match(input,42,FOLLOW_42_in_type1485); if (failed) return retval;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop71;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 50, type_StartIndex); }
+        }
+        return retval;
+    }
+    // $ANTLR end type
+
+
+    // $ANTLR start primitiveType
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:476:1: primitiveType : ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' );
+    public final void primitiveType() throws RecognitionException {
+        int primitiveType_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 51) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:477:5: ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            {
+            if ( (input.LA(1)>=55 && input.LA(1)<=62) ) {
+                input.consume();
+                errorRecovery=false;failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_primitiveType0);    throw mse;
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 51, primitiveType_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end primitiveType
+
+    public static class variableModifier_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start variableModifier
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:487:1: variableModifier : ( 'final' | annotation );
+    public final variableModifier_return variableModifier() throws RecognitionException {
+        variableModifier_return retval = new variableModifier_return();
+        retval.start = input.LT(1);
+        int variableModifier_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 52) ) { return retval; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:488:2: ( 'final' | annotation )
+            int alt73=2;
+            int LA73_0 = input.LA(1);
+
+            if ( (LA73_0==49) ) {
+                alt73=1;
+            }
+            else if ( (LA73_0==71) ) {
+                alt73=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("487:1: variableModifier : ( 'final' | annotation );", 73, 0, input);
+
+                throw nvae;
+            }
+            switch (alt73) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:488:4: 'final'
+                    {
+                    match(input,49,FOLLOW_49_in_variableModifier1573); if (failed) return retval;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:489:9: annotation
+                    {
+                    pushFollow(FOLLOW_annotation_in_variableModifier1583);
+                    annotation();
+                    _fsp--;
+                    if (failed) return retval;
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 52, variableModifier_StartIndex); }
+        }
+        return retval;
+    }
+    // $ANTLR end variableModifier
+
+
+    // $ANTLR start typeArguments
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:492:1: typeArguments : '<' typeArgument ( ',' typeArgument )* '>' ;
+    public final void typeArguments() throws RecognitionException {
+        int typeArguments_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 53) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:493:2: ( '<' typeArgument ( ',' typeArgument )* '>' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:493:4: '<' typeArgument ( ',' typeArgument )* '>'
+            {
+            match(input,33,FOLLOW_33_in_typeArguments1594); if (failed) return ;
+            pushFollow(FOLLOW_typeArgument_in_typeArguments1596);
+            typeArgument();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:493:21: ( ',' typeArgument )*
+            loop74:
+            do {
+                int alt74=2;
+                int LA74_0 = input.LA(1);
+
+                if ( (LA74_0==34) ) {
+                    alt74=1;
+                }
+
+
+                switch (alt74) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:493:22: ',' typeArgument
+            	    {
+            	    match(input,34,FOLLOW_34_in_typeArguments1599); if (failed) return ;
+            	    pushFollow(FOLLOW_typeArgument_in_typeArguments1601);
+            	    typeArgument();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop74;
+                }
+            } while (true);
+
+            match(input,35,FOLLOW_35_in_typeArguments1605); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 53, typeArguments_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeArguments
+
+
+    // $ANTLR start typeArgument
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:496:1: typeArgument : ( type | '?' ( ( 'extends' | 'super' ) type )? );
+    public final void typeArgument() throws RecognitionException {
+        int typeArgument_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 54) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:497:2: ( type | '?' ( ( 'extends' | 'super' ) type )? )
+            int alt76=2;
+            int LA76_0 = input.LA(1);
+
+            if ( (LA76_0==Identifier||(LA76_0>=55 && LA76_0<=62)) ) {
+                alt76=1;
+            }
+            else if ( (LA76_0==63) ) {
+                alt76=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("496:1: typeArgument : ( type | '?' ( ( 'extends' | 'super' ) type )? );", 76, 0, input);
+
+                throw nvae;
+            }
+            switch (alt76) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:497:4: type
+                    {
+                    pushFollow(FOLLOW_type_in_typeArgument1617);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:498:4: '?' ( ( 'extends' | 'super' ) type )?
+                    {
+                    match(input,63,FOLLOW_63_in_typeArgument1622); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:498:8: ( ( 'extends' | 'super' ) type )?
+                    int alt75=2;
+                    int LA75_0 = input.LA(1);
+
+                    if ( (LA75_0==31||LA75_0==64) ) {
+                        alt75=1;
+                    }
+                    switch (alt75) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:498:9: ( 'extends' | 'super' ) type
+                            {
+                            if ( input.LA(1)==31||input.LA(1)==64 ) {
+                                input.consume();
+                                errorRecovery=false;failed=false;
+                            }
+                            else {
+                                if (backtracking>0) {failed=true; return ;}
+                                MismatchedSetException mse =
+                                    new MismatchedSetException(null,input);
+                                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_typeArgument1625);    throw mse;
+                            }
+
+                            pushFollow(FOLLOW_type_in_typeArgument1633);
+                            type();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 54, typeArgument_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end typeArgument
+
+
+    // $ANTLR start qualifiedNameList
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:501:1: qualifiedNameList : qualifiedName ( ',' qualifiedName )* ;
+    public final void qualifiedNameList() throws RecognitionException {
+        int qualifiedNameList_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 55) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:502:2: ( qualifiedName ( ',' qualifiedName )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:502:4: qualifiedName ( ',' qualifiedName )*
+            {
+            pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList1647);
+            qualifiedName();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:502:18: ( ',' qualifiedName )*
+            loop77:
+            do {
+                int alt77=2;
+                int LA77_0 = input.LA(1);
+
+                if ( (LA77_0==34) ) {
+                    alt77=1;
+                }
+
+
+                switch (alt77) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:502:19: ',' qualifiedName
+            	    {
+            	    match(input,34,FOLLOW_34_in_qualifiedNameList1650); if (failed) return ;
+            	    pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList1652);
+            	    qualifiedName();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop77;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 55, qualifiedNameList_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end qualifiedNameList
+
+
+    // $ANTLR start formalParameters
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:505:1: formalParameters : '(' ( formalParameterDecls )? ')' ;
+    public final void formalParameters() throws RecognitionException {
+        int formalParameters_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 56) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:506:2: ( '(' ( formalParameterDecls )? ')' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:506:4: '(' ( formalParameterDecls )? ')'
+            {
+            match(input,65,FOLLOW_65_in_formalParameters1666); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:506:8: ( formalParameterDecls )?
+            int alt78=2;
+            int LA78_0 = input.LA(1);
+
+            if ( (LA78_0==Identifier||LA78_0==49||(LA78_0>=55 && LA78_0<=62)||LA78_0==71) ) {
+                alt78=1;
+            }
+            switch (alt78) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: formalParameterDecls
+                    {
+                    pushFollow(FOLLOW_formalParameterDecls_in_formalParameters1668);
+                    formalParameterDecls();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,66,FOLLOW_66_in_formalParameters1671); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 56, formalParameters_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end formalParameters
+
+
+    // $ANTLR start formalParameterDecls
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:509:1: formalParameterDecls : ( variableModifier )* type ( formalParameterDeclsRest )? ;
+    public final void formalParameterDecls() throws RecognitionException {
+        int formalParameterDecls_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 57) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:510:2: ( ( variableModifier )* type ( formalParameterDeclsRest )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:510:4: ( variableModifier )* type ( formalParameterDeclsRest )?
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:510:4: ( variableModifier )*
+            loop79:
+            do {
+                int alt79=2;
+                int LA79_0 = input.LA(1);
+
+                if ( (LA79_0==49||LA79_0==71) ) {
+                    alt79=1;
+                }
+
+
+                switch (alt79) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: variableModifier
+            	    {
+            	    pushFollow(FOLLOW_variableModifier_in_formalParameterDecls1683);
+            	    variableModifier();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop79;
+                }
+            } while (true);
+
+            pushFollow(FOLLOW_type_in_formalParameterDecls1686);
+            type();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:510:27: ( formalParameterDeclsRest )?
+            int alt80=2;
+            int LA80_0 = input.LA(1);
+
+            if ( (LA80_0==Identifier||LA80_0==67) ) {
+                alt80=1;
+            }
+            switch (alt80) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: formalParameterDeclsRest
+                    {
+                    pushFollow(FOLLOW_formalParameterDeclsRest_in_formalParameterDecls1688);
+                    formalParameterDeclsRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 57, formalParameterDecls_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end formalParameterDecls
+
+
+    // $ANTLR start formalParameterDeclsRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:513:1: formalParameterDeclsRest : ( variableDeclaratorId ( ',' formalParameterDecls )? | '...' variableDeclaratorId );
+    public final void formalParameterDeclsRest() throws RecognitionException {
+        int formalParameterDeclsRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 58) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:514:2: ( variableDeclaratorId ( ',' formalParameterDecls )? | '...' variableDeclaratorId )
+            int alt82=2;
+            int LA82_0 = input.LA(1);
+
+            if ( (LA82_0==Identifier) ) {
+                alt82=1;
+            }
+            else if ( (LA82_0==67) ) {
+                alt82=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("513:1: formalParameterDeclsRest : ( variableDeclaratorId ( ',' formalParameterDecls )? | '...' variableDeclaratorId );", 82, 0, input);
+
+                throw nvae;
+            }
+            switch (alt82) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:514:4: variableDeclaratorId ( ',' formalParameterDecls )?
+                    {
+                    pushFollow(FOLLOW_variableDeclaratorId_in_formalParameterDeclsRest1701);
+                    variableDeclaratorId();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:514:25: ( ',' formalParameterDecls )?
+                    int alt81=2;
+                    int LA81_0 = input.LA(1);
+
+                    if ( (LA81_0==34) ) {
+                        alt81=1;
+                    }
+                    switch (alt81) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:514:26: ',' formalParameterDecls
+                            {
+                            match(input,34,FOLLOW_34_in_formalParameterDeclsRest1704); if (failed) return ;
+                            pushFollow(FOLLOW_formalParameterDecls_in_formalParameterDeclsRest1706);
+                            formalParameterDecls();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:515:6: '...' variableDeclaratorId
+                    {
+                    match(input,67,FOLLOW_67_in_formalParameterDeclsRest1715); if (failed) return ;
+                    pushFollow(FOLLOW_variableDeclaratorId_in_formalParameterDeclsRest1717);
+                    variableDeclaratorId();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 58, formalParameterDeclsRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end formalParameterDeclsRest
+
+
+    // $ANTLR start methodBody
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:518:1: methodBody : block ;
+    public final void methodBody() throws RecognitionException {
+        int methodBody_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 59) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:519:2: ( block )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:519:4: block
+            {
+            pushFollow(FOLLOW_block_in_methodBody1729);
+            block();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 59, methodBody_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end methodBody
+
+
+    // $ANTLR start qualifiedName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:522:1: qualifiedName : Identifier ( '.' Identifier )* ;
+    public final void qualifiedName() throws RecognitionException {
+        int qualifiedName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 60) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:523:2: ( Identifier ( '.' Identifier )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:523:4: Identifier ( '.' Identifier )*
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_qualifiedName1740); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:523:15: ( '.' Identifier )*
+            loop83:
+            do {
+                int alt83=2;
+                int LA83_0 = input.LA(1);
+
+                if ( (LA83_0==28) ) {
+                    alt83=1;
+                }
+
+
+                switch (alt83) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:523:16: '.' Identifier
+            	    {
+            	    match(input,28,FOLLOW_28_in_qualifiedName1743); if (failed) return ;
+            	    match(input,Identifier,FOLLOW_Identifier_in_qualifiedName1745); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop83;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 60, qualifiedName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end qualifiedName
+
+
+    // $ANTLR start literal
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:526:1: literal : ( integerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' );
+    public final void literal() throws RecognitionException {
+        int literal_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 61) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:527:2: ( integerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' )
+            int alt84=6;
+            switch ( input.LA(1) ) {
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+                {
+                alt84=1;
+                }
+                break;
+            case FloatingPointLiteral:
+                {
+                alt84=2;
+                }
+                break;
+            case CharacterLiteral:
+                {
+                alt84=3;
+                }
+                break;
+            case StringLiteral:
+                {
+                alt84=4;
+                }
+                break;
+            case 69:
+            case 70:
+                {
+                alt84=5;
+                }
+                break;
+            case 68:
+                {
+                alt84=6;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("526:1: literal : ( integerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' );", 84, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt84) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:527:6: integerLiteral
+                    {
+                    pushFollow(FOLLOW_integerLiteral_in_literal1762);
+                    integerLiteral();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:528:9: FloatingPointLiteral
+                    {
+                    match(input,FloatingPointLiteral,FOLLOW_FloatingPointLiteral_in_literal1772); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:529:9: CharacterLiteral
+                    {
+                    match(input,CharacterLiteral,FOLLOW_CharacterLiteral_in_literal1782); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:530:9: StringLiteral
+                    {
+                    match(input,StringLiteral,FOLLOW_StringLiteral_in_literal1792); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:531:9: booleanLiteral
+                    {
+                    pushFollow(FOLLOW_booleanLiteral_in_literal1802);
+                    booleanLiteral();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:532:9: 'null'
+                    {
+                    match(input,68,FOLLOW_68_in_literal1812); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 61, literal_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end literal
+
+
+    // $ANTLR start integerLiteral
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:535:1: integerLiteral : ( HexLiteral | OctalLiteral | DecimalLiteral );
+    public final void integerLiteral() throws RecognitionException {
+        int integerLiteral_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 62) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:536:5: ( HexLiteral | OctalLiteral | DecimalLiteral )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            {
+            if ( (input.LA(1)>=HexLiteral && input.LA(1)<=DecimalLiteral) ) {
+                input.consume();
+                errorRecovery=false;failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_integerLiteral0);    throw mse;
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 62, integerLiteral_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end integerLiteral
+
+
+    // $ANTLR start booleanLiteral
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:541:1: booleanLiteral : ( 'true' | 'false' );
+    public final void booleanLiteral() throws RecognitionException {
+        int booleanLiteral_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 63) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:542:5: ( 'true' | 'false' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+            {
+            if ( (input.LA(1)>=69 && input.LA(1)<=70) ) {
+                input.consume();
+                errorRecovery=false;failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_booleanLiteral0);    throw mse;
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 63, booleanLiteral_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end booleanLiteral
+
+
+    // $ANTLR start annotations
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:548:1: annotations : ( annotation )+ ;
+    public final void annotations() throws RecognitionException {
+        int annotations_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 64) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:549:2: ( ( annotation )+ )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:549:4: ( annotation )+
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:549:4: ( annotation )+
+            int cnt85=0;
+            loop85:
+            do {
+                int alt85=2;
+                int LA85_0 = input.LA(1);
+
+                if ( (LA85_0==71) ) {
+                    int LA85_3 = input.LA(2);
+
+                    if ( (LA85_3==Identifier) ) {
+                        int LA85_22 = input.LA(3);
+
+                        if ( (synpred120()) ) {
+                            alt85=1;
+                        }
+
+
+                    }
+
+
+                }
+
+
+                switch (alt85) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: annotation
+            	    {
+            	    pushFollow(FOLLOW_annotation_in_annotations1893);
+            	    annotation();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt85 >= 1 ) break loop85;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(85, input);
+                        throw eee;
+                }
+                cnt85++;
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 64, annotations_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotations
+
+
+    // $ANTLR start annotation
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:552:1: annotation : '@' annotationName ( '(' ( elementValuePairs )? ')' )? ;
+    public final void annotation() throws RecognitionException {
+        int annotation_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 65) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:553:2: ( '@' annotationName ( '(' ( elementValuePairs )? ')' )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:553:4: '@' annotationName ( '(' ( elementValuePairs )? ')' )?
+            {
+            match(input,71,FOLLOW_71_in_annotation1905); if (failed) return ;
+            pushFollow(FOLLOW_annotationName_in_annotation1907);
+            annotationName();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:553:23: ( '(' ( elementValuePairs )? ')' )?
+            int alt87=2;
+            int LA87_0 = input.LA(1);
+
+            if ( (LA87_0==65) ) {
+                alt87=1;
+            }
+            switch (alt87) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:553:24: '(' ( elementValuePairs )? ')'
+                    {
+                    match(input,65,FOLLOW_65_in_annotation1910); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:553:28: ( elementValuePairs )?
+                    int alt86=2;
+                    int LA86_0 = input.LA(1);
+
+                    if ( (LA86_0==Identifier||(LA86_0>=FloatingPointLiteral && LA86_0<=DecimalLiteral)||LA86_0==33||LA86_0==37||LA86_0==40||(LA86_0>=55 && LA86_0<=62)||(LA86_0>=64 && LA86_0<=65)||(LA86_0>=68 && LA86_0<=71)||(LA86_0>=105 && LA86_0<=106)||(LA86_0>=109 && LA86_0<=114)) ) {
+                        alt86=1;
+                    }
+                    switch (alt86) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: elementValuePairs
+                            {
+                            pushFollow(FOLLOW_elementValuePairs_in_annotation1912);
+                            elementValuePairs();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,66,FOLLOW_66_in_annotation1915); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 65, annotation_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotation
+
+
+    // $ANTLR start annotationName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:556:1: annotationName : Identifier ( '.' Identifier )* ;
+    public final void annotationName() throws RecognitionException {
+        int annotationName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 66) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:557:2: ( Identifier ( '.' Identifier )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:557:4: Identifier ( '.' Identifier )*
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_annotationName1929); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:557:15: ( '.' Identifier )*
+            loop88:
+            do {
+                int alt88=2;
+                int LA88_0 = input.LA(1);
+
+                if ( (LA88_0==28) ) {
+                    alt88=1;
+                }
+
+
+                switch (alt88) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:557:16: '.' Identifier
+            	    {
+            	    match(input,28,FOLLOW_28_in_annotationName1932); if (failed) return ;
+            	    match(input,Identifier,FOLLOW_Identifier_in_annotationName1934); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop88;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 66, annotationName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationName
+
+
+    // $ANTLR start elementValuePairs
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:560:1: elementValuePairs : elementValuePair ( ',' elementValuePair )* ;
+    public final void elementValuePairs() throws RecognitionException {
+        int elementValuePairs_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 67) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:561:2: ( elementValuePair ( ',' elementValuePair )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:561:4: elementValuePair ( ',' elementValuePair )*
+            {
+            pushFollow(FOLLOW_elementValuePair_in_elementValuePairs1948);
+            elementValuePair();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:561:21: ( ',' elementValuePair )*
+            loop89:
+            do {
+                int alt89=2;
+                int LA89_0 = input.LA(1);
+
+                if ( (LA89_0==34) ) {
+                    alt89=1;
+                }
+
+
+                switch (alt89) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:561:22: ',' elementValuePair
+            	    {
+            	    match(input,34,FOLLOW_34_in_elementValuePairs1951); if (failed) return ;
+            	    pushFollow(FOLLOW_elementValuePair_in_elementValuePairs1953);
+            	    elementValuePair();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop89;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 67, elementValuePairs_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end elementValuePairs
+
+
+    // $ANTLR start elementValuePair
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:564:1: elementValuePair : ( Identifier '=' )? elementValue ;
+    public final void elementValuePair() throws RecognitionException {
+        int elementValuePair_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 68) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:565:2: ( ( Identifier '=' )? elementValue )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:565:4: ( Identifier '=' )? elementValue
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:565:4: ( Identifier '=' )?
+            int alt90=2;
+            int LA90_0 = input.LA(1);
+
+            if ( (LA90_0==Identifier) ) {
+                int LA90_1 = input.LA(2);
+
+                if ( (LA90_1==44) ) {
+                    alt90=1;
+                }
+            }
+            switch (alt90) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:565:5: Identifier '='
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_elementValuePair1968); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_elementValuePair1970); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_elementValue_in_elementValuePair1974);
+            elementValue();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 68, elementValuePair_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end elementValuePair
+
+
+    // $ANTLR start elementValue
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:568:1: elementValue : ( conditionalExpression | annotation | elementValueArrayInitializer );
+    public final void elementValue() throws RecognitionException {
+        int elementValue_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 69) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:569:2: ( conditionalExpression | annotation | elementValueArrayInitializer )
+            int alt91=3;
+            switch ( input.LA(1) ) {
+            case Identifier:
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 33:
+            case 40:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 105:
+            case 106:
+            case 109:
+            case 110:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt91=1;
+                }
+                break;
+            case 71:
+                {
+                alt91=2;
+                }
+                break;
+            case 37:
+                {
+                alt91=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("568:1: elementValue : ( conditionalExpression | annotation | elementValueArrayInitializer );", 91, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt91) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:569:4: conditionalExpression
+                    {
+                    pushFollow(FOLLOW_conditionalExpression_in_elementValue1986);
+                    conditionalExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:570:6: annotation
+                    {
+                    pushFollow(FOLLOW_annotation_in_elementValue1993);
+                    annotation();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:571:6: elementValueArrayInitializer
+                    {
+                    pushFollow(FOLLOW_elementValueArrayInitializer_in_elementValue2000);
+                    elementValueArrayInitializer();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 69, elementValue_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end elementValue
+
+
+    // $ANTLR start elementValueArrayInitializer
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:574:1: elementValueArrayInitializer : '{' ( elementValue ( ',' elementValue )* )? '}' ;
+    public final void elementValueArrayInitializer() throws RecognitionException {
+        int elementValueArrayInitializer_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 70) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:2: ( '{' ( elementValue ( ',' elementValue )* )? '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:4: '{' ( elementValue ( ',' elementValue )* )? '}'
+            {
+            match(input,37,FOLLOW_37_in_elementValueArrayInitializer2012); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:8: ( elementValue ( ',' elementValue )* )?
+            int alt93=2;
+            int LA93_0 = input.LA(1);
+
+            if ( (LA93_0==Identifier||(LA93_0>=FloatingPointLiteral && LA93_0<=DecimalLiteral)||LA93_0==33||LA93_0==37||LA93_0==40||(LA93_0>=55 && LA93_0<=62)||(LA93_0>=64 && LA93_0<=65)||(LA93_0>=68 && LA93_0<=71)||(LA93_0>=105 && LA93_0<=106)||(LA93_0>=109 && LA93_0<=114)) ) {
+                alt93=1;
+            }
+            switch (alt93) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:9: elementValue ( ',' elementValue )*
+                    {
+                    pushFollow(FOLLOW_elementValue_in_elementValueArrayInitializer2015);
+                    elementValue();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:22: ( ',' elementValue )*
+                    loop92:
+                    do {
+                        int alt92=2;
+                        int LA92_0 = input.LA(1);
+
+                        if ( (LA92_0==34) ) {
+                            alt92=1;
+                        }
+
+
+                        switch (alt92) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:575:23: ',' elementValue
+                    	    {
+                    	    match(input,34,FOLLOW_34_in_elementValueArrayInitializer2018); if (failed) return ;
+                    	    pushFollow(FOLLOW_elementValue_in_elementValueArrayInitializer2020);
+                    	    elementValue();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop92;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+            match(input,38,FOLLOW_38_in_elementValueArrayInitializer2027); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 70, elementValueArrayInitializer_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end elementValueArrayInitializer
+
+
+    // $ANTLR start annotationTypeDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:578:1: annotationTypeDeclaration : '@' 'interface' Identifier annotationTypeBody ;
+    public final void annotationTypeDeclaration() throws RecognitionException {
+        int annotationTypeDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 71) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:579:2: ( '@' 'interface' Identifier annotationTypeBody )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:579:4: '@' 'interface' Identifier annotationTypeBody
+            {
+            match(input,71,FOLLOW_71_in_annotationTypeDeclaration2039); if (failed) return ;
+            match(input,39,FOLLOW_39_in_annotationTypeDeclaration2041); if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_annotationTypeDeclaration2043); if (failed) return ;
+            pushFollow(FOLLOW_annotationTypeBody_in_annotationTypeDeclaration2045);
+            annotationTypeBody();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 71, annotationTypeDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationTypeDeclaration
+
+
+    // $ANTLR start annotationTypeBody
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:582:1: annotationTypeBody : '{' ( annotationTypeElementDeclarations )? '}' ;
+    public final void annotationTypeBody() throws RecognitionException {
+        int annotationTypeBody_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 72) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:583:2: ( '{' ( annotationTypeElementDeclarations )? '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:583:4: '{' ( annotationTypeElementDeclarations )? '}'
+            {
+            match(input,37,FOLLOW_37_in_annotationTypeBody2057); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:583:8: ( annotationTypeElementDeclarations )?
+            int alt94=2;
+            int LA94_0 = input.LA(1);
+
+            if ( ((LA94_0>=Identifier && LA94_0<=ENUM)||LA94_0==27||LA94_0==30||LA94_0==39||(LA94_0>=45 && LA94_0<=62)||LA94_0==71) ) {
+                alt94=1;
+            }
+            switch (alt94) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:583:9: annotationTypeElementDeclarations
+                    {
+                    pushFollow(FOLLOW_annotationTypeElementDeclarations_in_annotationTypeBody2060);
+                    annotationTypeElementDeclarations();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,38,FOLLOW_38_in_annotationTypeBody2064); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 72, annotationTypeBody_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationTypeBody
+
+
+    // $ANTLR start annotationTypeElementDeclarations
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:586:1: annotationTypeElementDeclarations : ( annotationTypeElementDeclaration ) ( annotationTypeElementDeclaration )* ;
+    public final void annotationTypeElementDeclarations() throws RecognitionException {
+        int annotationTypeElementDeclarations_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 73) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:2: ( ( annotationTypeElementDeclaration ) ( annotationTypeElementDeclaration )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:4: ( annotationTypeElementDeclaration ) ( annotationTypeElementDeclaration )*
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:4: ( annotationTypeElementDeclaration )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:5: annotationTypeElementDeclaration
+            {
+            pushFollow(FOLLOW_annotationTypeElementDeclaration_in_annotationTypeElementDeclarations2077);
+            annotationTypeElementDeclaration();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:39: ( annotationTypeElementDeclaration )*
+            loop95:
+            do {
+                int alt95=2;
+                int LA95_0 = input.LA(1);
+
+                if ( ((LA95_0>=Identifier && LA95_0<=ENUM)||LA95_0==27||LA95_0==30||LA95_0==39||(LA95_0>=45 && LA95_0<=62)||LA95_0==71) ) {
+                    alt95=1;
+                }
+
+
+                switch (alt95) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:587:40: annotationTypeElementDeclaration
+            	    {
+            	    pushFollow(FOLLOW_annotationTypeElementDeclaration_in_annotationTypeElementDeclarations2081);
+            	    annotationTypeElementDeclaration();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop95;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 73, annotationTypeElementDeclarations_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationTypeElementDeclarations
+
+
+    // $ANTLR start annotationTypeElementDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:590:1: annotationTypeElementDeclaration : ( modifier )* annotationTypeElementRest ;
+    public final void annotationTypeElementDeclaration() throws RecognitionException {
+        int annotationTypeElementDeclaration_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 74) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:591:2: ( ( modifier )* annotationTypeElementRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:591:4: ( modifier )* annotationTypeElementRest
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:591:4: ( modifier )*
+            loop96:
+            do {
+                int alt96=2;
+                int LA96_0 = input.LA(1);
+
+                if ( (LA96_0==71) ) {
+                    int LA96_6 = input.LA(2);
+
+                    if ( (LA96_6==Identifier) ) {
+                        alt96=1;
+                    }
+
+
+                }
+                else if ( (LA96_0==27||(LA96_0>=45 && LA96_0<=54)) ) {
+                    alt96=1;
+                }
+
+
+                switch (alt96) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:591:5: modifier
+            	    {
+            	    pushFollow(FOLLOW_modifier_in_annotationTypeElementDeclaration2096);
+            	    modifier();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop96;
+                }
+            } while (true);
+
+            pushFollow(FOLLOW_annotationTypeElementRest_in_annotationTypeElementDeclaration2100);
+            annotationTypeElementRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 74, annotationTypeElementDeclaration_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationTypeElementDeclaration
+
+
+    // $ANTLR start annotationTypeElementRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );
+    public final void annotationTypeElementRest() throws RecognitionException {
+        int annotationTypeElementRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 75) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:595:2: ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? )
+            int alt101=5;
+            switch ( input.LA(1) ) {
+            case Identifier:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                alt101=1;
+                }
+                break;
+            case 30:
+                {
+                alt101=2;
+                }
+                break;
+            case ENUM:
+                {
+                int LA101_4 = input.LA(2);
+
+                if ( (LA101_4==Identifier) ) {
+                    int LA101_7 = input.LA(3);
+
+                    if ( (synpred135()) ) {
+                        alt101=2;
+                    }
+                    else if ( (synpred139()) ) {
+                        alt101=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );", 101, 7, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );", 101, 4, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case 39:
+                {
+                alt101=3;
+                }
+                break;
+            case 71:
+                {
+                int LA101_6 = input.LA(2);
+
+                if ( (LA101_6==39) ) {
+                    int LA101_8 = input.LA(3);
+
+                    if ( (synpred137()) ) {
+                        alt101=3;
+                    }
+                    else if ( (true) ) {
+                        alt101=5;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );", 101, 8, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );", 101, 6, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("594:1: annotationTypeElementRest : ( type annotationMethodOrConstantRest ';' | classDeclaration ( ';' )? | interfaceDeclaration ( ';' )? | enumDeclaration ( ';' )? | annotationTypeDeclaration ( ';' )? );", 101, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt101) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:595:4: type annotationMethodOrConstantRest ';'
+                    {
+                    pushFollow(FOLLOW_type_in_annotationTypeElementRest2112);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+                    pushFollow(FOLLOW_annotationMethodOrConstantRest_in_annotationTypeElementRest2114);
+                    annotationMethodOrConstantRest();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,25,FOLLOW_25_in_annotationTypeElementRest2116); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:596:6: classDeclaration ( ';' )?
+                    {
+                    pushFollow(FOLLOW_classDeclaration_in_annotationTypeElementRest2123);
+                    classDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:596:23: ( ';' )?
+                    int alt97=2;
+                    int LA97_0 = input.LA(1);
+
+                    if ( (LA97_0==25) ) {
+                        alt97=1;
+                    }
+                    switch (alt97) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                            {
+                            match(input,25,FOLLOW_25_in_annotationTypeElementRest2125); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:597:6: interfaceDeclaration ( ';' )?
+                    {
+                    pushFollow(FOLLOW_interfaceDeclaration_in_annotationTypeElementRest2133);
+                    interfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:597:27: ( ';' )?
+                    int alt98=2;
+                    int LA98_0 = input.LA(1);
+
+                    if ( (LA98_0==25) ) {
+                        alt98=1;
+                    }
+                    switch (alt98) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                            {
+                            match(input,25,FOLLOW_25_in_annotationTypeElementRest2135); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:598:6: enumDeclaration ( ';' )?
+                    {
+                    pushFollow(FOLLOW_enumDeclaration_in_annotationTypeElementRest2143);
+                    enumDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:598:22: ( ';' )?
+                    int alt99=2;
+                    int LA99_0 = input.LA(1);
+
+                    if ( (LA99_0==25) ) {
+                        alt99=1;
+                    }
+                    switch (alt99) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                            {
+                            match(input,25,FOLLOW_25_in_annotationTypeElementRest2145); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:599:6: annotationTypeDeclaration ( ';' )?
+                    {
+                    pushFollow(FOLLOW_annotationTypeDeclaration_in_annotationTypeElementRest2153);
+                    annotationTypeDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:599:32: ( ';' )?
+                    int alt100=2;
+                    int LA100_0 = input.LA(1);
+
+                    if ( (LA100_0==25) ) {
+                        alt100=1;
+                    }
+                    switch (alt100) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                            {
+                            match(input,25,FOLLOW_25_in_annotationTypeElementRest2155); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 75, annotationTypeElementRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationTypeElementRest
+
+
+    // $ANTLR start annotationMethodOrConstantRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:602:1: annotationMethodOrConstantRest : ( annotationMethodRest | annotationConstantRest );
+    public final void annotationMethodOrConstantRest() throws RecognitionException {
+        int annotationMethodOrConstantRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 76) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:603:2: ( annotationMethodRest | annotationConstantRest )
+            int alt102=2;
+            int LA102_0 = input.LA(1);
+
+            if ( (LA102_0==Identifier) ) {
+                int LA102_1 = input.LA(2);
+
+                if ( (LA102_1==65) ) {
+                    alt102=1;
+                }
+                else if ( (LA102_1==25||LA102_1==34||LA102_1==41||LA102_1==44) ) {
+                    alt102=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("602:1: annotationMethodOrConstantRest : ( annotationMethodRest | annotationConstantRest );", 102, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("602:1: annotationMethodOrConstantRest : ( annotationMethodRest | annotationConstantRest );", 102, 0, input);
+
+                throw nvae;
+            }
+            switch (alt102) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:603:4: annotationMethodRest
+                    {
+                    pushFollow(FOLLOW_annotationMethodRest_in_annotationMethodOrConstantRest2168);
+                    annotationMethodRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:604:6: annotationConstantRest
+                    {
+                    pushFollow(FOLLOW_annotationConstantRest_in_annotationMethodOrConstantRest2175);
+                    annotationConstantRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 76, annotationMethodOrConstantRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationMethodOrConstantRest
+
+
+    // $ANTLR start annotationMethodRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:607:1: annotationMethodRest : Identifier '(' ')' ( defaultValue )? ;
+    public final void annotationMethodRest() throws RecognitionException {
+        int annotationMethodRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 77) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:608:3: ( Identifier '(' ')' ( defaultValue )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:608:5: Identifier '(' ')' ( defaultValue )?
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_annotationMethodRest2188); if (failed) return ;
+            match(input,65,FOLLOW_65_in_annotationMethodRest2190); if (failed) return ;
+            match(input,66,FOLLOW_66_in_annotationMethodRest2192); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:608:24: ( defaultValue )?
+            int alt103=2;
+            int LA103_0 = input.LA(1);
+
+            if ( (LA103_0==72) ) {
+                alt103=1;
+            }
+            switch (alt103) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:608:25: defaultValue
+                    {
+                    pushFollow(FOLLOW_defaultValue_in_annotationMethodRest2195);
+                    defaultValue();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 77, annotationMethodRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationMethodRest
+
+
+    // $ANTLR start annotationConstantRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:611:1: annotationConstantRest : variableDeclarators ;
+    public final void annotationConstantRest() throws RecognitionException {
+        int annotationConstantRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 78) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:612:3: ( variableDeclarators )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:612:5: variableDeclarators
+            {
+            pushFollow(FOLLOW_variableDeclarators_in_annotationConstantRest2212);
+            variableDeclarators();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 78, annotationConstantRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end annotationConstantRest
+
+
+    // $ANTLR start defaultValue
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:615:1: defaultValue : 'default' elementValue ;
+    public final void defaultValue() throws RecognitionException {
+        int defaultValue_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 79) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:616:3: ( 'default' elementValue )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:616:5: 'default' elementValue
+            {
+            match(input,72,FOLLOW_72_in_defaultValue2227); if (failed) return ;
+            pushFollow(FOLLOW_elementValue_in_defaultValue2229);
+            elementValue();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 79, defaultValue_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end defaultValue
+
+
+    // $ANTLR start block
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:621:1: block : '{' ( blockStatement )* '}' ;
+    public final void block() throws RecognitionException {
+        int block_StartIndex = input.index();
+
+                    this.localVariableLevel++;
+                
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 80) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:628:2: ( '{' ( blockStatement )* '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:628:4: '{' ( blockStatement )* '}'
+            {
+            match(input,37,FOLLOW_37_in_block2269); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:628:8: ( blockStatement )*
+            loop104:
+            do {
+                int alt104=2;
+                int LA104_0 = input.LA(1);
+
+                if ( ((LA104_0>=Identifier && LA104_0<=DecimalLiteral)||LA104_0==25||LA104_0==27||LA104_0==30||LA104_0==33||LA104_0==37||(LA104_0>=39 && LA104_0<=40)||(LA104_0>=45 && LA104_0<=62)||(LA104_0>=64 && LA104_0<=65)||(LA104_0>=68 && LA104_0<=71)||LA104_0==73||LA104_0==75||(LA104_0>=77 && LA104_0<=80)||(LA104_0>=82 && LA104_0<=87)||(LA104_0>=105 && LA104_0<=106)||(LA104_0>=109 && LA104_0<=114)) ) {
+                    alt104=1;
+                }
+
+
+                switch (alt104) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: blockStatement
+            	    {
+            	    pushFollow(FOLLOW_blockStatement_in_block2271);
+            	    blockStatement();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop104;
+                }
+            } while (true);
+
+            match(input,38,FOLLOW_38_in_block2274); if (failed) return ;
+
+            }
+
+            if ( backtracking==0 ) {
+
+                          this.localVariableLevel--;
+                      
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 80, block_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end block
+
+
+    // $ANTLR start blockStatement
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );
+    public final void blockStatement() throws RecognitionException {
+        int blockStatement_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 81) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:632:2: ( localVariableDeclaration | classOrInterfaceDeclaration | statement )
+            int alt105=3;
+            switch ( input.LA(1) ) {
+            case 49:
+                {
+                switch ( input.LA(2) ) {
+                case Identifier:
+                case 55:
+                case 56:
+                case 57:
+                case 58:
+                case 59:
+                case 60:
+                case 61:
+                case 62:
+                    {
+                    alt105=1;
+                    }
+                    break;
+                case 49:
+                    {
+                    int LA105_52 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (synpred145()) ) {
+                        alt105=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 52, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 71:
+                    {
+                    int LA105_53 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (synpred145()) ) {
+                        alt105=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 53, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case ENUM:
+                case 27:
+                case 30:
+                case 39:
+                case 45:
+                case 46:
+                case 47:
+                case 48:
+                case 50:
+                case 51:
+                case 52:
+                case 53:
+                case 54:
+                    {
+                    alt105=2;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 1, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 71:
+                {
+                int LA105_2 = input.LA(2);
+
+                if ( (LA105_2==39) ) {
+                    alt105=2;
+                }
+                else if ( (LA105_2==Identifier) ) {
+                    int LA105_68 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (synpred145()) ) {
+                        alt105=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 68, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case Identifier:
+                {
+                switch ( input.LA(2) ) {
+                case 25:
+                case 29:
+                case 35:
+                case 36:
+                case 44:
+                case 63:
+                case 65:
+                case 74:
+                case 90:
+                case 91:
+                case 92:
+                case 93:
+                case 94:
+                case 95:
+                case 96:
+                case 97:
+                case 98:
+                case 99:
+                case 100:
+                case 101:
+                case 102:
+                case 103:
+                case 104:
+                case 105:
+                case 106:
+                case 107:
+                case 108:
+                case 109:
+                case 110:
+                    {
+                    alt105=3;
+                    }
+                    break;
+                case 28:
+                    {
+                    int LA105_70 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (true) ) {
+                        alt105=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 70, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 41:
+                    {
+                    int LA105_71 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (true) ) {
+                        alt105=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 71, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 33:
+                    {
+                    int LA105_76 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (true) ) {
+                        alt105=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 76, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case Identifier:
+                    {
+                    alt105=1;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 3, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                switch ( input.LA(2) ) {
+                case 41:
+                    {
+                    int LA105_97 = input.LA(3);
+
+                    if ( (synpred144()) ) {
+                        alt105=1;
+                    }
+                    else if ( (true) ) {
+                        alt105=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 97, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case Identifier:
+                    {
+                    alt105=1;
+                    }
+                    break;
+                case 28:
+                    {
+                    alt105=3;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 4, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case ENUM:
+            case 27:
+            case 30:
+            case 39:
+            case 45:
+            case 46:
+            case 47:
+            case 48:
+            case 50:
+            case 52:
+            case 53:
+            case 54:
+                {
+                alt105=2;
+                }
+                break;
+            case 51:
+                {
+                int LA105_11 = input.LA(2);
+
+                if ( (LA105_11==ENUM||LA105_11==27||LA105_11==30||LA105_11==39||(LA105_11>=45 && LA105_11<=54)||LA105_11==71) ) {
+                    alt105=2;
+                }
+                else if ( (LA105_11==65) ) {
+                    alt105=3;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 11, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 25:
+            case 33:
+            case 37:
+            case 40:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 73:
+            case 75:
+            case 77:
+            case 78:
+            case 79:
+            case 80:
+            case 82:
+            case 83:
+            case 84:
+            case 85:
+            case 86:
+            case 87:
+            case 105:
+            case 106:
+            case 109:
+            case 110:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt105=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("631:1: blockStatement : ( localVariableDeclaration | classOrInterfaceDeclaration | statement );", 105, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt105) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:632:4: localVariableDeclaration
+                    {
+                    pushFollow(FOLLOW_localVariableDeclaration_in_blockStatement2286);
+                    localVariableDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:633:4: classOrInterfaceDeclaration
+                    {
+                    pushFollow(FOLLOW_classOrInterfaceDeclaration_in_blockStatement2291);
+                    classOrInterfaceDeclaration();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:634:8: statement
+                    {
+                    pushFollow(FOLLOW_statement_in_blockStatement2300);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 81, blockStatement_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end blockStatement
+
+    protected static class localVariableDeclaration_scope {
+        JavaLocalDeclarationDescr descr;
+    }
+    protected Stack localVariableDeclaration_stack = new Stack();
+
+
+    // $ANTLR start localVariableDeclaration
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:637:1: localVariableDeclaration : ( variableModifier )* type variableDeclarators ';' ;
+    public final void localVariableDeclaration() throws RecognitionException {
+        localVariableDeclaration_stack.push(new localVariableDeclaration_scope());
+        int localVariableDeclaration_StartIndex = input.index();
+        variableModifier_return variableModifier1 = null;
+
+        type_return type2 = null;
+
+
+
+                    ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr = new JavaLocalDeclarationDescr();
+                
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 82) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:647:2: ( ( variableModifier )* type variableDeclarators ';' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:648:2: ( variableModifier )* type variableDeclarators ';'
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:648:2: ( variableModifier )*
+            loop106:
+            do {
+                int alt106=2;
+                int LA106_0 = input.LA(1);
+
+                if ( (LA106_0==49||LA106_0==71) ) {
+                    alt106=1;
+                }
+
+
+                switch (alt106) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:648:4: variableModifier
+            	    {
+            	    pushFollow(FOLLOW_variableModifier_in_localVariableDeclaration2348);
+            	    variableModifier1=variableModifier();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       
+            	      	        ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.updateStart( ((CommonToken)((Token)variableModifier1.start)).getStartIndex() - 1 ); 
+            	      	        ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.addModifier( input.toString(variableModifier1.start,variableModifier1.stop) ); 
+            	      	    
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop106;
+                }
+            } while (true);
+
+            pushFollow(FOLLOW_type_in_localVariableDeclaration2365);
+            type2=type();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+               
+              	        ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.updateStart( ((CommonToken)((Token)type2.start)).getStartIndex() - 1 ); 
+              	        ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.setType( input.toString(type2.start,type2.stop) ); 
+              	        ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr.setEnd( ((CommonToken)((Token)type2.stop)).getStopIndex() ); 
+              	    
+            }
+            pushFollow(FOLLOW_variableDeclarators_in_localVariableDeclaration2376);
+            variableDeclarators();
+            _fsp--;
+            if (failed) return ;
+            match(input,25,FOLLOW_25_in_localVariableDeclaration2378); if (failed) return ;
+
+            }
+
+            if ( backtracking==0 ) {
+
+                          localDeclarations.add( ((localVariableDeclaration_scope)localVariableDeclaration_stack.peek()).descr );
+                      
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 82, localVariableDeclaration_StartIndex); }
+            localVariableDeclaration_stack.pop();
+        }
+        return ;
+    }
+    // $ANTLR end localVariableDeclaration
+
+
+    // $ANTLR start statement
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:663:1: statement : ( block | 'assert' expression ( ':' expression )? ';' | 'if' parExpression statement ( options {k=1; } : 'else' statement )? | 'for' '(' forControl ')' statement | 'while' parExpression statement | 'do' statement 'while' parExpression ';' | 'try' block ( catches 'finally' block | catches | 'finally' block ) | 'switch' parExpression '{' switchBlockStatementGroups '}' | 'synchronized' parExpression block | 'return' ( expression )? ';' | 'throw' expression ';' | 'break' ( Identifier )? ';' | 'continue' ( Identifier )? ';' | modifyStatement | ';' | statementExpression ';' | Identifier ':' statement );
+    public final void statement() throws RecognitionException {
+        int statement_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 83) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:664:2: ( block | 'assert' expression ( ':' expression )? ';' | 'if' parExpression statement ( options {k=1; } : 'else' statement )? | 'for' '(' forControl ')' statement | 'while' parExpression statement | 'do' statement 'while' parExpression ';' | 'try' block ( catches 'finally' block | catches | 'finally' block ) | 'switch' parExpression '{' switchBlockStatementGroups '}' | 'synchronized' parExpression block | 'return' ( expression )? ';' | 'throw' expression ';' | 'break' ( Identifier )? ';' | 'continue' ( Identifier )? ';' | modifyStatement | ';' | statementExpression ';' | Identifier ':' statement )
+            int alt113=17;
+            switch ( input.LA(1) ) {
+            case 37:
+                {
+                alt113=1;
+                }
+                break;
+            case 73:
+                {
+                alt113=2;
+                }
+                break;
+            case 75:
+                {
+                alt113=3;
+                }
+                break;
+            case 77:
+                {
+                alt113=4;
+                }
+                break;
+            case 78:
+                {
+                alt113=5;
+                }
+                break;
+            case 79:
+                {
+                alt113=6;
+                }
+                break;
+            case 80:
+                {
+                alt113=7;
+                }
+                break;
+            case 82:
+                {
+                alt113=8;
+                }
+                break;
+            case 51:
+                {
+                alt113=9;
+                }
+                break;
+            case 83:
+                {
+                alt113=10;
+                }
+                break;
+            case 84:
+                {
+                alt113=11;
+                }
+                break;
+            case 85:
+                {
+                alt113=12;
+                }
+                break;
+            case 86:
+                {
+                alt113=13;
+                }
+                break;
+            case 87:
+                {
+                alt113=14;
+                }
+                break;
+            case 25:
+                {
+                alt113=15;
+                }
+                break;
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 33:
+            case 40:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 105:
+            case 106:
+            case 109:
+            case 110:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt113=16;
+                }
+                break;
+            case Identifier:
+                {
+                int LA113_33 = input.LA(2);
+
+                if ( (LA113_33==74) ) {
+                    alt113=17;
+                }
+                else if ( (LA113_33==25||(LA113_33>=28 && LA113_33<=29)||LA113_33==33||(LA113_33>=35 && LA113_33<=36)||LA113_33==41||LA113_33==44||LA113_33==63||LA113_33==65||(LA113_33>=90 && LA113_33<=110)) ) {
+                    alt113=16;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("663:1: statement : ( block | 'assert' expression ( ':' expression )? ';' | 'if' parExpression statement ( options {k=1; } : 'else' statement )? | 'for' '(' forControl ')' statement | 'while' parExpression statement | 'do' statement 'while' parExpression ';' | 'try' block ( catches 'finally' block | catches | 'finally' block ) | 'switch' parExpression '{' switchBlockStatementGroups '}' | 'synchronized' parExpression block | 'return' ( expression )? ';' | 'throw' expression ';' | 'break' ( Identifier )? ';' | 'continue' ( Identifier )? ';' | modifyStatement | ';' | statementExpression ';' | Identifier ':' statement );", 113, 33, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("663:1: statement : ( block | 'assert' expression ( ':' expression )? ';' | 'if' parExpression statement ( options {k=1; } : 'else' statement )? | 'for' '(' forControl ')' statement | 'while' parExpression statement | 'do' statement 'while' parExpression ';' | 'try' block ( catches 'finally' block | catches | 'finally' block ) | 'switch' parExpression '{' switchBlockStatementGroups '}' | 'synchronized' parExpression block | 'return' ( expression )? ';' | 'throw' expression ';' | 'break' ( Identifier )? ';' | 'continue' ( Identifier )? ';' | modifyStatement | ';' | statementExpression ';' | Identifier ':' statement );", 113, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt113) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:664:4: block
+                    {
+                    pushFollow(FOLLOW_block_in_statement2390);
+                    block();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:665:7: 'assert' expression ( ':' expression )? ';'
+                    {
+                    match(input,73,FOLLOW_73_in_statement2398); if (failed) return ;
+                    pushFollow(FOLLOW_expression_in_statement2400);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:665:27: ( ':' expression )?
+                    int alt107=2;
+                    int LA107_0 = input.LA(1);
+
+                    if ( (LA107_0==74) ) {
+                        alt107=1;
+                    }
+                    switch (alt107) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:665:28: ':' expression
+                            {
+                            match(input,74,FOLLOW_74_in_statement2403); if (failed) return ;
+                            pushFollow(FOLLOW_expression_in_statement2405);
+                            expression();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_statement2409); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:666:7: 'if' parExpression statement ( options {k=1; } : 'else' statement )?
+                    {
+                    match(input,75,FOLLOW_75_in_statement2417); if (failed) return ;
+                    pushFollow(FOLLOW_parExpression_in_statement2419);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    pushFollow(FOLLOW_statement_in_statement2421);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:666:36: ( options {k=1; } : 'else' statement )?
+                    int alt108=2;
+                    int LA108_0 = input.LA(1);
+
+                    if ( (LA108_0==76) ) {
+                        int LA108_1 = input.LA(2);
+
+                        if ( (synpred150()) ) {
+                            alt108=1;
+                        }
+                    }
+                    switch (alt108) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:666:52: 'else' statement
+                            {
+                            match(input,76,FOLLOW_76_in_statement2431); if (failed) return ;
+                            pushFollow(FOLLOW_statement_in_statement2433);
+                            statement();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:667:7: 'for' '(' forControl ')' statement
+                    {
+                    match(input,77,FOLLOW_77_in_statement2443); if (failed) return ;
+                    match(input,65,FOLLOW_65_in_statement2445); if (failed) return ;
+                    pushFollow(FOLLOW_forControl_in_statement2447);
+                    forControl();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,66,FOLLOW_66_in_statement2449); if (failed) return ;
+                    pushFollow(FOLLOW_statement_in_statement2451);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:668:7: 'while' parExpression statement
+                    {
+                    match(input,78,FOLLOW_78_in_statement2459); if (failed) return ;
+                    pushFollow(FOLLOW_parExpression_in_statement2461);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    pushFollow(FOLLOW_statement_in_statement2463);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:669:7: 'do' statement 'while' parExpression ';'
+                    {
+                    match(input,79,FOLLOW_79_in_statement2471); if (failed) return ;
+                    pushFollow(FOLLOW_statement_in_statement2473);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,78,FOLLOW_78_in_statement2475); if (failed) return ;
+                    pushFollow(FOLLOW_parExpression_in_statement2477);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,25,FOLLOW_25_in_statement2479); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:670:7: 'try' block ( catches 'finally' block | catches | 'finally' block )
+                    {
+                    match(input,80,FOLLOW_80_in_statement2487); if (failed) return ;
+                    pushFollow(FOLLOW_block_in_statement2489);
+                    block();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:671:7: ( catches 'finally' block | catches | 'finally' block )
+                    int alt109=3;
+                    int LA109_0 = input.LA(1);
+
+                    if ( (LA109_0==88) ) {
+                        int LA109_1 = input.LA(2);
+
+                        if ( (LA109_1==65) ) {
+                            int LA109_3 = input.LA(3);
+
+                            if ( (synpred155()) ) {
+                                alt109=1;
+                            }
+                            else if ( (synpred156()) ) {
+                                alt109=2;
+                            }
+                            else {
+                                if (backtracking>0) {failed=true; return ;}
+                                NoViableAltException nvae =
+                                    new NoViableAltException("671:7: ( catches 'finally' block | catches | 'finally' block )", 109, 3, input);
+
+                                throw nvae;
+                            }
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("671:7: ( catches 'finally' block | catches | 'finally' block )", 109, 1, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else if ( (LA109_0==81) ) {
+                        alt109=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("671:7: ( catches 'finally' block | catches | 'finally' block )", 109, 0, input);
+
+                        throw nvae;
+                    }
+                    switch (alt109) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:671:9: catches 'finally' block
+                            {
+                            pushFollow(FOLLOW_catches_in_statement2499);
+                            catches();
+                            _fsp--;
+                            if (failed) return ;
+                            match(input,81,FOLLOW_81_in_statement2501); if (failed) return ;
+                            pushFollow(FOLLOW_block_in_statement2503);
+                            block();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+                        case 2 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:672:9: catches
+                            {
+                            pushFollow(FOLLOW_catches_in_statement2513);
+                            catches();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+                        case 3 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:673:9: 'finally' block
+                            {
+                            match(input,81,FOLLOW_81_in_statement2523); if (failed) return ;
+                            pushFollow(FOLLOW_block_in_statement2525);
+                            block();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 8 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:675:7: 'switch' parExpression '{' switchBlockStatementGroups '}'
+                    {
+                    match(input,82,FOLLOW_82_in_statement2541); if (failed) return ;
+                    pushFollow(FOLLOW_parExpression_in_statement2543);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,37,FOLLOW_37_in_statement2545); if (failed) return ;
+                    pushFollow(FOLLOW_switchBlockStatementGroups_in_statement2547);
+                    switchBlockStatementGroups();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,38,FOLLOW_38_in_statement2549); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:676:7: 'synchronized' parExpression block
+                    {
+                    match(input,51,FOLLOW_51_in_statement2557); if (failed) return ;
+                    pushFollow(FOLLOW_parExpression_in_statement2559);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    pushFollow(FOLLOW_block_in_statement2561);
+                    block();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 10 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:677:7: 'return' ( expression )? ';'
+                    {
+                    match(input,83,FOLLOW_83_in_statement2569); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:677:16: ( expression )?
+                    int alt110=2;
+                    int LA110_0 = input.LA(1);
+
+                    if ( (LA110_0==Identifier||(LA110_0>=FloatingPointLiteral && LA110_0<=DecimalLiteral)||LA110_0==33||LA110_0==40||(LA110_0>=55 && LA110_0<=62)||(LA110_0>=64 && LA110_0<=65)||(LA110_0>=68 && LA110_0<=70)||(LA110_0>=105 && LA110_0<=106)||(LA110_0>=109 && LA110_0<=114)) ) {
+                        alt110=1;
+                    }
+                    switch (alt110) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: expression
+                            {
+                            pushFollow(FOLLOW_expression_in_statement2571);
+                            expression();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_statement2574); if (failed) return ;
+
+                    }
+                    break;
+                case 11 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:678:7: 'throw' expression ';'
+                    {
+                    match(input,84,FOLLOW_84_in_statement2582); if (failed) return ;
+                    pushFollow(FOLLOW_expression_in_statement2584);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,25,FOLLOW_25_in_statement2586); if (failed) return ;
+
+                    }
+                    break;
+                case 12 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:679:7: 'break' ( Identifier )? ';'
+                    {
+                    match(input,85,FOLLOW_85_in_statement2594); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:679:15: ( Identifier )?
+                    int alt111=2;
+                    int LA111_0 = input.LA(1);
+
+                    if ( (LA111_0==Identifier) ) {
+                        alt111=1;
+                    }
+                    switch (alt111) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: Identifier
+                            {
+                            match(input,Identifier,FOLLOW_Identifier_in_statement2596); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_statement2599); if (failed) return ;
+
+                    }
+                    break;
+                case 13 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:680:7: 'continue' ( Identifier )? ';'
+                    {
+                    match(input,86,FOLLOW_86_in_statement2607); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:680:18: ( Identifier )?
+                    int alt112=2;
+                    int LA112_0 = input.LA(1);
+
+                    if ( (LA112_0==Identifier) ) {
+                        alt112=1;
+                    }
+                    switch (alt112) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: Identifier
+                            {
+                            match(input,Identifier,FOLLOW_Identifier_in_statement2609); if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_statement2612); if (failed) return ;
+
+                    }
+                    break;
+                case 14 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:682:7: modifyStatement
+                    {
+                    pushFollow(FOLLOW_modifyStatement_in_statement2625);
+                    modifyStatement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 15 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:683:7: ';'
+                    {
+                    match(input,25,FOLLOW_25_in_statement2633); if (failed) return ;
+
+                    }
+                    break;
+                case 16 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:684:7: statementExpression ';'
+                    {
+                    pushFollow(FOLLOW_statementExpression_in_statement2641);
+                    statementExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,25,FOLLOW_25_in_statement2643); if (failed) return ;
+
+                    }
+                    break;
+                case 17 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:685:7: Identifier ':' statement
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_statement2651); if (failed) return ;
+                    match(input,74,FOLLOW_74_in_statement2653); if (failed) return ;
+                    pushFollow(FOLLOW_statement_in_statement2655);
+                    statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 83, statement_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end statement
+
+
+    // $ANTLR start modifyStatement
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:688:1: modifyStatement : s= 'modify' parExpression '{' (e= expression ( ',' e= expression )* )? c= '}' ;
+    public final void modifyStatement() throws RecognitionException {
+        int modifyStatement_StartIndex = input.index();
+        Token s=null;
+        Token c=null;
+        expression_return e = null;
+
+        parExpression_return parExpression3 = null;
+
+
+
+        	    JavaModifyBlockDescr d = null;
+        	
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 84) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:692:2: (s= 'modify' parExpression '{' (e= expression ( ',' e= expression )* )? c= '}' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:692:4: s= 'modify' parExpression '{' (e= expression ( ',' e= expression )* )? c= '}'
+            {
+            s=(Token)input.LT(1);
+            match(input,87,FOLLOW_87_in_modifyStatement2675); if (failed) return ;
+            pushFollow(FOLLOW_parExpression_in_modifyStatement2677);
+            parExpression3=parExpression();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+
+              	    d = new JavaModifyBlockDescr( input.toString(parExpression3.start,parExpression3.stop) );
+              	    d.setStart( ((CommonToken)s).getStartIndex() );
+              	    this.modifyBlocks.add( d );
+              	    
+              	
+            }
+            match(input,37,FOLLOW_37_in_modifyStatement2684); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:699:6: (e= expression ( ',' e= expression )* )?
+            int alt115=2;
+            int LA115_0 = input.LA(1);
+
+            if ( (LA115_0==Identifier||(LA115_0>=FloatingPointLiteral && LA115_0<=DecimalLiteral)||LA115_0==33||LA115_0==40||(LA115_0>=55 && LA115_0<=62)||(LA115_0>=64 && LA115_0<=65)||(LA115_0>=68 && LA115_0<=70)||(LA115_0>=105 && LA115_0<=106)||(LA115_0>=109 && LA115_0<=114)) ) {
+                alt115=1;
+            }
+            switch (alt115) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:699:8: e= expression ( ',' e= expression )*
+                    {
+                    pushFollow(FOLLOW_expression_in_modifyStatement2692);
+                    e=expression();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       d.getExpressions().add( input.toString(e.start,e.stop) ); 
+                    }
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:700:9: ( ',' e= expression )*
+                    loop114:
+                    do {
+                        int alt114=2;
+                        int LA114_0 = input.LA(1);
+
+                        if ( (LA114_0==34) ) {
+                            alt114=1;
+                        }
+
+
+                        switch (alt114) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:700:10: ',' e= expression
+                    	    {
+                    	    match(input,34,FOLLOW_34_in_modifyStatement2705); if (failed) return ;
+                    	    pushFollow(FOLLOW_expression_in_modifyStatement2709);
+                    	    e=expression();
+                    	    _fsp--;
+                    	    if (failed) return ;
+                    	    if ( backtracking==0 ) {
+                    	       d.getExpressions().add( input.toString(e.start,e.stop) ); 
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop114;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+            c=(Token)input.LT(1);
+            match(input,38,FOLLOW_38_in_modifyStatement2728); if (failed) return ;
+            if ( backtracking==0 ) {
+
+                          d.setEnd( ((CommonToken)c).getStopIndex() ); 
+                      
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 84, modifyStatement_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end modifyStatement
+
+
+    // $ANTLR start catches
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:708:1: catches : catchClause ( catchClause )* ;
+    public final void catches() throws RecognitionException {
+        int catches_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 85) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:709:2: ( catchClause ( catchClause )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:709:4: catchClause ( catchClause )*
+            {
+            pushFollow(FOLLOW_catchClause_in_catches2752);
+            catchClause();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:709:16: ( catchClause )*
+            loop116:
+            do {
+                int alt116=2;
+                int LA116_0 = input.LA(1);
+
+                if ( (LA116_0==88) ) {
+                    alt116=1;
+                }
+
+
+                switch (alt116) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:709:17: catchClause
+            	    {
+            	    pushFollow(FOLLOW_catchClause_in_catches2755);
+            	    catchClause();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop116;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 85, catches_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end catches
+
+
+    // $ANTLR start catchClause
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:712:1: catchClause : 'catch' '(' formalParameter ')' block ;
+    public final void catchClause() throws RecognitionException {
+        int catchClause_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 86) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:713:2: ( 'catch' '(' formalParameter ')' block )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:713:4: 'catch' '(' formalParameter ')' block
+            {
+            match(input,88,FOLLOW_88_in_catchClause2769); if (failed) return ;
+            match(input,65,FOLLOW_65_in_catchClause2771); if (failed) return ;
+            pushFollow(FOLLOW_formalParameter_in_catchClause2773);
+            formalParameter();
+            _fsp--;
+            if (failed) return ;
+            match(input,66,FOLLOW_66_in_catchClause2775); if (failed) return ;
+            pushFollow(FOLLOW_block_in_catchClause2777);
+            block();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 86, catchClause_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end catchClause
+
+
+    // $ANTLR start formalParameter
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:716:1: formalParameter : ( variableModifier )* type variableDeclaratorId ;
+    public final void formalParameter() throws RecognitionException {
+        int formalParameter_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 87) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:717:2: ( ( variableModifier )* type variableDeclaratorId )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:717:4: ( variableModifier )* type variableDeclaratorId
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:717:4: ( variableModifier )*
+            loop117:
+            do {
+                int alt117=2;
+                int LA117_0 = input.LA(1);
+
+                if ( (LA117_0==49||LA117_0==71) ) {
+                    alt117=1;
+                }
+
+
+                switch (alt117) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: variableModifier
+            	    {
+            	    pushFollow(FOLLOW_variableModifier_in_formalParameter2788);
+            	    variableModifier();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop117;
+                }
+            } while (true);
+
+            pushFollow(FOLLOW_type_in_formalParameter2791);
+            type();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_variableDeclaratorId_in_formalParameter2793);
+            variableDeclaratorId();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 87, formalParameter_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end formalParameter
+
+
+    // $ANTLR start switchBlockStatementGroups
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:720:1: switchBlockStatementGroups : ( switchBlockStatementGroup )* ;
+    public final void switchBlockStatementGroups() throws RecognitionException {
+        int switchBlockStatementGroups_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 88) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:721:2: ( ( switchBlockStatementGroup )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:721:4: ( switchBlockStatementGroup )*
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:721:4: ( switchBlockStatementGroup )*
+            loop118:
+            do {
+                int alt118=2;
+                int LA118_0 = input.LA(1);
+
+                if ( (LA118_0==72||LA118_0==89) ) {
+                    alt118=1;
+                }
+
+
+                switch (alt118) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:721:5: switchBlockStatementGroup
+            	    {
+            	    pushFollow(FOLLOW_switchBlockStatementGroup_in_switchBlockStatementGroups2807);
+            	    switchBlockStatementGroup();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop118;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 88, switchBlockStatementGroups_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end switchBlockStatementGroups
+
+
+    // $ANTLR start switchBlockStatementGroup
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:724:1: switchBlockStatementGroup : switchLabel ( blockStatement )* ;
+    public final void switchBlockStatementGroup() throws RecognitionException {
+        int switchBlockStatementGroup_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 89) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:725:2: ( switchLabel ( blockStatement )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:725:4: switchLabel ( blockStatement )*
+            {
+            pushFollow(FOLLOW_switchLabel_in_switchBlockStatementGroup2821);
+            switchLabel();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:725:16: ( blockStatement )*
+            loop119:
+            do {
+                int alt119=2;
+                int LA119_0 = input.LA(1);
+
+                if ( ((LA119_0>=Identifier && LA119_0<=DecimalLiteral)||LA119_0==25||LA119_0==27||LA119_0==30||LA119_0==33||LA119_0==37||(LA119_0>=39 && LA119_0<=40)||(LA119_0>=45 && LA119_0<=62)||(LA119_0>=64 && LA119_0<=65)||(LA119_0>=68 && LA119_0<=71)||LA119_0==73||LA119_0==75||(LA119_0>=77 && LA119_0<=80)||(LA119_0>=82 && LA119_0<=87)||(LA119_0>=105 && LA119_0<=106)||(LA119_0>=109 && LA119_0<=114)) ) {
+                    alt119=1;
+                }
+
+
+                switch (alt119) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: blockStatement
+            	    {
+            	    pushFollow(FOLLOW_blockStatement_in_switchBlockStatementGroup2823);
+            	    blockStatement();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop119;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 89, switchBlockStatementGroup_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end switchBlockStatementGroup
+
+
+    // $ANTLR start switchLabel
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:728:1: switchLabel : ( 'case' constantExpression ':' | 'case' enumConstantName ':' | 'default' ':' );
+    public final void switchLabel() throws RecognitionException {
+        int switchLabel_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 90) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:729:2: ( 'case' constantExpression ':' | 'case' enumConstantName ':' | 'default' ':' )
+            int alt120=3;
+            int LA120_0 = input.LA(1);
+
+            if ( (LA120_0==89) ) {
+                int LA120_1 = input.LA(2);
+
+                if ( ((LA120_1>=FloatingPointLiteral && LA120_1<=DecimalLiteral)||LA120_1==33||LA120_1==40||(LA120_1>=55 && LA120_1<=62)||(LA120_1>=64 && LA120_1<=65)||(LA120_1>=68 && LA120_1<=70)||(LA120_1>=105 && LA120_1<=106)||(LA120_1>=109 && LA120_1<=114)) ) {
+                    alt120=1;
+                }
+                else if ( (LA120_1==Identifier) ) {
+                    int LA120_20 = input.LA(3);
+
+                    if ( (synpred176()) ) {
+                        alt120=1;
+                    }
+                    else if ( (synpred177()) ) {
+                        alt120=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("728:1: switchLabel : ( 'case' constantExpression ':' | 'case' enumConstantName ':' | 'default' ':' );", 120, 20, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("728:1: switchLabel : ( 'case' constantExpression ':' | 'case' enumConstantName ':' | 'default' ':' );", 120, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA120_0==72) ) {
+                alt120=3;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("728:1: switchLabel : ( 'case' constantExpression ':' | 'case' enumConstantName ':' | 'default' ':' );", 120, 0, input);
+
+                throw nvae;
+            }
+            switch (alt120) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:729:4: 'case' constantExpression ':'
+                    {
+                    match(input,89,FOLLOW_89_in_switchLabel2836); if (failed) return ;
+                    pushFollow(FOLLOW_constantExpression_in_switchLabel2838);
+                    constantExpression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,74,FOLLOW_74_in_switchLabel2840); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:730:6: 'case' enumConstantName ':'
+                    {
+                    match(input,89,FOLLOW_89_in_switchLabel2847); if (failed) return ;
+                    pushFollow(FOLLOW_enumConstantName_in_switchLabel2849);
+                    enumConstantName();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,74,FOLLOW_74_in_switchLabel2851); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:731:6: 'default' ':'
+                    {
+                    match(input,72,FOLLOW_72_in_switchLabel2858); if (failed) return ;
+                    match(input,74,FOLLOW_74_in_switchLabel2860); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 90, switchLabel_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end switchLabel
+
+
+    // $ANTLR start moreStatementExpressions
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:734:1: moreStatementExpressions : ( ',' statementExpression )* ;
+    public final void moreStatementExpressions() throws RecognitionException {
+        int moreStatementExpressions_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 91) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:735:2: ( ( ',' statementExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:735:4: ( ',' statementExpression )*
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:735:4: ( ',' statementExpression )*
+            loop121:
+            do {
+                int alt121=2;
+                int LA121_0 = input.LA(1);
+
+                if ( (LA121_0==34) ) {
+                    alt121=1;
+                }
+
+
+                switch (alt121) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:735:5: ',' statementExpression
+            	    {
+            	    match(input,34,FOLLOW_34_in_moreStatementExpressions2873); if (failed) return ;
+            	    pushFollow(FOLLOW_statementExpression_in_moreStatementExpressions2875);
+            	    statementExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop121;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 91, moreStatementExpressions_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end moreStatementExpressions
+
+
+    // $ANTLR start forControl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );
+    public final void forControl() throws RecognitionException {
+        int forControl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 92) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:740:2: ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? )
+            int alt125=2;
+            switch ( input.LA(1) ) {
+            case 49:
+                {
+                switch ( input.LA(2) ) {
+                case Identifier:
+                    {
+                    switch ( input.LA(3) ) {
+                    case 33:
+                        {
+                        int LA125_60 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 60, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 28:
+                        {
+                        int LA125_61 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 61, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 41:
+                        {
+                        int LA125_62 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 62, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case Identifier:
+                        {
+                        int LA125_63 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 63, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 24, input);
+
+                        throw nvae;
+                    }
+
+                    }
+                    break;
+                case 55:
+                case 56:
+                case 57:
+                case 58:
+                case 59:
+                case 60:
+                case 61:
+                case 62:
+                    {
+                    int LA125_25 = input.LA(3);
+
+                    if ( (LA125_25==41) ) {
+                        int LA125_64 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 64, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else if ( (LA125_25==Identifier) ) {
+                        int LA125_65 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 65, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 25, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 49:
+                    {
+                    switch ( input.LA(3) ) {
+                    case Identifier:
+                        {
+                        int LA125_66 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 66, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 55:
+                    case 56:
+                    case 57:
+                    case 58:
+                    case 59:
+                    case 60:
+                    case 61:
+                    case 62:
+                        {
+                        int LA125_67 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 67, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 49:
+                        {
+                        int LA125_68 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 68, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 71:
+                        {
+                        int LA125_69 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 69, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 26, input);
+
+                        throw nvae;
+                    }
+
+                    }
+                    break;
+                case 71:
+                    {
+                    int LA125_27 = input.LA(3);
+
+                    if ( (LA125_27==Identifier) ) {
+                        int LA125_70 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 70, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 27, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 1, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 71:
+                {
+                int LA125_2 = input.LA(2);
+
+                if ( (LA125_2==Identifier) ) {
+                    switch ( input.LA(3) ) {
+                    case 28:
+                        {
+                        int LA125_71 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 71, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 65:
+                        {
+                        int LA125_72 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 72, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case Identifier:
+                        {
+                        int LA125_73 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 73, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 55:
+                    case 56:
+                    case 57:
+                    case 58:
+                    case 59:
+                    case 60:
+                    case 61:
+                    case 62:
+                        {
+                        int LA125_74 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 74, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 49:
+                        {
+                        int LA125_75 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 75, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 71:
+                        {
+                        int LA125_76 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 76, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 28, input);
+
+                        throw nvae;
+                    }
+
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case Identifier:
+                {
+                switch ( input.LA(2) ) {
+                case 28:
+                    {
+                    int LA125_29 = input.LA(3);
+
+                    if ( (LA125_29==30||LA125_29==33||LA125_29==64||(LA125_29>=113 && LA125_29<=114)) ) {
+                        alt125=2;
+                    }
+                    else if ( (LA125_29==Identifier) ) {
+                        int LA125_79 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 79, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 29, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 41:
+                    {
+                    int LA125_30 = input.LA(3);
+
+                    if ( (LA125_30==42) ) {
+                        int LA125_83 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 83, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else if ( (LA125_30==Identifier||(LA125_30>=FloatingPointLiteral && LA125_30<=DecimalLiteral)||LA125_30==33||LA125_30==40||(LA125_30>=55 && LA125_30<=62)||(LA125_30>=64 && LA125_30<=65)||(LA125_30>=68 && LA125_30<=70)||(LA125_30>=105 && LA125_30<=106)||(LA125_30>=109 && LA125_30<=114)) ) {
+                        alt125=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 30, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 25:
+                case 29:
+                case 34:
+                case 35:
+                case 36:
+                case 44:
+                case 63:
+                case 65:
+                case 90:
+                case 91:
+                case 92:
+                case 93:
+                case 94:
+                case 95:
+                case 96:
+                case 97:
+                case 98:
+                case 99:
+                case 100:
+                case 101:
+                case 102:
+                case 103:
+                case 104:
+                case 105:
+                case 106:
+                case 107:
+                case 108:
+                case 109:
+                case 110:
+                    {
+                    alt125=2;
+                    }
+                    break;
+                case 33:
+                    {
+                    switch ( input.LA(3) ) {
+                    case FloatingPointLiteral:
+                    case CharacterLiteral:
+                    case StringLiteral:
+                    case HexLiteral:
+                    case OctalLiteral:
+                    case DecimalLiteral:
+                    case 33:
+                    case 40:
+                    case 44:
+                    case 64:
+                    case 65:
+                    case 68:
+                    case 69:
+                    case 70:
+                    case 105:
+                    case 106:
+                    case 109:
+                    case 110:
+                    case 111:
+                    case 112:
+                    case 113:
+                    case 114:
+                        {
+                        alt125=2;
+                        }
+                        break;
+                    case Identifier:
+                        {
+                        int LA125_106 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 106, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 55:
+                    case 56:
+                    case 57:
+                    case 58:
+                    case 59:
+                    case 60:
+                    case 61:
+                    case 62:
+                        {
+                        int LA125_107 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 107, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 63:
+                        {
+                        int LA125_108 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 108, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 35, input);
+
+                        throw nvae;
+                    }
+
+                    }
+                    break;
+                case Identifier:
+                    {
+                    int LA125_56 = input.LA(3);
+
+                    if ( (LA125_56==74) ) {
+                        alt125=1;
+                    }
+                    else if ( (LA125_56==25||LA125_56==34||LA125_56==41||LA125_56==44) ) {
+                        alt125=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 56, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 3, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                switch ( input.LA(2) ) {
+                case 41:
+                    {
+                    int LA125_57 = input.LA(3);
+
+                    if ( (LA125_57==42) ) {
+                        int LA125_131 = input.LA(4);
+
+                        if ( (synpred179()) ) {
+                            alt125=1;
+                        }
+                        else if ( (true) ) {
+                            alt125=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 131, input);
+
+                            throw nvae;
+                        }
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 57, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 28:
+                    {
+                    alt125=2;
+                    }
+                    break;
+                case Identifier:
+                    {
+                    int LA125_59 = input.LA(3);
+
+                    if ( (LA125_59==74) ) {
+                        alt125=1;
+                    }
+                    else if ( (LA125_59==25||LA125_59==34||LA125_59==41||LA125_59==44) ) {
+                        alt125=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 59, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 4, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 25:
+            case 33:
+            case 40:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 105:
+            case 106:
+            case 109:
+            case 110:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt125=2;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("738:1: forControl options {k=3; } : ( forVarControl | ( forInit )? ';' ( expression )? ';' ( forUpdate )? );", 125, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt125) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:740:4: forVarControl
+                    {
+                    pushFollow(FOLLOW_forVarControl_in_forControl2896);
+                    forVarControl();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:741:4: ( forInit )? ';' ( expression )? ';' ( forUpdate )?
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:741:4: ( forInit )?
+                    int alt122=2;
+                    int LA122_0 = input.LA(1);
+
+                    if ( (LA122_0==Identifier||(LA122_0>=FloatingPointLiteral && LA122_0<=DecimalLiteral)||LA122_0==33||LA122_0==40||LA122_0==49||(LA122_0>=55 && LA122_0<=62)||(LA122_0>=64 && LA122_0<=65)||(LA122_0>=68 && LA122_0<=71)||(LA122_0>=105 && LA122_0<=106)||(LA122_0>=109 && LA122_0<=114)) ) {
+                        alt122=1;
+                    }
+                    switch (alt122) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: forInit
+                            {
+                            pushFollow(FOLLOW_forInit_in_forControl2901);
+                            forInit();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_forControl2904); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:741:17: ( expression )?
+                    int alt123=2;
+                    int LA123_0 = input.LA(1);
+
+                    if ( (LA123_0==Identifier||(LA123_0>=FloatingPointLiteral && LA123_0<=DecimalLiteral)||LA123_0==33||LA123_0==40||(LA123_0>=55 && LA123_0<=62)||(LA123_0>=64 && LA123_0<=65)||(LA123_0>=68 && LA123_0<=70)||(LA123_0>=105 && LA123_0<=106)||(LA123_0>=109 && LA123_0<=114)) ) {
+                        alt123=1;
+                    }
+                    switch (alt123) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: expression
+                            {
+                            pushFollow(FOLLOW_expression_in_forControl2906);
+                            expression();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,25,FOLLOW_25_in_forControl2909); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:741:33: ( forUpdate )?
+                    int alt124=2;
+                    int LA124_0 = input.LA(1);
+
+                    if ( (LA124_0==Identifier||(LA124_0>=FloatingPointLiteral && LA124_0<=DecimalLiteral)||LA124_0==33||LA124_0==40||(LA124_0>=55 && LA124_0<=62)||(LA124_0>=64 && LA124_0<=65)||(LA124_0>=68 && LA124_0<=70)||(LA124_0>=105 && LA124_0<=106)||(LA124_0>=109 && LA124_0<=114)) ) {
+                        alt124=1;
+                    }
+                    switch (alt124) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: forUpdate
+                            {
+                            pushFollow(FOLLOW_forUpdate_in_forControl2911);
+                            forUpdate();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 92, forControl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end forControl
+
+
+    // $ANTLR start forInit
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );
+    public final void forInit() throws RecognitionException {
+        int forInit_StartIndex = input.index();
+
+                    this.localVariableLevel++;
+                
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 93) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:2: ( ( variableModifier )* type variableDeclarators | expressionList )
+            int alt127=2;
+            switch ( input.LA(1) ) {
+            case 49:
+            case 71:
+                {
+                alt127=1;
+                }
+                break;
+            case Identifier:
+                {
+                switch ( input.LA(2) ) {
+                case 28:
+                    {
+                    int LA127_23 = input.LA(3);
+
+                    if ( (synpred184()) ) {
+                        alt127=1;
+                    }
+                    else if ( (true) ) {
+                        alt127=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 23, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 41:
+                    {
+                    int LA127_24 = input.LA(3);
+
+                    if ( (synpred184()) ) {
+                        alt127=1;
+                    }
+                    else if ( (true) ) {
+                        alt127=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 24, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case EOF:
+                case 25:
+                case 29:
+                case 34:
+                case 35:
+                case 36:
+                case 44:
+                case 63:
+                case 65:
+                case 90:
+                case 91:
+                case 92:
+                case 93:
+                case 94:
+                case 95:
+                case 96:
+                case 97:
+                case 98:
+                case 99:
+                case 100:
+                case 101:
+                case 102:
+                case 103:
+                case 104:
+                case 105:
+                case 106:
+                case 107:
+                case 108:
+                case 109:
+                case 110:
+                    {
+                    alt127=2;
+                    }
+                    break;
+                case 33:
+                    {
+                    int LA127_29 = input.LA(3);
+
+                    if ( (synpred184()) ) {
+                        alt127=1;
+                    }
+                    else if ( (true) ) {
+                        alt127=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 29, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case Identifier:
+                    {
+                    alt127=1;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 3, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                switch ( input.LA(2) ) {
+                case 41:
+                    {
+                    int LA127_52 = input.LA(3);
+
+                    if ( (synpred184()) ) {
+                        alt127=1;
+                    }
+                    else if ( (true) ) {
+                        alt127=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 52, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case Identifier:
+                    {
+                    alt127=1;
+                    }
+                    break;
+                case 28:
+                    {
+                    alt127=2;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 4, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 33:
+            case 40:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 105:
+            case 106:
+            case 109:
+            case 110:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt127=2;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("744:1: forInit : ( ( variableModifier )* type variableDeclarators | expressionList );", 127, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt127) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:4: ( variableModifier )* type variableDeclarators
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:4: ( variableModifier )*
+                    loop126:
+                    do {
+                        int alt126=2;
+                        int LA126_0 = input.LA(1);
+
+                        if ( (LA126_0==49||LA126_0==71) ) {
+                            alt126=1;
+                        }
+
+
+                        switch (alt126) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: variableModifier
+                    	    {
+                    	    pushFollow(FOLLOW_variableModifier_in_forInit2949);
+                    	    variableModifier();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop126;
+                        }
+                    } while (true);
+
+                    pushFollow(FOLLOW_type_in_forInit2952);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+                    pushFollow(FOLLOW_variableDeclarators_in_forInit2954);
+                    variableDeclarators();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:752:4: expressionList
+                    {
+                    pushFollow(FOLLOW_expressionList_in_forInit2959);
+                    expressionList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+            if ( backtracking==0 ) {
+
+                          this.localVariableLevel--;
+                      
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 93, forInit_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end forInit
+
+
+    // $ANTLR start forVarControl
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:755:1: forVarControl : ( variableModifier )* type Identifier ':' expression ;
+    public final void forVarControl() throws RecognitionException {
+        int forVarControl_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 94) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:756:2: ( ( variableModifier )* type Identifier ':' expression )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:756:4: ( variableModifier )* type Identifier ':' expression
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:756:4: ( variableModifier )*
+            loop128:
+            do {
+                int alt128=2;
+                int LA128_0 = input.LA(1);
+
+                if ( (LA128_0==49||LA128_0==71) ) {
+                    alt128=1;
+                }
+
+
+                switch (alt128) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: variableModifier
+            	    {
+            	    pushFollow(FOLLOW_variableModifier_in_forVarControl2971);
+            	    variableModifier();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop128;
+                }
+            } while (true);
+
+            pushFollow(FOLLOW_type_in_forVarControl2974);
+            type();
+            _fsp--;
+            if (failed) return ;
+            match(input,Identifier,FOLLOW_Identifier_in_forVarControl2976); if (failed) return ;
+            match(input,74,FOLLOW_74_in_forVarControl2978); if (failed) return ;
+            pushFollow(FOLLOW_expression_in_forVarControl2980);
+            expression();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 94, forVarControl_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end forVarControl
+
+
+    // $ANTLR start forUpdate
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:759:1: forUpdate : expressionList ;
+    public final void forUpdate() throws RecognitionException {
+        int forUpdate_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 95) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:760:2: ( expressionList )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:760:4: expressionList
+            {
+            pushFollow(FOLLOW_expressionList_in_forUpdate2991);
+            expressionList();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 95, forUpdate_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end forUpdate
+
+    public static class parExpression_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start parExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:765:1: parExpression : '(' expression ')' ;
+    public final parExpression_return parExpression() throws RecognitionException {
+        parExpression_return retval = new parExpression_return();
+        retval.start = input.LT(1);
+        int parExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 96) ) { return retval; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:766:2: ( '(' expression ')' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:766:4: '(' expression ')'
+            {
+            match(input,65,FOLLOW_65_in_parExpression3004); if (failed) return retval;
+            pushFollow(FOLLOW_expression_in_parExpression3006);
+            expression();
+            _fsp--;
+            if (failed) return retval;
+            match(input,66,FOLLOW_66_in_parExpression3008); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 96, parExpression_StartIndex); }
+        }
+        return retval;
+    }
+    // $ANTLR end parExpression
+
+
+    // $ANTLR start expressionList
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:769:1: expressionList : expression ( ',' expression )* ;
+    public final void expressionList() throws RecognitionException {
+        int expressionList_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 97) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:770:5: ( expression ( ',' expression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:770:9: expression ( ',' expression )*
+            {
+            pushFollow(FOLLOW_expression_in_expressionList3025);
+            expression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:770:20: ( ',' expression )*
+            loop129:
+            do {
+                int alt129=2;
+                int LA129_0 = input.LA(1);
+
+                if ( (LA129_0==34) ) {
+                    alt129=1;
+                }
+
+
+                switch (alt129) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:770:21: ',' expression
+            	    {
+            	    match(input,34,FOLLOW_34_in_expressionList3028); if (failed) return ;
+            	    pushFollow(FOLLOW_expression_in_expressionList3030);
+            	    expression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop129;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 97, expressionList_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end expressionList
+
+
+    // $ANTLR start statementExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:773:1: statementExpression : expression ;
+    public final void statementExpression() throws RecognitionException {
+        int statementExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 98) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:774:2: ( expression )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:774:4: expression
+            {
+            pushFollow(FOLLOW_expression_in_statementExpression3046);
+            expression();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 98, statementExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end statementExpression
+
+
+    // $ANTLR start constantExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:777:1: constantExpression : expression ;
+    public final void constantExpression() throws RecognitionException {
+        int constantExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 99) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:778:2: ( expression )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:778:4: expression
+            {
+            pushFollow(FOLLOW_expression_in_constantExpression3058);
+            expression();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 99, constantExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end constantExpression
+
+    public static class expression_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start expression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:781:1: expression : conditionalExpression ( assignmentOperator expression )? ;
+    public final expression_return expression() throws RecognitionException {
+        expression_return retval = new expression_return();
+        retval.start = input.LT(1);
+        int expression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 100) ) { return retval; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:2: ( conditionalExpression ( assignmentOperator expression )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:4: conditionalExpression ( assignmentOperator expression )?
+            {
+            pushFollow(FOLLOW_conditionalExpression_in_expression3070);
+            conditionalExpression();
+            _fsp--;
+            if (failed) return retval;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:26: ( assignmentOperator expression )?
+            int alt130=2;
+            switch ( input.LA(1) ) {
+                case 44:
+                    {
+                    int LA130_1 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 90:
+                    {
+                    int LA130_2 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 91:
+                    {
+                    int LA130_3 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 92:
+                    {
+                    int LA130_4 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 93:
+                    {
+                    int LA130_5 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 94:
+                    {
+                    int LA130_6 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 95:
+                    {
+                    int LA130_7 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 96:
+                    {
+                    int LA130_8 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 97:
+                    {
+                    int LA130_9 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 33:
+                    {
+                    int LA130_10 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+                case 35:
+                    {
+                    int LA130_11 = input.LA(2);
+
+                    if ( (synpred187()) ) {
+                        alt130=1;
+                    }
+                    }
+                    break;
+            }
+
+            switch (alt130) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:27: assignmentOperator expression
+                    {
+                    pushFollow(FOLLOW_assignmentOperator_in_expression3073);
+                    assignmentOperator();
+                    _fsp--;
+                    if (failed) return retval;
+                    pushFollow(FOLLOW_expression_in_expression3075);
+                    expression();
+                    _fsp--;
+                    if (failed) return retval;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 100, expression_StartIndex); }
+        }
+        return retval;
+    }
+    // $ANTLR end expression
+
+
+    // $ANTLR start assignmentOperator
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:785:1: assignmentOperator : ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' );
+    public final void assignmentOperator() throws RecognitionException {
+        int assignmentOperator_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 101) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:786:2: ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' )
+            int alt131=12;
+            switch ( input.LA(1) ) {
+            case 44:
+                {
+                alt131=1;
+                }
+                break;
+            case 90:
+                {
+                alt131=2;
+                }
+                break;
+            case 91:
+                {
+                alt131=3;
+                }
+                break;
+            case 92:
+                {
+                alt131=4;
+                }
+                break;
+            case 93:
+                {
+                alt131=5;
+                }
+                break;
+            case 94:
+                {
+                alt131=6;
+                }
+                break;
+            case 95:
+                {
+                alt131=7;
+                }
+                break;
+            case 96:
+                {
+                alt131=8;
+                }
+                break;
+            case 97:
+                {
+                alt131=9;
+                }
+                break;
+            case 33:
+                {
+                alt131=10;
+                }
+                break;
+            case 35:
+                {
+                int LA131_11 = input.LA(2);
+
+                if ( (LA131_11==35) ) {
+                    int LA131_12 = input.LA(3);
+
+                    if ( (synpred198()) ) {
+                        alt131=11;
+                    }
+                    else if ( (true) ) {
+                        alt131=12;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("785:1: assignmentOperator : ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' );", 131, 12, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("785:1: assignmentOperator : ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' );", 131, 11, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("785:1: assignmentOperator : ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' );", 131, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt131) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:786:4: '='
+                    {
+                    match(input,44,FOLLOW_44_in_assignmentOperator3089); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:787:9: '+='
+                    {
+                    match(input,90,FOLLOW_90_in_assignmentOperator3099); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:788:9: '-='
+                    {
+                    match(input,91,FOLLOW_91_in_assignmentOperator3109); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:789:9: '*='
+                    {
+                    match(input,92,FOLLOW_92_in_assignmentOperator3119); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:790:9: '/='
+                    {
+                    match(input,93,FOLLOW_93_in_assignmentOperator3129); if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:791:9: '&='
+                    {
+                    match(input,94,FOLLOW_94_in_assignmentOperator3139); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:792:9: '|='
+                    {
+                    match(input,95,FOLLOW_95_in_assignmentOperator3149); if (failed) return ;
+
+                    }
+                    break;
+                case 8 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:793:9: '^='
+                    {
+                    match(input,96,FOLLOW_96_in_assignmentOperator3159); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:794:9: '%='
+                    {
+                    match(input,97,FOLLOW_97_in_assignmentOperator3169); if (failed) return ;
+
+                    }
+                    break;
+                case 10 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:795:9: '<' '<' '='
+                    {
+                    match(input,33,FOLLOW_33_in_assignmentOperator3179); if (failed) return ;
+                    match(input,33,FOLLOW_33_in_assignmentOperator3181); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_assignmentOperator3183); if (failed) return ;
+
+                    }
+                    break;
+                case 11 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:796:9: '>' '>' '='
+                    {
+                    match(input,35,FOLLOW_35_in_assignmentOperator3193); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_assignmentOperator3195); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_assignmentOperator3197); if (failed) return ;
+
+                    }
+                    break;
+                case 12 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:797:9: '>' '>' '>' '='
+                    {
+                    match(input,35,FOLLOW_35_in_assignmentOperator3207); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_assignmentOperator3209); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_assignmentOperator3211); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_assignmentOperator3213); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 101, assignmentOperator_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end assignmentOperator
+
+
+    // $ANTLR start conditionalExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:800:1: conditionalExpression : conditionalOrExpression ( '?' expression ':' expression )? ;
+    public final void conditionalExpression() throws RecognitionException {
+        int conditionalExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 102) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:801:5: ( conditionalOrExpression ( '?' expression ':' expression )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:801:9: conditionalOrExpression ( '?' expression ':' expression )?
+            {
+            pushFollow(FOLLOW_conditionalOrExpression_in_conditionalExpression3229);
+            conditionalOrExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:801:33: ( '?' expression ':' expression )?
+            int alt132=2;
+            int LA132_0 = input.LA(1);
+
+            if ( (LA132_0==63) ) {
+                alt132=1;
+            }
+            switch (alt132) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:801:35: '?' expression ':' expression
+                    {
+                    match(input,63,FOLLOW_63_in_conditionalExpression3233); if (failed) return ;
+                    pushFollow(FOLLOW_expression_in_conditionalExpression3235);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,74,FOLLOW_74_in_conditionalExpression3237); if (failed) return ;
+                    pushFollow(FOLLOW_expression_in_conditionalExpression3239);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 102, conditionalExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end conditionalExpression
+
+
+    // $ANTLR start conditionalOrExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:804:1: conditionalOrExpression : conditionalAndExpression ( '||' conditionalAndExpression )* ;
+    public final void conditionalOrExpression() throws RecognitionException {
+        int conditionalOrExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 103) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:805:5: ( conditionalAndExpression ( '||' conditionalAndExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:805:9: conditionalAndExpression ( '||' conditionalAndExpression )*
+            {
+            pushFollow(FOLLOW_conditionalAndExpression_in_conditionalOrExpression3258);
+            conditionalAndExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:805:34: ( '||' conditionalAndExpression )*
+            loop133:
+            do {
+                int alt133=2;
+                int LA133_0 = input.LA(1);
+
+                if ( (LA133_0==98) ) {
+                    alt133=1;
+                }
+
+
+                switch (alt133) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:805:36: '||' conditionalAndExpression
+            	    {
+            	    match(input,98,FOLLOW_98_in_conditionalOrExpression3262); if (failed) return ;
+            	    pushFollow(FOLLOW_conditionalAndExpression_in_conditionalOrExpression3264);
+            	    conditionalAndExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop133;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 103, conditionalOrExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end conditionalOrExpression
+
+
+    // $ANTLR start conditionalAndExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:808:1: conditionalAndExpression : inclusiveOrExpression ( '&&' inclusiveOrExpression )* ;
+    public final void conditionalAndExpression() throws RecognitionException {
+        int conditionalAndExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 104) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:809:5: ( inclusiveOrExpression ( '&&' inclusiveOrExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:809:9: inclusiveOrExpression ( '&&' inclusiveOrExpression )*
+            {
+            pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression3283);
+            inclusiveOrExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:809:31: ( '&&' inclusiveOrExpression )*
+            loop134:
+            do {
+                int alt134=2;
+                int LA134_0 = input.LA(1);
+
+                if ( (LA134_0==99) ) {
+                    alt134=1;
+                }
+
+
+                switch (alt134) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:809:33: '&&' inclusiveOrExpression
+            	    {
+            	    match(input,99,FOLLOW_99_in_conditionalAndExpression3287); if (failed) return ;
+            	    pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression3289);
+            	    inclusiveOrExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop134;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 104, conditionalAndExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end conditionalAndExpression
+
+
+    // $ANTLR start inclusiveOrExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:812:1: inclusiveOrExpression : exclusiveOrExpression ( '|' exclusiveOrExpression )* ;
+    public final void inclusiveOrExpression() throws RecognitionException {
+        int inclusiveOrExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 105) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:813:5: ( exclusiveOrExpression ( '|' exclusiveOrExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:813:9: exclusiveOrExpression ( '|' exclusiveOrExpression )*
+            {
+            pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression3308);
+            exclusiveOrExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:813:31: ( '|' exclusiveOrExpression )*
+            loop135:
+            do {
+                int alt135=2;
+                int LA135_0 = input.LA(1);
+
+                if ( (LA135_0==100) ) {
+                    alt135=1;
+                }
+
+
+                switch (alt135) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:813:33: '|' exclusiveOrExpression
+            	    {
+            	    match(input,100,FOLLOW_100_in_inclusiveOrExpression3312); if (failed) return ;
+            	    pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression3314);
+            	    exclusiveOrExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop135;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 105, inclusiveOrExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end inclusiveOrExpression
+
+
+    // $ANTLR start exclusiveOrExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:816:1: exclusiveOrExpression : andExpression ( '^' andExpression )* ;
+    public final void exclusiveOrExpression() throws RecognitionException {
+        int exclusiveOrExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 106) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:817:5: ( andExpression ( '^' andExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:817:9: andExpression ( '^' andExpression )*
+            {
+            pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression3333);
+            andExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:817:23: ( '^' andExpression )*
+            loop136:
+            do {
+                int alt136=2;
+                int LA136_0 = input.LA(1);
+
+                if ( (LA136_0==101) ) {
+                    alt136=1;
+                }
+
+
+                switch (alt136) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:817:25: '^' andExpression
+            	    {
+            	    match(input,101,FOLLOW_101_in_exclusiveOrExpression3337); if (failed) return ;
+            	    pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression3339);
+            	    andExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop136;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 106, exclusiveOrExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end exclusiveOrExpression
+
+
+    // $ANTLR start andExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:820:1: andExpression : equalityExpression ( '&' equalityExpression )* ;
+    public final void andExpression() throws RecognitionException {
+        int andExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 107) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:821:5: ( equalityExpression ( '&' equalityExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:821:9: equalityExpression ( '&' equalityExpression )*
+            {
+            pushFollow(FOLLOW_equalityExpression_in_andExpression3358);
+            equalityExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:821:28: ( '&' equalityExpression )*
+            loop137:
+            do {
+                int alt137=2;
+                int LA137_0 = input.LA(1);
+
+                if ( (LA137_0==36) ) {
+                    alt137=1;
+                }
+
+
+                switch (alt137) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:821:30: '&' equalityExpression
+            	    {
+            	    match(input,36,FOLLOW_36_in_andExpression3362); if (failed) return ;
+            	    pushFollow(FOLLOW_equalityExpression_in_andExpression3364);
+            	    equalityExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop137;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 107, andExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end andExpression
+
+
+    // $ANTLR start equalityExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:824:1: equalityExpression : instanceOfExpression ( ( '==' | '!=' ) instanceOfExpression )* ;
+    public final void equalityExpression() throws RecognitionException {
+        int equalityExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 108) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:825:5: ( instanceOfExpression ( ( '==' | '!=' ) instanceOfExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:825:9: instanceOfExpression ( ( '==' | '!=' ) instanceOfExpression )*
+            {
+            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression3383);
+            instanceOfExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:825:30: ( ( '==' | '!=' ) instanceOfExpression )*
+            loop138:
+            do {
+                int alt138=2;
+                int LA138_0 = input.LA(1);
+
+                if ( ((LA138_0>=102 && LA138_0<=103)) ) {
+                    alt138=1;
+                }
+
+
+                switch (alt138) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:825:32: ( '==' | '!=' ) instanceOfExpression
+            	    {
+            	    if ( (input.LA(1)>=102 && input.LA(1)<=103) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_equalityExpression3387);    throw mse;
+            	    }
+
+            	    pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression3395);
+            	    instanceOfExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop138;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 108, equalityExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end equalityExpression
+
+
+    // $ANTLR start instanceOfExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:828:1: instanceOfExpression : relationalExpression ( 'instanceof' type )? ;
+    public final void instanceOfExpression() throws RecognitionException {
+        int instanceOfExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 109) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:829:5: ( relationalExpression ( 'instanceof' type )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:829:9: relationalExpression ( 'instanceof' type )?
+            {
+            pushFollow(FOLLOW_relationalExpression_in_instanceOfExpression3414);
+            relationalExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:829:30: ( 'instanceof' type )?
+            int alt139=2;
+            int LA139_0 = input.LA(1);
+
+            if ( (LA139_0==104) ) {
+                alt139=1;
+            }
+            switch (alt139) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:829:31: 'instanceof' type
+                    {
+                    match(input,104,FOLLOW_104_in_instanceOfExpression3417); if (failed) return ;
+                    pushFollow(FOLLOW_type_in_instanceOfExpression3419);
+                    type();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 109, instanceOfExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end instanceOfExpression
+
+
+    // $ANTLR start relationalExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:832:1: relationalExpression : shiftExpression ( relationalOp shiftExpression )* ;
+    public final void relationalExpression() throws RecognitionException {
+        int relationalExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 110) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:5: ( shiftExpression ( relationalOp shiftExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:9: shiftExpression ( relationalOp shiftExpression )*
+            {
+            pushFollow(FOLLOW_shiftExpression_in_relationalExpression3437);
+            shiftExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:25: ( relationalOp shiftExpression )*
+            loop140:
+            do {
+                int alt140=2;
+                int LA140_0 = input.LA(1);
+
+                if ( (LA140_0==33) ) {
+                    int LA140_23 = input.LA(2);
+
+                    if ( (LA140_23==Identifier||(LA140_23>=FloatingPointLiteral && LA140_23<=DecimalLiteral)||LA140_23==40||LA140_23==44||(LA140_23>=55 && LA140_23<=62)||(LA140_23>=64 && LA140_23<=65)||(LA140_23>=68 && LA140_23<=70)||(LA140_23>=105 && LA140_23<=106)||(LA140_23>=109 && LA140_23<=114)) ) {
+                        alt140=1;
+                    }
+                    else if ( (LA140_23==33) ) {
+                        int LA140_28 = input.LA(3);
+
+                        if ( (synpred208()) ) {
+                            alt140=1;
+                        }
+
+
+                    }
+
+
+                }
+                else if ( (LA140_0==35) ) {
+                    int LA140_24 = input.LA(2);
+
+                    if ( (LA140_24==Identifier||(LA140_24>=FloatingPointLiteral && LA140_24<=DecimalLiteral)||LA140_24==33||LA140_24==40||LA140_24==44||(LA140_24>=55 && LA140_24<=62)||(LA140_24>=64 && LA140_24<=65)||(LA140_24>=68 && LA140_24<=70)||(LA140_24>=105 && LA140_24<=106)||(LA140_24>=109 && LA140_24<=114)) ) {
+                        alt140=1;
+                    }
+
+
+                }
+
+
+                switch (alt140) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:27: relationalOp shiftExpression
+            	    {
+            	    pushFollow(FOLLOW_relationalOp_in_relationalExpression3441);
+            	    relationalOp();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    pushFollow(FOLLOW_shiftExpression_in_relationalExpression3443);
+            	    shiftExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop140;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 110, relationalExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end relationalExpression
+
+
+    // $ANTLR start relationalOp
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:836:1: relationalOp : ( '<' '=' | '>' '=' | '<' | '>' ) ;
+    public final void relationalOp() throws RecognitionException {
+        int relationalOp_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 111) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:2: ( ( '<' '=' | '>' '=' | '<' | '>' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:4: ( '<' '=' | '>' '=' | '<' | '>' )
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:4: ( '<' '=' | '>' '=' | '<' | '>' )
+            int alt141=4;
+            int LA141_0 = input.LA(1);
+
+            if ( (LA141_0==33) ) {
+                int LA141_1 = input.LA(2);
+
+                if ( (LA141_1==44) ) {
+                    alt141=1;
+                }
+                else if ( (LA141_1==Identifier||(LA141_1>=FloatingPointLiteral && LA141_1<=DecimalLiteral)||LA141_1==33||LA141_1==40||(LA141_1>=55 && LA141_1<=62)||(LA141_1>=64 && LA141_1<=65)||(LA141_1>=68 && LA141_1<=70)||(LA141_1>=105 && LA141_1<=106)||(LA141_1>=109 && LA141_1<=114)) ) {
+                    alt141=3;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("837:4: ( '<' '=' | '>' '=' | '<' | '>' )", 141, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA141_0==35) ) {
+                int LA141_2 = input.LA(2);
+
+                if ( (LA141_2==44) ) {
+                    alt141=2;
+                }
+                else if ( (LA141_2==Identifier||(LA141_2>=FloatingPointLiteral && LA141_2<=DecimalLiteral)||LA141_2==33||LA141_2==40||(LA141_2>=55 && LA141_2<=62)||(LA141_2>=64 && LA141_2<=65)||(LA141_2>=68 && LA141_2<=70)||(LA141_2>=105 && LA141_2<=106)||(LA141_2>=109 && LA141_2<=114)) ) {
+                    alt141=4;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("837:4: ( '<' '=' | '>' '=' | '<' | '>' )", 141, 2, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("837:4: ( '<' '=' | '>' '=' | '<' | '>' )", 141, 0, input);
+
+                throw nvae;
+            }
+            switch (alt141) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:5: '<' '='
+                    {
+                    match(input,33,FOLLOW_33_in_relationalOp3459); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_relationalOp3461); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:15: '>' '='
+                    {
+                    match(input,35,FOLLOW_35_in_relationalOp3465); if (failed) return ;
+                    match(input,44,FOLLOW_44_in_relationalOp3467); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:25: '<'
+                    {
+                    match(input,33,FOLLOW_33_in_relationalOp3471); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:837:31: '>'
+                    {
+                    match(input,35,FOLLOW_35_in_relationalOp3475); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 111, relationalOp_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end relationalOp
+
+
+    // $ANTLR start shiftExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:840:1: shiftExpression : additiveExpression ( shiftOp additiveExpression )* ;
+    public final void shiftExpression() throws RecognitionException {
+        int shiftExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 112) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:5: ( additiveExpression ( shiftOp additiveExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:9: additiveExpression ( shiftOp additiveExpression )*
+            {
+            pushFollow(FOLLOW_additiveExpression_in_shiftExpression3492);
+            additiveExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:28: ( shiftOp additiveExpression )*
+            loop142:
+            do {
+                int alt142=2;
+                int LA142_0 = input.LA(1);
+
+                if ( (LA142_0==33) ) {
+                    int LA142_1 = input.LA(2);
+
+                    if ( (LA142_1==33) ) {
+                        int LA142_27 = input.LA(3);
+
+                        if ( (synpred212()) ) {
+                            alt142=1;
+                        }
+
+
+                    }
+
+
+                }
+                else if ( (LA142_0==35) ) {
+                    int LA142_2 = input.LA(2);
+
+                    if ( (LA142_2==35) ) {
+                        int LA142_48 = input.LA(3);
+
+                        if ( (synpred212()) ) {
+                            alt142=1;
+                        }
+
+
+                    }
+
+
+                }
+
+
+                switch (alt142) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:30: shiftOp additiveExpression
+            	    {
+            	    pushFollow(FOLLOW_shiftOp_in_shiftExpression3496);
+            	    shiftOp();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    pushFollow(FOLLOW_additiveExpression_in_shiftExpression3498);
+            	    additiveExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop142;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 112, shiftExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end shiftExpression
+
+
+    // $ANTLR start shiftOp
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:845:1: shiftOp : ( '<' '<' | '>' '>' '>' | '>' '>' ) ;
+    public final void shiftOp() throws RecognitionException {
+        int shiftOp_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 113) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:2: ( ( '<' '<' | '>' '>' '>' | '>' '>' ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:4: ( '<' '<' | '>' '>' '>' | '>' '>' )
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:4: ( '<' '<' | '>' '>' '>' | '>' '>' )
+            int alt143=3;
+            int LA143_0 = input.LA(1);
+
+            if ( (LA143_0==33) ) {
+                alt143=1;
+            }
+            else if ( (LA143_0==35) ) {
+                int LA143_2 = input.LA(2);
+
+                if ( (LA143_2==35) ) {
+                    int LA143_3 = input.LA(3);
+
+                    if ( (synpred214()) ) {
+                        alt143=2;
+                    }
+                    else if ( (true) ) {
+                        alt143=3;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("846:4: ( '<' '<' | '>' '>' '>' | '>' '>' )", 143, 3, input);
+
+                        throw nvae;
+                    }
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("846:4: ( '<' '<' | '>' '>' '>' | '>' '>' )", 143, 2, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("846:4: ( '<' '<' | '>' '>' '>' | '>' '>' )", 143, 0, input);
+
+                throw nvae;
+            }
+            switch (alt143) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:5: '<' '<'
+                    {
+                    match(input,33,FOLLOW_33_in_shiftOp3522); if (failed) return ;
+                    match(input,33,FOLLOW_33_in_shiftOp3524); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:15: '>' '>' '>'
+                    {
+                    match(input,35,FOLLOW_35_in_shiftOp3528); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_shiftOp3530); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_shiftOp3532); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:29: '>' '>'
+                    {
+                    match(input,35,FOLLOW_35_in_shiftOp3536); if (failed) return ;
+                    match(input,35,FOLLOW_35_in_shiftOp3538); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 113, shiftOp_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end shiftOp
+
+
+    // $ANTLR start additiveExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:850:1: additiveExpression : multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )* ;
+    public final void additiveExpression() throws RecognitionException {
+        int additiveExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 114) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:851:5: ( multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:851:9: multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )*
+            {
+            pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression3556);
+            multiplicativeExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:851:34: ( ( '+' | '-' ) multiplicativeExpression )*
+            loop144:
+            do {
+                int alt144=2;
+                int LA144_0 = input.LA(1);
+
+                if ( ((LA144_0>=105 && LA144_0<=106)) ) {
+                    alt144=1;
+                }
+
+
+                switch (alt144) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:851:36: ( '+' | '-' ) multiplicativeExpression
+            	    {
+            	    if ( (input.LA(1)>=105 && input.LA(1)<=106) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_additiveExpression3560);    throw mse;
+            	    }
+
+            	    pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression3568);
+            	    multiplicativeExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop144;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 114, additiveExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end additiveExpression
+
+
+    // $ANTLR start multiplicativeExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:854:1: multiplicativeExpression : unaryExpression ( ( '*' | '/' | '%' ) unaryExpression )* ;
+    public final void multiplicativeExpression() throws RecognitionException {
+        int multiplicativeExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 115) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:855:5: ( unaryExpression ( ( '*' | '/' | '%' ) unaryExpression )* )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:855:9: unaryExpression ( ( '*' | '/' | '%' ) unaryExpression )*
+            {
+            pushFollow(FOLLOW_unaryExpression_in_multiplicativeExpression3587);
+            unaryExpression();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:855:25: ( ( '*' | '/' | '%' ) unaryExpression )*
+            loop145:
+            do {
+                int alt145=2;
+                int LA145_0 = input.LA(1);
+
+                if ( (LA145_0==29||(LA145_0>=107 && LA145_0<=108)) ) {
+                    alt145=1;
+                }
+
+
+                switch (alt145) {
+            	case 1 :
+            	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:855:27: ( '*' | '/' | '%' ) unaryExpression
+            	    {
+            	    if ( input.LA(1)==29||(input.LA(1)>=107 && input.LA(1)<=108) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_multiplicativeExpression3591);    throw mse;
+            	    }
+
+            	    pushFollow(FOLLOW_unaryExpression_in_multiplicativeExpression3605);
+            	    unaryExpression();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop145;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 115, multiplicativeExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end multiplicativeExpression
+
+
+    // $ANTLR start unaryExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:858:1: unaryExpression : ( '+' unaryExpression | '-' unaryExpression | '++' primary | '--' primary | unaryExpressionNotPlusMinus );
+    public final void unaryExpression() throws RecognitionException {
+        int unaryExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 116) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:859:5: ( '+' unaryExpression | '-' unaryExpression | '++' primary | '--' primary | unaryExpressionNotPlusMinus )
+            int alt146=5;
+            switch ( input.LA(1) ) {
+            case 105:
+                {
+                alt146=1;
+                }
+                break;
+            case 106:
+                {
+                alt146=2;
+                }
+                break;
+            case 109:
+                {
+                alt146=3;
+                }
+                break;
+            case 110:
+                {
+                alt146=4;
+                }
+                break;
+            case Identifier:
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 33:
+            case 40:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+            case 64:
+            case 65:
+            case 68:
+            case 69:
+            case 70:
+            case 111:
+            case 112:
+            case 113:
+            case 114:
+                {
+                alt146=5;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("858:1: unaryExpression : ( '+' unaryExpression | '-' unaryExpression | '++' primary | '--' primary | unaryExpressionNotPlusMinus );", 146, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt146) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:859:9: '+' unaryExpression
+                    {
+                    match(input,105,FOLLOW_105_in_unaryExpression3625); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpression_in_unaryExpression3627);
+                    unaryExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:860:7: '-' unaryExpression
+                    {
+                    match(input,106,FOLLOW_106_in_unaryExpression3635); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpression_in_unaryExpression3637);
+                    unaryExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:861:9: '++' primary
+                    {
+                    match(input,109,FOLLOW_109_in_unaryExpression3647); if (failed) return ;
+                    pushFollow(FOLLOW_primary_in_unaryExpression3649);
+                    primary();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:862:9: '--' primary
+                    {
+                    match(input,110,FOLLOW_110_in_unaryExpression3659); if (failed) return ;
+                    pushFollow(FOLLOW_primary_in_unaryExpression3661);
+                    primary();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:863:9: unaryExpressionNotPlusMinus
+                    {
+                    pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_unaryExpression3671);
+                    unaryExpressionNotPlusMinus();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 116, unaryExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end unaryExpression
+
+
+    // $ANTLR start unaryExpressionNotPlusMinus
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );
+    public final void unaryExpressionNotPlusMinus() throws RecognitionException {
+        int unaryExpressionNotPlusMinus_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 117) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:867:5: ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? )
+            int alt149=4;
+            switch ( input.LA(1) ) {
+            case 111:
+                {
+                alt149=1;
+                }
+                break;
+            case 112:
+                {
+                alt149=2;
+                }
+                break;
+            case 65:
+                {
+                switch ( input.LA(2) ) {
+                case Identifier:
+                    {
+                    int LA149_17 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 17, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 55:
+                case 56:
+                case 57:
+                case 58:
+                case 59:
+                case 60:
+                case 61:
+                case 62:
+                    {
+                    int LA149_18 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 18, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 105:
+                    {
+                    int LA149_19 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 19, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 106:
+                    {
+                    int LA149_20 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 20, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 109:
+                    {
+                    int LA149_21 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 21, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 110:
+                    {
+                    int LA149_22 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 22, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 111:
+                    {
+                    int LA149_23 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 23, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 112:
+                    {
+                    int LA149_24 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 24, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 65:
+                    {
+                    int LA149_25 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 25, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 33:
+                    {
+                    int LA149_26 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 26, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 113:
+                    {
+                    int LA149_27 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 27, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 64:
+                    {
+                    int LA149_28 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 28, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case HexLiteral:
+                case OctalLiteral:
+                case DecimalLiteral:
+                    {
+                    int LA149_29 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 29, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case FloatingPointLiteral:
+                    {
+                    int LA149_30 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 30, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case CharacterLiteral:
+                    {
+                    int LA149_31 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 31, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case StringLiteral:
+                    {
+                    int LA149_32 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 32, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 69:
+                case 70:
+                    {
+                    int LA149_33 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 33, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 68:
+                    {
+                    int LA149_34 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 34, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 114:
+                    {
+                    int LA149_35 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 35, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                case 40:
+                    {
+                    int LA149_36 = input.LA(3);
+
+                    if ( (synpred226()) ) {
+                        alt149=3;
+                    }
+                    else if ( (true) ) {
+                        alt149=4;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 36, input);
+
+                        throw nvae;
+                    }
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 3, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case Identifier:
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 33:
+            case 40:
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+            case 64:
+            case 68:
+            case 69:
+            case 70:
+            case 113:
+            case 114:
+                {
+                alt149=4;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("866:1: unaryExpressionNotPlusMinus : ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? );", 149, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt149) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:867:9: '~' unaryExpression
+                    {
+                    match(input,111,FOLLOW_111_in_unaryExpressionNotPlusMinus3690); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus3692);
+                    unaryExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:868:8: '!' unaryExpression
+                    {
+                    match(input,112,FOLLOW_112_in_unaryExpressionNotPlusMinus3701); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus3703);
+                    unaryExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:869:9: castExpression
+                    {
+                    pushFollow(FOLLOW_castExpression_in_unaryExpressionNotPlusMinus3713);
+                    castExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:870:9: primary ( selector )* ( '++' | '--' )?
+                    {
+                    pushFollow(FOLLOW_primary_in_unaryExpressionNotPlusMinus3723);
+                    primary();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:870:17: ( selector )*
+                    loop147:
+                    do {
+                        int alt147=2;
+                        int LA147_0 = input.LA(1);
+
+                        if ( (LA147_0==28||LA147_0==41) ) {
+                            alt147=1;
+                        }
+
+
+                        switch (alt147) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: selector
+                    	    {
+                    	    pushFollow(FOLLOW_selector_in_unaryExpressionNotPlusMinus3725);
+                    	    selector();
+                    	    _fsp--;
+                    	    if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop147;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:870:27: ( '++' | '--' )?
+                    int alt148=2;
+                    int LA148_0 = input.LA(1);
+
+                    if ( ((LA148_0>=109 && LA148_0<=110)) ) {
+                        alt148=1;
+                    }
+                    switch (alt148) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:
+                            {
+                            if ( (input.LA(1)>=109 && input.LA(1)<=110) ) {
+                                input.consume();
+                                errorRecovery=false;failed=false;
+                            }
+                            else {
+                                if (backtracking>0) {failed=true; return ;}
+                                MismatchedSetException mse =
+                                    new MismatchedSetException(null,input);
+                                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_unaryExpressionNotPlusMinus3728);    throw mse;
+                            }
+
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 117, unaryExpressionNotPlusMinus_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end unaryExpressionNotPlusMinus
+
+
+    // $ANTLR start castExpression
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:873:1: castExpression : ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus );
+    public final void castExpression() throws RecognitionException {
+        int castExpression_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 118) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:874:5: ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus )
+            int alt151=2;
+            int LA151_0 = input.LA(1);
+
+            if ( (LA151_0==65) ) {
+                int LA151_1 = input.LA(2);
+
+                if ( ((LA151_1>=55 && LA151_1<=62)) ) {
+                    int LA151_2 = input.LA(3);
+
+                    if ( (synpred230()) ) {
+                        alt151=1;
+                    }
+                    else if ( (true) ) {
+                        alt151=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("873:1: castExpression : ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus );", 151, 2, input);
+
+                        throw nvae;
+                    }
+                }
+                else if ( (LA151_1==Identifier||(LA151_1>=FloatingPointLiteral && LA151_1<=DecimalLiteral)||LA151_1==33||LA151_1==40||(LA151_1>=64 && LA151_1<=65)||(LA151_1>=68 && LA151_1<=70)||(LA151_1>=105 && LA151_1<=106)||(LA151_1>=109 && LA151_1<=114)) ) {
+                    alt151=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("873:1: castExpression : ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus );", 151, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("873:1: castExpression : ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus );", 151, 0, input);
+
+                throw nvae;
+            }
+            switch (alt151) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:874:8: '(' primitiveType ')' unaryExpression
+                    {
+                    match(input,65,FOLLOW_65_in_castExpression3751); if (failed) return ;
+                    pushFollow(FOLLOW_primitiveType_in_castExpression3753);
+                    primitiveType();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,66,FOLLOW_66_in_castExpression3755); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpression_in_castExpression3757);
+                    unaryExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:8: '(' ( type | expression ) ')' unaryExpressionNotPlusMinus
+                    {
+                    match(input,65,FOLLOW_65_in_castExpression3766); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:12: ( type | expression )
+                    int alt150=2;
+                    switch ( input.LA(1) ) {
+                    case Identifier:
+                        {
+                        int LA150_1 = input.LA(2);
+
+                        if ( (synpred231()) ) {
+                            alt150=1;
+                        }
+                        else if ( (true) ) {
+                            alt150=2;
+                        }
+                        else {
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("875:12: ( type | expression )", 150, 1, input);
+
+                            throw nvae;
+                        }
+                        }
+                        break;
+                    case 55:
+                    case 56:
+                    case 57:
+                    case 58:
+                    case 59:
+                    case 60:
+                    case 61:
+                    case 62:
+                        {
+                        switch ( input.LA(2) ) {
+                        case 41:
+                            {
+                            int LA150_48 = input.LA(3);
+
+                            if ( (synpred231()) ) {
+                                alt150=1;
+                            }
+                            else if ( (true) ) {
+                                alt150=2;
+                            }
+                            else {
+                                if (backtracking>0) {failed=true; return ;}
+                                NoViableAltException nvae =
+                                    new NoViableAltException("875:12: ( type | expression )", 150, 48, input);
+
+                                throw nvae;
+                            }
+                            }
+                            break;
+                        case 66:
+                            {
+                            alt150=1;
+                            }
+                            break;
+                        case 28:
+                            {
+                            alt150=2;
+                            }
+                            break;
+                        default:
+                            if (backtracking>0) {failed=true; return ;}
+                            NoViableAltException nvae =
+                                new NoViableAltException("875:12: ( type | expression )", 150, 2, input);
+
+                            throw nvae;
+                        }
+
+                        }
+                        break;
+                    case FloatingPointLiteral:
+                    case CharacterLiteral:
+                    case StringLiteral:
+                    case HexLiteral:
+                    case OctalLiteral:
+                    case DecimalLiteral:
+                    case 33:
+                    case 40:
+                    case 64:
+                    case 65:
+                    case 68:
+                    case 69:
+                    case 70:
+                    case 105:
+                    case 106:
+                    case 109:
+                    case 110:
+                    case 111:
+                    case 112:
+                    case 113:
+                    case 114:
+                        {
+                        alt150=2;
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("875:12: ( type | expression )", 150, 0, input);
+
+                        throw nvae;
+                    }
+
+                    switch (alt150) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:13: type
+                            {
+                            pushFollow(FOLLOW_type_in_castExpression3769);
+                            type();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+                        case 2 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:20: expression
+                            {
+                            pushFollow(FOLLOW_expression_in_castExpression3773);
+                            expression();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,66,FOLLOW_66_in_castExpression3776); if (failed) return ;
+                    pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_castExpression3778);
+                    unaryExpressionNotPlusMinus();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 118, castExpression_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end castExpression
+
+
+    // $ANTLR start primary
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:878:1: primary : ( parExpression | nonWildcardTypeArguments ( explicitGenericInvocationSuffix | 'this' arguments ) | 'this' ( '.' Identifier )* ( identifierSuffix )? | 'super' superSuffix | literal | 'new' creator | i= Identifier ( '.' Identifier )* ( identifierSuffix )? | primitiveType ( '[' ']' )* '.' 'class' | 'void' '.' 'class' );
+    public final void primary() throws RecognitionException {
+        int primary_StartIndex = input.index();
+        Token i=null;
+
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 119) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:879:5: ( parExpression | nonWildcardTypeArguments ( explicitGenericInvocationSuffix | 'this' arguments ) | 'this' ( '.' Identifier )* ( identifierSuffix )? | 'super' superSuffix | literal | 'new' creator | i= Identifier ( '.' Identifier )* ( identifierSuffix )? | primitiveType ( '[' ']' )* '.' 'class' | 'void' '.' 'class' )
+            int alt158=9;
+            switch ( input.LA(1) ) {
+            case 65:
+                {
+                alt158=1;
+                }
+                break;
+            case 33:
+                {
+                alt158=2;
+                }
+                break;
+            case 113:
+                {
+                alt158=3;
+                }
+                break;
+            case 64:
+                {
+                alt158=4;
+                }
+                break;
+            case FloatingPointLiteral:
+            case CharacterLiteral:
+            case StringLiteral:
+            case HexLiteral:
+            case OctalLiteral:
+            case DecimalLiteral:
+            case 68:
+            case 69:
+            case 70:
+                {
+                alt158=5;
+                }
+                break;
+            case 114:
+                {
+                alt158=6;
+                }
+                break;
+            case Identifier:
+                {
+                alt158=7;
+                }
+                break;
+            case 55:
+            case 56:
+            case 57:
+            case 58:
+            case 59:
+            case 60:
+            case 61:
+            case 62:
+                {
+                alt158=8;
+                }
+                break;
+            case 40:
+                {
+                alt158=9;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("878:1: primary : ( parExpression | nonWildcardTypeArguments ( explicitGenericInvocationSuffix | 'this' arguments ) | 'this' ( '.' Identifier )* ( identifierSuffix )? | 'super' superSuffix | literal | 'new' creator | i= Identifier ( '.' Identifier )* ( identifierSuffix )? | primitiveType ( '[' ']' )* '.' 'class' | 'void' '.' 'class' );", 158, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt158) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:879:7: parExpression
+                    {
+                    pushFollow(FOLLOW_parExpression_in_primary3795);
+                    parExpression();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:880:9: nonWildcardTypeArguments ( explicitGenericInvocationSuffix | 'this' arguments )
+                    {
+                    pushFollow(FOLLOW_nonWildcardTypeArguments_in_primary3805);
+                    nonWildcardTypeArguments();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:881:9: ( explicitGenericInvocationSuffix | 'this' arguments )
+                    int alt152=2;
+                    int LA152_0 = input.LA(1);
+
+                    if ( (LA152_0==Identifier||LA152_0==64) ) {
+                        alt152=1;
+                    }
+                    else if ( (LA152_0==113) ) {
+                        alt152=2;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("881:9: ( explicitGenericInvocationSuffix | 'this' arguments )", 152, 0, input);
+
+                        throw nvae;
+                    }
+                    switch (alt152) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:881:10: explicitGenericInvocationSuffix
+                            {
+                            pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_primary3816);
+                            explicitGenericInvocationSuffix();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+                        case 2 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:881:44: 'this' arguments
+                            {
+                            match(input,113,FOLLOW_113_in_primary3820); if (failed) return ;
+                            pushFollow(FOLLOW_arguments_in_primary3822);
+                            arguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:9: 'this' ( '.' Identifier )* ( identifierSuffix )?
+                    {
+                    match(input,113,FOLLOW_113_in_primary3833); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:16: ( '.' Identifier )*
+                    loop153:
+                    do {
+                        int alt153=2;
+                        int LA153_0 = input.LA(1);
+
+                        if ( (LA153_0==28) ) {
+                            int LA153_3 = input.LA(2);
+
+                            if ( (LA153_3==Identifier) ) {
+                                int LA153_36 = input.LA(3);
+
+                                if ( (synpred235()) ) {
+                                    alt153=1;
+                                }
+
+
+                            }
+
+
+                        }
+
+
+                        switch (alt153) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:17: '.' Identifier
+                    	    {
+                    	    match(input,28,FOLLOW_28_in_primary3836); if (failed) return ;
+                    	    match(input,Identifier,FOLLOW_Identifier_in_primary3838); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop153;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:34: ( identifierSuffix )?
+                    int alt154=2;
+                    switch ( input.LA(1) ) {
+                        case 41:
+                            {
+                            switch ( input.LA(2) ) {
+                                case 42:
+                                    {
+                                    alt154=1;
+                                    }
+                                    break;
+                                case 105:
+                                    {
+                                    int LA154_34 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 106:
+                                    {
+                                    int LA154_35 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 109:
+                                    {
+                                    int LA154_36 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 110:
+                                    {
+                                    int LA154_37 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 111:
+                                    {
+                                    int LA154_38 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 112:
+                                    {
+                                    int LA154_39 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 65:
+                                    {
+                                    int LA154_40 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 33:
+                                    {
+                                    int LA154_41 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 113:
+                                    {
+                                    int LA154_42 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 64:
+                                    {
+                                    int LA154_43 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case HexLiteral:
+                                case OctalLiteral:
+                                case DecimalLiteral:
+                                    {
+                                    int LA154_44 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case FloatingPointLiteral:
+                                    {
+                                    int LA154_45 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case CharacterLiteral:
+                                    {
+                                    int LA154_46 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case StringLiteral:
+                                    {
+                                    int LA154_47 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 69:
+                                case 70:
+                                    {
+                                    int LA154_48 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 68:
+                                    {
+                                    int LA154_49 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 114:
+                                    {
+                                    int LA154_50 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case Identifier:
+                                    {
+                                    int LA154_51 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 55:
+                                case 56:
+                                case 57:
+                                case 58:
+                                case 59:
+                                case 60:
+                                case 61:
+                                case 62:
+                                    {
+                                    int LA154_52 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 40:
+                                    {
+                                    int LA154_53 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                            }
+
+                            }
+                            break;
+                        case 65:
+                            {
+                            alt154=1;
+                            }
+                            break;
+                        case 28:
+                            {
+                            switch ( input.LA(2) ) {
+                                case 113:
+                                    {
+                                    int LA154_54 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 30:
+                                case 33:
+                                    {
+                                    alt154=1;
+                                    }
+                                    break;
+                                case 64:
+                                    {
+                                    int LA154_56 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                                case 114:
+                                    {
+                                    int LA154_57 = input.LA(3);
+
+                                    if ( (synpred236()) ) {
+                                        alt154=1;
+                                    }
+                                    }
+                                    break;
+                            }
+
+                            }
+                            break;
+                    }
+
+                    switch (alt154) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:35: identifierSuffix
+                            {
+                            pushFollow(FOLLOW_identifierSuffix_in_primary3843);
+                            identifierSuffix();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:883:9: 'super' superSuffix
+                    {
+                    match(input,64,FOLLOW_64_in_primary3855); if (failed) return ;
+                    pushFollow(FOLLOW_superSuffix_in_primary3857);
+                    superSuffix();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:884:9: literal
+                    {
+                    pushFollow(FOLLOW_literal_in_primary3867);
+                    literal();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:885:9: 'new' creator
+                    {
+                    match(input,114,FOLLOW_114_in_primary3877); if (failed) return ;
+                    pushFollow(FOLLOW_creator_in_primary3879);
+                    creator();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:9: i= Identifier ( '.' Identifier )* ( identifierSuffix )?
+                    {
+                    i=(Token)input.LT(1);
+                    match(input,Identifier,FOLLOW_Identifier_in_primary3891); if (failed) return ;
+                    if ( backtracking==0 ) {
+                       if( ! "(".equals( input.LT(1) == null ? "" : input.LT(1).getText() ) ) identifiers.add( i.getText() );  
+                    }
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:126: ( '.' Identifier )*
+                    loop155:
+                    do {
+                        int alt155=2;
+                        int LA155_0 = input.LA(1);
+
+                        if ( (LA155_0==28) ) {
+                            int LA155_3 = input.LA(2);
+
+                            if ( (LA155_3==Identifier) ) {
+                                int LA155_37 = input.LA(3);
+
+                                if ( (synpred241()) ) {
+                                    alt155=1;
+                                }
+
+
+                            }
+
+
+                        }
+
+
+                        switch (alt155) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:127: '.' Identifier
+                    	    {
+                    	    match(input,28,FOLLOW_28_in_primary3896); if (failed) return ;
+                    	    match(input,Identifier,FOLLOW_Identifier_in_primary3898); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop155;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:144: ( identifierSuffix )?
+                    int alt156=2;
+                    switch ( input.LA(1) ) {
+                        case 41:
+                            {
+                            switch ( input.LA(2) ) {
+                                case 42:
+                                    {
+                                    alt156=1;
+                                    }
+                                    break;
+                                case 105:
+                                    {
+                                    int LA156_34 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 106:
+                                    {
+                                    int LA156_35 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 109:
+                                    {
+                                    int LA156_36 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 110:
+                                    {
+                                    int LA156_37 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 111:
+                                    {
+                                    int LA156_38 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 112:
+                                    {
+                                    int LA156_39 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 65:
+                                    {
+                                    int LA156_40 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 33:
+                                    {
+                                    int LA156_41 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 113:
+                                    {
+                                    int LA156_42 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 64:
+                                    {
+                                    int LA156_43 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case HexLiteral:
+                                case OctalLiteral:
+                                case DecimalLiteral:
+                                    {
+                                    int LA156_44 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case FloatingPointLiteral:
+                                    {
+                                    int LA156_45 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case CharacterLiteral:
+                                    {
+                                    int LA156_46 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case StringLiteral:
+                                    {
+                                    int LA156_47 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 69:
+                                case 70:
+                                    {
+                                    int LA156_48 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 68:
+                                    {
+                                    int LA156_49 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 114:
+                                    {
+                                    int LA156_50 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case Identifier:
+                                    {
+                                    int LA156_51 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 55:
+                                case 56:
+                                case 57:
+                                case 58:
+                                case 59:
+                                case 60:
+                                case 61:
+                                case 62:
+                                    {
+                                    int LA156_52 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 40:
+                                    {
+                                    int LA156_53 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                            }
+
+                            }
+                            break;
+                        case 65:
+                            {
+                            alt156=1;
+                            }
+                            break;
+                        case 28:
+                            {
+                            switch ( input.LA(2) ) {
+                                case 113:
+                                    {
+                                    int LA156_54 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 64:
+                                    {
+                                    int LA156_55 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 114:
+                                    {
+                                    int LA156_56 = input.LA(3);
+
+                                    if ( (synpred242()) ) {
+                                        alt156=1;
+                                    }
+                                    }
+                                    break;
+                                case 30:
+                                case 33:
+                                    {
+                                    alt156=1;
+                                    }
+                                    break;
+                            }
+
+                            }
+                            break;
+                    }
+
+                    switch (alt156) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:145: identifierSuffix
+                            {
+                            pushFollow(FOLLOW_identifierSuffix_in_primary3903);
+                            identifierSuffix();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 8 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:887:9: primitiveType ( '[' ']' )* '.' 'class'
+                    {
+                    pushFollow(FOLLOW_primitiveType_in_primary3915);
+                    primitiveType();
+                    _fsp--;
+                    if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:887:23: ( '[' ']' )*
+                    loop157:
+                    do {
+                        int alt157=2;
+                        int LA157_0 = input.LA(1);
+
+                        if ( (LA157_0==41) ) {
+                            alt157=1;
+                        }
+
+
+                        switch (alt157) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:887:24: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_primary3918); if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_primary3920); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop157;
+                        }
+                    } while (true);
+
+                    match(input,28,FOLLOW_28_in_primary3924); if (failed) return ;
+                    match(input,30,FOLLOW_30_in_primary3926); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:888:9: 'void' '.' 'class'
+                    {
+                    match(input,40,FOLLOW_40_in_primary3936); if (failed) return ;
+                    match(input,28,FOLLOW_28_in_primary3938); if (failed) return ;
+                    match(input,30,FOLLOW_30_in_primary3940); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 119, primary_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end primary
+
+
+    // $ANTLR start identifierSuffix
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:891:1: identifierSuffix : ( ( '[' ']' )+ '.' 'class' | ( '[' expression ']' )+ | arguments | '.' 'class' | '.' explicitGenericInvocation | '.' 'this' | '.' 'super' arguments | '.' 'new' ( nonWildcardTypeArguments )? innerCreator );
+    public final void identifierSuffix() throws RecognitionException {
+        int identifierSuffix_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 120) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:892:2: ( ( '[' ']' )+ '.' 'class' | ( '[' expression ']' )+ | arguments | '.' 'class' | '.' explicitGenericInvocation | '.' 'this' | '.' 'super' arguments | '.' 'new' ( nonWildcardTypeArguments )? innerCreator )
+            int alt162=8;
+            switch ( input.LA(1) ) {
+            case 41:
+                {
+                int LA162_1 = input.LA(2);
+
+                if ( (LA162_1==42) ) {
+                    alt162=1;
+                }
+                else if ( (LA162_1==Identifier||(LA162_1>=FloatingPointLiteral && LA162_1<=DecimalLiteral)||LA162_1==33||LA162_1==40||(LA162_1>=55 && LA162_1<=62)||(LA162_1>=64 && LA162_1<=65)||(LA162_1>=68 && LA162_1<=70)||(LA162_1>=105 && LA162_1<=106)||(LA162_1>=109 && LA162_1<=114)) ) {
+                    alt162=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("891:1: identifierSuffix : ( ( '[' ']' )+ '.' 'class' | ( '[' expression ']' )+ | arguments | '.' 'class' | '.' explicitGenericInvocation | '.' 'this' | '.' 'super' arguments | '.' 'new' ( nonWildcardTypeArguments )? innerCreator );", 162, 1, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case 65:
+                {
+                alt162=3;
+                }
+                break;
+            case 28:
+                {
+                switch ( input.LA(2) ) {
+                case 114:
+                    {
+                    alt162=8;
+                    }
+                    break;
+                case 113:
+                    {
+                    alt162=6;
+                    }
+                    break;
+                case 64:
+                    {
+                    alt162=7;
+                    }
+                    break;
+                case 30:
+                    {
+                    alt162=4;
+                    }
+                    break;
+                case 33:
+                    {
+                    alt162=5;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("891:1: identifierSuffix : ( ( '[' ']' )+ '.' 'class' | ( '[' expression ']' )+ | arguments | '.' 'class' | '.' explicitGenericInvocation | '.' 'this' | '.' 'super' arguments | '.' 'new' ( nonWildcardTypeArguments )? innerCreator );", 162, 3, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("891:1: identifierSuffix : ( ( '[' ']' )+ '.' 'class' | ( '[' expression ']' )+ | arguments | '.' 'class' | '.' explicitGenericInvocation | '.' 'this' | '.' 'super' arguments | '.' 'new' ( nonWildcardTypeArguments )? innerCreator );", 162, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt162) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:892:4: ( '[' ']' )+ '.' 'class'
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:892:4: ( '[' ']' )+
+                    int cnt159=0;
+                    loop159:
+                    do {
+                        int alt159=2;
+                        int LA159_0 = input.LA(1);
+
+                        if ( (LA159_0==41) ) {
+                            alt159=1;
+                        }
+
+
+                        switch (alt159) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:892:5: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_identifierSuffix3952); if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_identifierSuffix3954); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt159 >= 1 ) break loop159;
+                    	    if (backtracking>0) {failed=true; return ;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(159, input);
+                                throw eee;
+                        }
+                        cnt159++;
+                    } while (true);
+
+                    match(input,28,FOLLOW_28_in_identifierSuffix3958); if (failed) return ;
+                    match(input,30,FOLLOW_30_in_identifierSuffix3960); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:893:4: ( '[' expression ']' )+
+                    {
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:893:4: ( '[' expression ']' )+
+                    int cnt160=0;
+                    loop160:
+                    do {
+                        int alt160=2;
+                        int LA160_0 = input.LA(1);
+
+                        if ( (LA160_0==41) ) {
+                            switch ( input.LA(2) ) {
+                            case 105:
+                                {
+                                int LA160_32 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 106:
+                                {
+                                int LA160_33 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 109:
+                                {
+                                int LA160_34 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 110:
+                                {
+                                int LA160_35 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 111:
+                                {
+                                int LA160_36 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 112:
+                                {
+                                int LA160_37 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 65:
+                                {
+                                int LA160_38 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 33:
+                                {
+                                int LA160_39 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 113:
+                                {
+                                int LA160_40 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 64:
+                                {
+                                int LA160_41 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case HexLiteral:
+                            case OctalLiteral:
+                            case DecimalLiteral:
+                                {
+                                int LA160_42 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case FloatingPointLiteral:
+                                {
+                                int LA160_43 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case CharacterLiteral:
+                                {
+                                int LA160_44 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case StringLiteral:
+                                {
+                                int LA160_45 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 69:
+                            case 70:
+                                {
+                                int LA160_46 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 68:
+                                {
+                                int LA160_47 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 114:
+                                {
+                                int LA160_48 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case Identifier:
+                                {
+                                int LA160_49 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 55:
+                            case 56:
+                            case 57:
+                            case 58:
+                            case 59:
+                            case 60:
+                            case 61:
+                            case 62:
+                                {
+                                int LA160_50 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+                            case 40:
+                                {
+                                int LA160_51 = input.LA(3);
+
+                                if ( (synpred248()) ) {
+                                    alt160=1;
+                                }
+
+
+                                }
+                                break;
+
+                            }
+
+                        }
+
+
+                        switch (alt160) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:893:5: '[' expression ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_identifierSuffix3966); if (failed) return ;
+                    	    pushFollow(FOLLOW_expression_in_identifierSuffix3968);
+                    	    expression();
+                    	    _fsp--;
+                    	    if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_identifierSuffix3970); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt160 >= 1 ) break loop160;
+                    	    if (backtracking>0) {failed=true; return ;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(160, input);
+                                throw eee;
+                        }
+                        cnt160++;
+                    } while (true);
+
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:894:9: arguments
+                    {
+                    pushFollow(FOLLOW_arguments_in_identifierSuffix3983);
+                    arguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:895:9: '.' 'class'
+                    {
+                    match(input,28,FOLLOW_28_in_identifierSuffix3993); if (failed) return ;
+                    match(input,30,FOLLOW_30_in_identifierSuffix3995); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:896:9: '.' explicitGenericInvocation
+                    {
+                    match(input,28,FOLLOW_28_in_identifierSuffix4005); if (failed) return ;
+                    pushFollow(FOLLOW_explicitGenericInvocation_in_identifierSuffix4007);
+                    explicitGenericInvocation();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:897:9: '.' 'this'
+                    {
+                    match(input,28,FOLLOW_28_in_identifierSuffix4017); if (failed) return ;
+                    match(input,113,FOLLOW_113_in_identifierSuffix4019); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:898:9: '.' 'super' arguments
+                    {
+                    match(input,28,FOLLOW_28_in_identifierSuffix4029); if (failed) return ;
+                    match(input,64,FOLLOW_64_in_identifierSuffix4031); if (failed) return ;
+                    pushFollow(FOLLOW_arguments_in_identifierSuffix4033);
+                    arguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 8 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:899:9: '.' 'new' ( nonWildcardTypeArguments )? innerCreator
+                    {
+                    match(input,28,FOLLOW_28_in_identifierSuffix4043); if (failed) return ;
+                    match(input,114,FOLLOW_114_in_identifierSuffix4045); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:899:19: ( nonWildcardTypeArguments )?
+                    int alt161=2;
+                    int LA161_0 = input.LA(1);
+
+                    if ( (LA161_0==33) ) {
+                        alt161=1;
+                    }
+                    switch (alt161) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:899:20: nonWildcardTypeArguments
+                            {
+                            pushFollow(FOLLOW_nonWildcardTypeArguments_in_identifierSuffix4048);
+                            nonWildcardTypeArguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    pushFollow(FOLLOW_innerCreator_in_identifierSuffix4052);
+                    innerCreator();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 120, identifierSuffix_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end identifierSuffix
+
+
+    // $ANTLR start creator
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:902:1: creator : ( nonWildcardTypeArguments )? createdName ( arrayCreatorRest | classCreatorRest ) ;
+    public final void creator() throws RecognitionException {
+        int creator_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 121) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:903:2: ( ( nonWildcardTypeArguments )? createdName ( arrayCreatorRest | classCreatorRest ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:903:4: ( nonWildcardTypeArguments )? createdName ( arrayCreatorRest | classCreatorRest )
+            {
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:903:4: ( nonWildcardTypeArguments )?
+            int alt163=2;
+            int LA163_0 = input.LA(1);
+
+            if ( (LA163_0==33) ) {
+                alt163=1;
+            }
+            switch (alt163) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: nonWildcardTypeArguments
+                    {
+                    pushFollow(FOLLOW_nonWildcardTypeArguments_in_creator4064);
+                    nonWildcardTypeArguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_createdName_in_creator4067);
+            createdName();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:904:9: ( arrayCreatorRest | classCreatorRest )
+            int alt164=2;
+            int LA164_0 = input.LA(1);
+
+            if ( (LA164_0==41) ) {
+                alt164=1;
+            }
+            else if ( (LA164_0==65) ) {
+                alt164=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("904:9: ( arrayCreatorRest | classCreatorRest )", 164, 0, input);
+
+                throw nvae;
+            }
+            switch (alt164) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:904:10: arrayCreatorRest
+                    {
+                    pushFollow(FOLLOW_arrayCreatorRest_in_creator4078);
+                    arrayCreatorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:904:29: classCreatorRest
+                    {
+                    pushFollow(FOLLOW_classCreatorRest_in_creator4082);
+                    classCreatorRest();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 121, creator_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end creator
+
+
+    // $ANTLR start createdName
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:907:1: createdName : ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* | primitiveType );
+    public final void createdName() throws RecognitionException {
+        int createdName_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 122) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:908:2: ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* | primitiveType )
+            int alt168=2;
+            int LA168_0 = input.LA(1);
+
+            if ( (LA168_0==Identifier) ) {
+                alt168=1;
+            }
+            else if ( ((LA168_0>=55 && LA168_0<=62)) ) {
+                alt168=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("907:1: createdName : ( Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )* | primitiveType );", 168, 0, input);
+
+                throw nvae;
+            }
+            switch (alt168) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:908:4: Identifier ( typeArguments )? ( '.' Identifier ( typeArguments )? )*
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_createdName4094); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:908:15: ( typeArguments )?
+                    int alt165=2;
+                    int LA165_0 = input.LA(1);
+
+                    if ( (LA165_0==33) ) {
+                        alt165=1;
+                    }
+                    switch (alt165) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: typeArguments
+                            {
+                            pushFollow(FOLLOW_typeArguments_in_createdName4096);
+                            typeArguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:909:9: ( '.' Identifier ( typeArguments )? )*
+                    loop167:
+                    do {
+                        int alt167=2;
+                        int LA167_0 = input.LA(1);
+
+                        if ( (LA167_0==28) ) {
+                            alt167=1;
+                        }
+
+
+                        switch (alt167) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:909:10: '.' Identifier ( typeArguments )?
+                    	    {
+                    	    match(input,28,FOLLOW_28_in_createdName4108); if (failed) return ;
+                    	    match(input,Identifier,FOLLOW_Identifier_in_createdName4110); if (failed) return ;
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:909:25: ( typeArguments )?
+                    	    int alt166=2;
+                    	    int LA166_0 = input.LA(1);
+
+                    	    if ( (LA166_0==33) ) {
+                    	        alt166=1;
+                    	    }
+                    	    switch (alt166) {
+                    	        case 1 :
+                    	            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: typeArguments
+                    	            {
+                    	            pushFollow(FOLLOW_typeArguments_in_createdName4112);
+                    	            typeArguments();
+                    	            _fsp--;
+                    	            if (failed) return ;
+
+                    	            }
+                    	            break;
+
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop167;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:910:7: primitiveType
+                    {
+                    pushFollow(FOLLOW_primitiveType_in_createdName4123);
+                    primitiveType();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 122, createdName_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end createdName
+
+
+    // $ANTLR start innerCreator
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:913:1: innerCreator : Identifier classCreatorRest ;
+    public final void innerCreator() throws RecognitionException {
+        int innerCreator_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 123) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:914:2: ( Identifier classCreatorRest )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:914:4: Identifier classCreatorRest
+            {
+            match(input,Identifier,FOLLOW_Identifier_in_innerCreator4135); if (failed) return ;
+            pushFollow(FOLLOW_classCreatorRest_in_innerCreator4137);
+            classCreatorRest();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 123, innerCreator_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end innerCreator
+
+
+    // $ANTLR start arrayCreatorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:917:1: arrayCreatorRest : '[' ( ']' ( '[' ']' )* arrayInitializer | expression ']' ( '[' expression ']' )* ( '[' ']' )* ) ;
+    public final void arrayCreatorRest() throws RecognitionException {
+        int arrayCreatorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 124) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:918:2: ( '[' ( ']' ( '[' ']' )* arrayInitializer | expression ']' ( '[' expression ']' )* ( '[' ']' )* ) )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:918:4: '[' ( ']' ( '[' ']' )* arrayInitializer | expression ']' ( '[' expression ']' )* ( '[' ']' )* )
+            {
+            match(input,41,FOLLOW_41_in_arrayCreatorRest4148); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:919:9: ( ']' ( '[' ']' )* arrayInitializer | expression ']' ( '[' expression ']' )* ( '[' ']' )* )
+            int alt172=2;
+            int LA172_0 = input.LA(1);
+
+            if ( (LA172_0==42) ) {
+                alt172=1;
+            }
+            else if ( (LA172_0==Identifier||(LA172_0>=FloatingPointLiteral && LA172_0<=DecimalLiteral)||LA172_0==33||LA172_0==40||(LA172_0>=55 && LA172_0<=62)||(LA172_0>=64 && LA172_0<=65)||(LA172_0>=68 && LA172_0<=70)||(LA172_0>=105 && LA172_0<=106)||(LA172_0>=109 && LA172_0<=114)) ) {
+                alt172=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("919:9: ( ']' ( '[' ']' )* arrayInitializer | expression ']' ( '[' expression ']' )* ( '[' ']' )* )", 172, 0, input);
+
+                throw nvae;
+            }
+            switch (alt172) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:919:13: ']' ( '[' ']' )* arrayInitializer
+                    {
+                    match(input,42,FOLLOW_42_in_arrayCreatorRest4162); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:919:17: ( '[' ']' )*
+                    loop169:
+                    do {
+                        int alt169=2;
+                        int LA169_0 = input.LA(1);
+
+                        if ( (LA169_0==41) ) {
+                            alt169=1;
+                        }
+
+
+                        switch (alt169) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:919:18: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_arrayCreatorRest4165); if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_arrayCreatorRest4167); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop169;
+                        }
+                    } while (true);
+
+                    pushFollow(FOLLOW_arrayInitializer_in_arrayCreatorRest4171);
+                    arrayInitializer();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:13: expression ']' ( '[' expression ']' )* ( '[' ']' )*
+                    {
+                    pushFollow(FOLLOW_expression_in_arrayCreatorRest4185);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,42,FOLLOW_42_in_arrayCreatorRest4187); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:28: ( '[' expression ']' )*
+                    loop170:
+                    do {
+                        int alt170=2;
+                        int LA170_0 = input.LA(1);
+
+                        if ( (LA170_0==41) ) {
+                            switch ( input.LA(2) ) {
+                            case 105:
+                                {
+                                int LA170_33 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 106:
+                                {
+                                int LA170_34 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 109:
+                                {
+                                int LA170_35 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 110:
+                                {
+                                int LA170_36 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 111:
+                                {
+                                int LA170_37 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 112:
+                                {
+                                int LA170_38 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 65:
+                                {
+                                int LA170_39 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 33:
+                                {
+                                int LA170_40 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 113:
+                                {
+                                int LA170_41 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 64:
+                                {
+                                int LA170_42 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case HexLiteral:
+                            case OctalLiteral:
+                            case DecimalLiteral:
+                                {
+                                int LA170_43 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case FloatingPointLiteral:
+                                {
+                                int LA170_44 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case CharacterLiteral:
+                                {
+                                int LA170_45 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case StringLiteral:
+                                {
+                                int LA170_46 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 69:
+                            case 70:
+                                {
+                                int LA170_47 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 68:
+                                {
+                                int LA170_48 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 114:
+                                {
+                                int LA170_49 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case Identifier:
+                                {
+                                int LA170_50 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 55:
+                            case 56:
+                            case 57:
+                            case 58:
+                            case 59:
+                            case 60:
+                            case 61:
+                            case 62:
+                                {
+                                int LA170_51 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+                            case 40:
+                                {
+                                int LA170_52 = input.LA(3);
+
+                                if ( (synpred264()) ) {
+                                    alt170=1;
+                                }
+
+
+                                }
+                                break;
+
+                            }
+
+                        }
+
+
+                        switch (alt170) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:29: '[' expression ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_arrayCreatorRest4190); if (failed) return ;
+                    	    pushFollow(FOLLOW_expression_in_arrayCreatorRest4192);
+                    	    expression();
+                    	    _fsp--;
+                    	    if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_arrayCreatorRest4194); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop170;
+                        }
+                    } while (true);
+
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:50: ( '[' ']' )*
+                    loop171:
+                    do {
+                        int alt171=2;
+                        int LA171_0 = input.LA(1);
+
+                        if ( (LA171_0==41) ) {
+                            int LA171_30 = input.LA(2);
+
+                            if ( (LA171_30==42) ) {
+                                alt171=1;
+                            }
+
+
+                        }
+
+
+                        switch (alt171) {
+                    	case 1 :
+                    	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:51: '[' ']'
+                    	    {
+                    	    match(input,41,FOLLOW_41_in_arrayCreatorRest4199); if (failed) return ;
+                    	    match(input,42,FOLLOW_42_in_arrayCreatorRest4201); if (failed) return ;
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop171;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 124, arrayCreatorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end arrayCreatorRest
+
+
+    // $ANTLR start classCreatorRest
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:924:1: classCreatorRest : arguments ( classBody )? ;
+    public final void classCreatorRest() throws RecognitionException {
+        int classCreatorRest_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 125) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:925:2: ( arguments ( classBody )? )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:925:4: arguments ( classBody )?
+            {
+            pushFollow(FOLLOW_arguments_in_classCreatorRest4224);
+            arguments();
+            _fsp--;
+            if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:925:14: ( classBody )?
+            int alt173=2;
+            int LA173_0 = input.LA(1);
+
+            if ( (LA173_0==37) ) {
+                alt173=1;
+            }
+            switch (alt173) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: classBody
+                    {
+                    pushFollow(FOLLOW_classBody_in_classCreatorRest4226);
+                    classBody();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 125, classCreatorRest_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end classCreatorRest
+
+
+    // $ANTLR start explicitGenericInvocation
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:928:1: explicitGenericInvocation : nonWildcardTypeArguments explicitGenericInvocationSuffix ;
+    public final void explicitGenericInvocation() throws RecognitionException {
+        int explicitGenericInvocation_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 126) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:929:2: ( nonWildcardTypeArguments explicitGenericInvocationSuffix )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:929:4: nonWildcardTypeArguments explicitGenericInvocationSuffix
+            {
+            pushFollow(FOLLOW_nonWildcardTypeArguments_in_explicitGenericInvocation4239);
+            nonWildcardTypeArguments();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_explicitGenericInvocation4241);
+            explicitGenericInvocationSuffix();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 126, explicitGenericInvocation_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end explicitGenericInvocation
+
+
+    // $ANTLR start nonWildcardTypeArguments
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:932:1: nonWildcardTypeArguments : '<' typeList '>' ;
+    public final void nonWildcardTypeArguments() throws RecognitionException {
+        int nonWildcardTypeArguments_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 127) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:933:2: ( '<' typeList '>' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:933:4: '<' typeList '>'
+            {
+            match(input,33,FOLLOW_33_in_nonWildcardTypeArguments4253); if (failed) return ;
+            pushFollow(FOLLOW_typeList_in_nonWildcardTypeArguments4255);
+            typeList();
+            _fsp--;
+            if (failed) return ;
+            match(input,35,FOLLOW_35_in_nonWildcardTypeArguments4257); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 127, nonWildcardTypeArguments_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end nonWildcardTypeArguments
+
+
+    // $ANTLR start explicitGenericInvocationSuffix
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:936:1: explicitGenericInvocationSuffix : ( 'super' superSuffix | Identifier arguments );
+    public final void explicitGenericInvocationSuffix() throws RecognitionException {
+        int explicitGenericInvocationSuffix_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 128) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:937:2: ( 'super' superSuffix | Identifier arguments )
+            int alt174=2;
+            int LA174_0 = input.LA(1);
+
+            if ( (LA174_0==64) ) {
+                alt174=1;
+            }
+            else if ( (LA174_0==Identifier) ) {
+                alt174=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("936:1: explicitGenericInvocationSuffix : ( 'super' superSuffix | Identifier arguments );", 174, 0, input);
+
+                throw nvae;
+            }
+            switch (alt174) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:937:4: 'super' superSuffix
+                    {
+                    match(input,64,FOLLOW_64_in_explicitGenericInvocationSuffix4269); if (failed) return ;
+                    pushFollow(FOLLOW_superSuffix_in_explicitGenericInvocationSuffix4271);
+                    superSuffix();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:938:6: Identifier arguments
+                    {
+                    match(input,Identifier,FOLLOW_Identifier_in_explicitGenericInvocationSuffix4278); if (failed) return ;
+                    pushFollow(FOLLOW_arguments_in_explicitGenericInvocationSuffix4280);
+                    arguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 128, explicitGenericInvocationSuffix_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end explicitGenericInvocationSuffix
+
+
+    // $ANTLR start selector
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:941:1: selector : ( '.' Identifier ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' );
+    public final void selector() throws RecognitionException {
+        int selector_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 129) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:942:2: ( '.' Identifier ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' )
+            int alt177=5;
+            int LA177_0 = input.LA(1);
+
+            if ( (LA177_0==28) ) {
+                switch ( input.LA(2) ) {
+                case Identifier:
+                    {
+                    alt177=1;
+                    }
+                    break;
+                case 113:
+                    {
+                    alt177=2;
+                    }
+                    break;
+                case 114:
+                    {
+                    alt177=4;
+                    }
+                    break;
+                case 64:
+                    {
+                    alt177=3;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("941:1: selector : ( '.' Identifier ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' );", 177, 1, input);
+
+                    throw nvae;
+                }
+
+            }
+            else if ( (LA177_0==41) ) {
+                alt177=5;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("941:1: selector : ( '.' Identifier ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' );", 177, 0, input);
+
+                throw nvae;
+            }
+            switch (alt177) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:942:4: '.' Identifier ( arguments )?
+                    {
+                    match(input,28,FOLLOW_28_in_selector4292); if (failed) return ;
+                    match(input,Identifier,FOLLOW_Identifier_in_selector4294); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:942:19: ( arguments )?
+                    int alt175=2;
+                    int LA175_0 = input.LA(1);
+
+                    if ( (LA175_0==65) ) {
+                        alt175=1;
+                    }
+                    switch (alt175) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:942:20: arguments
+                            {
+                            pushFollow(FOLLOW_arguments_in_selector4297);
+                            arguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:943:6: '.' 'this'
+                    {
+                    match(input,28,FOLLOW_28_in_selector4306); if (failed) return ;
+                    match(input,113,FOLLOW_113_in_selector4308); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:944:6: '.' 'super' superSuffix
+                    {
+                    match(input,28,FOLLOW_28_in_selector4315); if (failed) return ;
+                    match(input,64,FOLLOW_64_in_selector4317); if (failed) return ;
+                    pushFollow(FOLLOW_superSuffix_in_selector4319);
+                    superSuffix();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:945:6: '.' 'new' ( nonWildcardTypeArguments )? innerCreator
+                    {
+                    match(input,28,FOLLOW_28_in_selector4326); if (failed) return ;
+                    match(input,114,FOLLOW_114_in_selector4328); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:945:16: ( nonWildcardTypeArguments )?
+                    int alt176=2;
+                    int LA176_0 = input.LA(1);
+
+                    if ( (LA176_0==33) ) {
+                        alt176=1;
+                    }
+                    switch (alt176) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:945:17: nonWildcardTypeArguments
+                            {
+                            pushFollow(FOLLOW_nonWildcardTypeArguments_in_selector4331);
+                            nonWildcardTypeArguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    pushFollow(FOLLOW_innerCreator_in_selector4335);
+                    innerCreator();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:946:6: '[' expression ']'
+                    {
+                    match(input,41,FOLLOW_41_in_selector4342); if (failed) return ;
+                    pushFollow(FOLLOW_expression_in_selector4344);
+                    expression();
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,42,FOLLOW_42_in_selector4346); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 129, selector_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end selector
+
+
+    // $ANTLR start superSuffix
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:949:1: superSuffix : ( arguments | '.' Identifier ( arguments )? );
+    public final void superSuffix() throws RecognitionException {
+        int superSuffix_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 130) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:950:2: ( arguments | '.' Identifier ( arguments )? )
+            int alt179=2;
+            int LA179_0 = input.LA(1);
+
+            if ( (LA179_0==65) ) {
+                alt179=1;
+            }
+            else if ( (LA179_0==28) ) {
+                alt179=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("949:1: superSuffix : ( arguments | '.' Identifier ( arguments )? );", 179, 0, input);
+
+                throw nvae;
+            }
+            switch (alt179) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:950:4: arguments
+                    {
+                    pushFollow(FOLLOW_arguments_in_superSuffix4358);
+                    arguments();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:951:6: '.' Identifier ( arguments )?
+                    {
+                    match(input,28,FOLLOW_28_in_superSuffix4365); if (failed) return ;
+                    match(input,Identifier,FOLLOW_Identifier_in_superSuffix4367); if (failed) return ;
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:951:21: ( arguments )?
+                    int alt178=2;
+                    int LA178_0 = input.LA(1);
+
+                    if ( (LA178_0==65) ) {
+                        alt178=1;
+                    }
+                    switch (alt178) {
+                        case 1 :
+                            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:951:22: arguments
+                            {
+                            pushFollow(FOLLOW_arguments_in_superSuffix4370);
+                            arguments();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 130, superSuffix_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end superSuffix
+
+
+    // $ANTLR start arguments
+    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:954:1: arguments : '(' ( expressionList )? ')' ;
+    public final void arguments() throws RecognitionException {
+        int arguments_StartIndex = input.index();
+        try {
+            if ( backtracking>0 && alreadyParsedRule(input, 131) ) { return ; }
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:955:2: ( '(' ( expressionList )? ')' )
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:955:4: '(' ( expressionList )? ')'
+            {
+            match(input,65,FOLLOW_65_in_arguments4386); if (failed) return ;
+            // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:955:8: ( expressionList )?
+            int alt180=2;
+            int LA180_0 = input.LA(1);
+
+            if ( (LA180_0==Identifier||(LA180_0>=FloatingPointLiteral && LA180_0<=DecimalLiteral)||LA180_0==33||LA180_0==40||(LA180_0>=55 && LA180_0<=62)||(LA180_0>=64 && LA180_0<=65)||(LA180_0>=68 && LA180_0<=70)||(LA180_0>=105 && LA180_0<=106)||(LA180_0>=109 && LA180_0<=114)) ) {
+                alt180=1;
+            }
+            switch (alt180) {
+                case 1 :
+                    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: expressionList
+                    {
+                    pushFollow(FOLLOW_expressionList_in_arguments4388);
+                    expressionList();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            match(input,66,FOLLOW_66_in_arguments4391); if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            if ( backtracking>0 ) { memoize(input, 131, arguments_StartIndex); }
+        }
+        return ;
+    }
+    // $ANTLR end arguments
+
+    // $ANTLR start synpred1
+    public final void synpred1_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:207:4: ( annotations )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:207:4: annotations
+        {
+        pushFollow(FOLLOW_annotations_in_synpred170);
+        annotations();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred1
+
+    // $ANTLR start synpred38
+    public final void synpred38_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:303:4: ( methodDeclaration )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:303:4: methodDeclaration
+        {
+        pushFollow(FOLLOW_methodDeclaration_in_synpred38577);
+        methodDeclaration();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred38
+
+    // $ANTLR start synpred39
+    public final void synpred39_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:304:4: ( fieldDeclaration )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:304:4: fieldDeclaration
+        {
+        pushFollow(FOLLOW_fieldDeclaration_in_synpred39582);
+        fieldDeclaration();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred39
+
+    // $ANTLR start synpred85
+    public final void synpred85_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:16: ( '.' Identifier )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:459:16: '.' Identifier
+        {
+        match(input,28,FOLLOW_28_in_synpred851389); if (failed) return ;
+        match(input,Identifier,FOLLOW_Identifier_in_synpred851391); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred85
+
+    // $ANTLR start synpred120
+    public final void synpred120_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:549:4: ( annotation )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:549:4: annotation
+        {
+        pushFollow(FOLLOW_annotation_in_synpred1201893);
+        annotation();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred120
+
+    // $ANTLR start synpred135
+    public final void synpred135_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:596:6: ( classDeclaration ( ';' )? )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:596:6: classDeclaration ( ';' )?
+        {
+        pushFollow(FOLLOW_classDeclaration_in_synpred1352123);
+        classDeclaration();
+        _fsp--;
+        if (failed) return ;
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:596:23: ( ';' )?
+        int alt196=2;
+        int LA196_0 = input.LA(1);
+
+        if ( (LA196_0==25) ) {
+            alt196=1;
+        }
+        switch (alt196) {
+            case 1 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                {
+                match(input,25,FOLLOW_25_in_synpred1352125); if (failed) return ;
+
+                }
+                break;
+
+        }
+
+
+        }
+    }
+    // $ANTLR end synpred135
+
+    // $ANTLR start synpred137
+    public final void synpred137_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:597:6: ( interfaceDeclaration ( ';' )? )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:597:6: interfaceDeclaration ( ';' )?
+        {
+        pushFollow(FOLLOW_interfaceDeclaration_in_synpred1372133);
+        interfaceDeclaration();
+        _fsp--;
+        if (failed) return ;
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:597:27: ( ';' )?
+        int alt197=2;
+        int LA197_0 = input.LA(1);
+
+        if ( (LA197_0==25) ) {
+            alt197=1;
+        }
+        switch (alt197) {
+            case 1 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                {
+                match(input,25,FOLLOW_25_in_synpred1372135); if (failed) return ;
+
+                }
+                break;
+
+        }
+
+
+        }
+    }
+    // $ANTLR end synpred137
+
+    // $ANTLR start synpred139
+    public final void synpred139_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:598:6: ( enumDeclaration ( ';' )? )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:598:6: enumDeclaration ( ';' )?
+        {
+        pushFollow(FOLLOW_enumDeclaration_in_synpred1392143);
+        enumDeclaration();
+        _fsp--;
+        if (failed) return ;
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:598:22: ( ';' )?
+        int alt198=2;
+        int LA198_0 = input.LA(1);
+
+        if ( (LA198_0==25) ) {
+            alt198=1;
+        }
+        switch (alt198) {
+            case 1 :
+                // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: ';'
+                {
+                match(input,25,FOLLOW_25_in_synpred1392145); if (failed) return ;
+
+                }
+                break;
+
+        }
+
+
+        }
+    }
+    // $ANTLR end synpred139
+
+    // $ANTLR start synpred144
+    public final void synpred144_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:632:4: ( localVariableDeclaration )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:632:4: localVariableDeclaration
+        {
+        pushFollow(FOLLOW_localVariableDeclaration_in_synpred1442286);
+        localVariableDeclaration();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred144
+
+    // $ANTLR start synpred145
+    public final void synpred145_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:633:4: ( classOrInterfaceDeclaration )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:633:4: classOrInterfaceDeclaration
+        {
+        pushFollow(FOLLOW_classOrInterfaceDeclaration_in_synpred1452291);
+        classOrInterfaceDeclaration();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred145
+
+    // $ANTLR start synpred150
+    public final void synpred150_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:666:52: ( 'else' statement )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:666:52: 'else' statement
+        {
+        match(input,76,FOLLOW_76_in_synpred1502431); if (failed) return ;
+        pushFollow(FOLLOW_statement_in_synpred1502433);
+        statement();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred150
+
+    // $ANTLR start synpred155
+    public final void synpred155_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:671:9: ( catches 'finally' block )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:671:9: catches 'finally' block
+        {
+        pushFollow(FOLLOW_catches_in_synpred1552499);
+        catches();
+        _fsp--;
+        if (failed) return ;
+        match(input,81,FOLLOW_81_in_synpred1552501); if (failed) return ;
+        pushFollow(FOLLOW_block_in_synpred1552503);
+        block();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred155
+
+    // $ANTLR start synpred156
+    public final void synpred156_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:672:9: ( catches )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:672:9: catches
+        {
+        pushFollow(FOLLOW_catches_in_synpred1562513);
+        catches();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred156
+
+    // $ANTLR start synpred176
+    public final void synpred176_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:729:4: ( 'case' constantExpression ':' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:729:4: 'case' constantExpression ':'
+        {
+        match(input,89,FOLLOW_89_in_synpred1762836); if (failed) return ;
+        pushFollow(FOLLOW_constantExpression_in_synpred1762838);
+        constantExpression();
+        _fsp--;
+        if (failed) return ;
+        match(input,74,FOLLOW_74_in_synpred1762840); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred176
+
+    // $ANTLR start synpred177
+    public final void synpred177_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:730:6: ( 'case' enumConstantName ':' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:730:6: 'case' enumConstantName ':'
+        {
+        match(input,89,FOLLOW_89_in_synpred1772847); if (failed) return ;
+        pushFollow(FOLLOW_enumConstantName_in_synpred1772849);
+        enumConstantName();
+        _fsp--;
+        if (failed) return ;
+        match(input,74,FOLLOW_74_in_synpred1772851); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred177
+
+    // $ANTLR start synpred179
+    public final void synpred179_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:740:4: ( forVarControl )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:740:4: forVarControl
+        {
+        pushFollow(FOLLOW_forVarControl_in_synpred1792896);
+        forVarControl();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred179
+
+    // $ANTLR start synpred184
+    public final void synpred184_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:4: ( ( variableModifier )* type variableDeclarators )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:4: ( variableModifier )* type variableDeclarators
+        {
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:751:4: ( variableModifier )*
+        loop206:
+        do {
+            int alt206=2;
+            int LA206_0 = input.LA(1);
+
+            if ( (LA206_0==49||LA206_0==71) ) {
+                alt206=1;
+            }
+
+
+            switch (alt206) {
+        	case 1 :
+        	    // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:0:0: variableModifier
+        	    {
+        	    pushFollow(FOLLOW_variableModifier_in_synpred1842949);
+        	    variableModifier();
+        	    _fsp--;
+        	    if (failed) return ;
+
+        	    }
+        	    break;
+
+        	default :
+        	    break loop206;
+            }
+        } while (true);
+
+        pushFollow(FOLLOW_type_in_synpred1842952);
+        type();
+        _fsp--;
+        if (failed) return ;
+        pushFollow(FOLLOW_variableDeclarators_in_synpred1842954);
+        variableDeclarators();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred184
+
+    // $ANTLR start synpred187
+    public final void synpred187_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:27: ( assignmentOperator expression )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:782:27: assignmentOperator expression
+        {
+        pushFollow(FOLLOW_assignmentOperator_in_synpred1873073);
+        assignmentOperator();
+        _fsp--;
+        if (failed) return ;
+        pushFollow(FOLLOW_expression_in_synpred1873075);
+        expression();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred187
+
+    // $ANTLR start synpred198
+    public final void synpred198_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:796:9: ( '>' '>' '=' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:796:9: '>' '>' '='
+        {
+        match(input,35,FOLLOW_35_in_synpred1983193); if (failed) return ;
+        match(input,35,FOLLOW_35_in_synpred1983195); if (failed) return ;
+        match(input,44,FOLLOW_44_in_synpred1983197); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred198
+
+    // $ANTLR start synpred208
+    public final void synpred208_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:27: ( relationalOp shiftExpression )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:833:27: relationalOp shiftExpression
+        {
+        pushFollow(FOLLOW_relationalOp_in_synpred2083441);
+        relationalOp();
+        _fsp--;
+        if (failed) return ;
+        pushFollow(FOLLOW_shiftExpression_in_synpred2083443);
+        shiftExpression();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred208
+
+    // $ANTLR start synpred212
+    public final void synpred212_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:30: ( shiftOp additiveExpression )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:841:30: shiftOp additiveExpression
+        {
+        pushFollow(FOLLOW_shiftOp_in_synpred2123496);
+        shiftOp();
+        _fsp--;
+        if (failed) return ;
+        pushFollow(FOLLOW_additiveExpression_in_synpred2123498);
+        additiveExpression();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred212
+
+    // $ANTLR start synpred214
+    public final void synpred214_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:15: ( '>' '>' '>' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:846:15: '>' '>' '>'
+        {
+        match(input,35,FOLLOW_35_in_synpred2143528); if (failed) return ;
+        match(input,35,FOLLOW_35_in_synpred2143530); if (failed) return ;
+        match(input,35,FOLLOW_35_in_synpred2143532); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred214
+
+    // $ANTLR start synpred226
+    public final void synpred226_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:869:9: ( castExpression )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:869:9: castExpression
+        {
+        pushFollow(FOLLOW_castExpression_in_synpred2263713);
+        castExpression();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred226
+
+    // $ANTLR start synpred230
+    public final void synpred230_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:874:8: ( '(' primitiveType ')' unaryExpression )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:874:8: '(' primitiveType ')' unaryExpression
+        {
+        match(input,65,FOLLOW_65_in_synpred2303751); if (failed) return ;
+        pushFollow(FOLLOW_primitiveType_in_synpred2303753);
+        primitiveType();
+        _fsp--;
+        if (failed) return ;
+        match(input,66,FOLLOW_66_in_synpred2303755); if (failed) return ;
+        pushFollow(FOLLOW_unaryExpression_in_synpred2303757);
+        unaryExpression();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred230
+
+    // $ANTLR start synpred231
+    public final void synpred231_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:13: ( type )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:875:13: type
+        {
+        pushFollow(FOLLOW_type_in_synpred2313769);
+        type();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred231
+
+    // $ANTLR start synpred235
+    public final void synpred235_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:17: ( '.' Identifier )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:17: '.' Identifier
+        {
+        match(input,28,FOLLOW_28_in_synpred2353836); if (failed) return ;
+        match(input,Identifier,FOLLOW_Identifier_in_synpred2353838); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred235
+
+    // $ANTLR start synpred236
+    public final void synpred236_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:35: ( identifierSuffix )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:882:35: identifierSuffix
+        {
+        pushFollow(FOLLOW_identifierSuffix_in_synpred2363843);
+        identifierSuffix();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred236
+
+    // $ANTLR start synpred241
+    public final void synpred241_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:127: ( '.' Identifier )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:127: '.' Identifier
+        {
+        match(input,28,FOLLOW_28_in_synpred2413896); if (failed) return ;
+        match(input,Identifier,FOLLOW_Identifier_in_synpred2413898); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred241
+
+    // $ANTLR start synpred242
+    public final void synpred242_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:145: ( identifierSuffix )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:886:145: identifierSuffix
+        {
+        pushFollow(FOLLOW_identifierSuffix_in_synpred2423903);
+        identifierSuffix();
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred242
+
+    // $ANTLR start synpred248
+    public final void synpred248_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:893:5: ( '[' expression ']' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:893:5: '[' expression ']'
+        {
+        match(input,41,FOLLOW_41_in_synpred2483966); if (failed) return ;
+        pushFollow(FOLLOW_expression_in_synpred2483968);
+        expression();
+        _fsp--;
+        if (failed) return ;
+        match(input,42,FOLLOW_42_in_synpred2483970); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred248
+
+    // $ANTLR start synpred264
+    public final void synpred264_fragment() throws RecognitionException {   
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:29: ( '[' expression ']' )
+        // /home/etirelli/workspace/jboss/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/Java.g:920:29: '[' expression ']'
+        {
+        match(input,41,FOLLOW_41_in_synpred2644190); if (failed) return ;
+        pushFollow(FOLLOW_expression_in_synpred2644192);
+        expression();
+        _fsp--;
+        if (failed) return ;
+        match(input,42,FOLLOW_42_in_synpred2644194); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred264
+
+    public final boolean synpred139() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred139_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred242() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred242_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred156() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred156_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred120() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred120_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred264() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred264_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred38() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred38_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred184() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred184_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred155() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred155_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred235() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred235_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred85() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred85_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred39() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred39_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred1() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred1_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred177() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred177_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred212() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred212_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred198() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred198_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred145() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred145_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred176() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred176_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred208() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred208_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred241() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred241_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred187() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred187_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred135() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred135_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred231() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred231_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred236() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred236_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred214() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred214_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred179() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred179_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred150() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred150_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred137() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred137_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred248() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred248_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred144() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred144_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred226() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred226_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred230() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred230_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+
+
+ 
+
+    public static final BitSet FOLLOW_annotations_in_compilationUnit70 = new BitSet(new long[]{0x007FE0804F000022L,0x0000000000000080L});
+    public static final BitSet FOLLOW_packageDeclaration_in_compilationUnit75 = new BitSet(new long[]{0x007FE0804E000022L,0x0000000000000080L});
+    public static final BitSet FOLLOW_importDeclaration_in_compilationUnit86 = new BitSet(new long[]{0x007FE0804E000022L,0x0000000000000080L});
+    public static final BitSet FOLLOW_typeDeclaration_in_compilationUnit97 = new BitSet(new long[]{0x007FE0804A000022L,0x0000000000000080L});
+    public static final BitSet FOLLOW_24_in_packageDeclaration109 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedName_in_packageDeclaration111 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_packageDeclaration113 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_26_in_importDeclaration125 = new BitSet(new long[]{0x0000000008000010L});
+    public static final BitSet FOLLOW_27_in_importDeclaration127 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_importDeclaration130 = new BitSet(new long[]{0x0000000012000000L});
+    public static final BitSet FOLLOW_28_in_importDeclaration133 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_importDeclaration135 = new BitSet(new long[]{0x0000000012000000L});
+    public static final BitSet FOLLOW_28_in_importDeclaration140 = new BitSet(new long[]{0x0000000020000000L});
+    public static final BitSet FOLLOW_29_in_importDeclaration142 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_importDeclaration146 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classOrInterfaceDeclaration_in_typeDeclaration158 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_typeDeclaration168 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_modifier_in_classOrInterfaceDeclaration180 = new BitSet(new long[]{0x007FE08048000020L,0x0000000000000080L});
+    public static final BitSet FOLLOW_classDeclaration_in_classOrInterfaceDeclaration184 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceDeclaration_in_classOrInterfaceDeclaration188 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_normalClassDeclaration_in_classDeclaration201 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enumDeclaration_in_classDeclaration211 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_30_in_normalClassDeclaration223 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_normalClassDeclaration225 = new BitSet(new long[]{0x0000002380000000L});
+    public static final BitSet FOLLOW_typeParameters_in_normalClassDeclaration228 = new BitSet(new long[]{0x0000002180000000L});
+    public static final BitSet FOLLOW_31_in_normalClassDeclaration241 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_type_in_normalClassDeclaration243 = new BitSet(new long[]{0x0000002100000000L});
+    public static final BitSet FOLLOW_32_in_normalClassDeclaration256 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_typeList_in_normalClassDeclaration258 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_classBody_in_normalClassDeclaration270 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_33_in_typeParameters282 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_typeParameter_in_typeParameters284 = new BitSet(new long[]{0x0000000C00000000L});
+    public static final BitSet FOLLOW_34_in_typeParameters287 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_typeParameter_in_typeParameters289 = new BitSet(new long[]{0x0000000C00000000L});
+    public static final BitSet FOLLOW_35_in_typeParameters293 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_typeParameter304 = new BitSet(new long[]{0x0000000080000002L});
+    public static final BitSet FOLLOW_31_in_typeParameter307 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_bound_in_typeParameter309 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_bound324 = new BitSet(new long[]{0x0000001000000002L});
+    public static final BitSet FOLLOW_36_in_bound327 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_type_in_bound329 = new BitSet(new long[]{0x0000001000000002L});
+    public static final BitSet FOLLOW_ENUM_in_enumDeclaration342 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_enumDeclaration344 = new BitSet(new long[]{0x0000002100000000L});
+    public static final BitSet FOLLOW_32_in_enumDeclaration347 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_typeList_in_enumDeclaration349 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_enumBody_in_enumDeclaration353 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_enumBody365 = new BitSet(new long[]{0x0000004402000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_enumConstants_in_enumBody367 = new BitSet(new long[]{0x0000004402000000L});
+    public static final BitSet FOLLOW_34_in_enumBody370 = new BitSet(new long[]{0x0000004002000000L});
+    public static final BitSet FOLLOW_enumBodyDeclarations_in_enumBody373 = new BitSet(new long[]{0x0000004000000000L});
+    public static final BitSet FOLLOW_38_in_enumBody376 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enumConstant_in_enumConstants387 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_enumConstants390 = new BitSet(new long[]{0x0000000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_enumConstant_in_enumConstants392 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_annotations_in_enumConstant406 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_enumConstant409 = new BitSet(new long[]{0x0000002000000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_enumConstant412 = new BitSet(new long[]{0x0000002000000002L});
+    public static final BitSet FOLLOW_classBody_in_enumConstant417 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_enumBodyDeclarations431 = new BitSet(new long[]{0x7FFFE1A24A000032L,0x0000000000000080L});
+    public static final BitSet FOLLOW_classBodyDeclaration_in_enumBodyDeclarations434 = new BitSet(new long[]{0x7FFFE1A24A000032L,0x0000000000000080L});
+    public static final BitSet FOLLOW_normalInterfaceDeclaration_in_interfaceDeclaration448 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotationTypeDeclaration_in_interfaceDeclaration454 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_39_in_normalInterfaceDeclaration466 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_normalInterfaceDeclaration468 = new BitSet(new long[]{0x0000002280000000L});
+    public static final BitSet FOLLOW_typeParameters_in_normalInterfaceDeclaration470 = new BitSet(new long[]{0x0000002080000000L});
+    public static final BitSet FOLLOW_31_in_normalInterfaceDeclaration474 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_typeList_in_normalInterfaceDeclaration476 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_interfaceBody_in_normalInterfaceDeclaration480 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_typeList492 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_typeList495 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_type_in_typeList497 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_37_in_classBody511 = new BitSet(new long[]{0x7FFFE1E24A000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_classBodyDeclaration_in_classBody513 = new BitSet(new long[]{0x7FFFE1E24A000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_38_in_classBody516 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_interfaceBody528 = new BitSet(new long[]{0x7FFFE1C24A000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_interfaceBodyDeclaration_in_interfaceBody530 = new BitSet(new long[]{0x7FFFE1C24A000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_38_in_interfaceBody533 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_classBodyDeclaration544 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_27_in_classBodyDeclaration549 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_classBodyDeclaration552 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_modifier_in_classBodyDeclaration557 = new BitSet(new long[]{0x7FFFE18248000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_memberDecl_in_classBodyDeclaration560 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_genericMethodOrConstructorDecl_in_memberDecl572 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_methodDeclaration_in_memberDecl577 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fieldDeclaration_in_memberDecl582 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_40_in_memberDecl587 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_memberDecl589 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_voidMethodDeclaratorRest_in_memberDecl591 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_memberDecl596 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_constructorDeclaratorRest_in_memberDecl598 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceDeclaration_in_memberDecl603 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classDeclaration_in_memberDecl608 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_typeParameters_in_genericMethodOrConstructorDecl620 = new BitSet(new long[]{0x7F80010000000010L});
+    public static final BitSet FOLLOW_genericMethodOrConstructorRest_in_genericMethodOrConstructorDecl622 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_genericMethodOrConstructorRest635 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_40_in_genericMethodOrConstructorRest639 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_genericMethodOrConstructorRest642 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_methodDeclaratorRest_in_genericMethodOrConstructorRest644 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_genericMethodOrConstructorRest649 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_constructorDeclaratorRest_in_genericMethodOrConstructorRest651 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_methodDeclaration662 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_methodDeclaration664 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_methodDeclaratorRest_in_methodDeclaration666 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_fieldDeclaration677 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclarators_in_fieldDeclaration679 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_fieldDeclaration681 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_modifier_in_interfaceBodyDeclaration694 = new BitSet(new long[]{0x7FFFE18248000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_interfaceMemberDecl_in_interfaceBodyDeclaration697 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_interfaceBodyDeclaration704 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceMethodOrFieldDecl_in_interfaceMemberDecl715 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceGenericMethodDecl_in_interfaceMemberDecl722 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_40_in_interfaceMemberDecl732 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_interfaceMemberDecl734 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_voidInterfaceMethodDeclaratorRest_in_interfaceMemberDecl736 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceDeclaration_in_interfaceMemberDecl746 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classDeclaration_in_interfaceMemberDecl756 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_interfaceMethodOrFieldDecl768 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_interfaceMethodOrFieldDecl770 = new BitSet(new long[]{0x0000120000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceMethodOrFieldRest_in_interfaceMethodOrFieldDecl772 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_constantDeclaratorsRest_in_interfaceMethodOrFieldRest784 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_interfaceMethodOrFieldRest786 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceMethodDeclaratorRest_in_interfaceMethodOrFieldRest791 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_formalParameters_in_methodDeclaratorRest803 = new BitSet(new long[]{0x00000A2002000000L});
+    public static final BitSet FOLLOW_41_in_methodDeclaratorRest806 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_methodDeclaratorRest808 = new BitSet(new long[]{0x00000A2002000000L});
+    public static final BitSet FOLLOW_43_in_methodDeclaratorRest821 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedNameList_in_methodDeclaratorRest823 = new BitSet(new long[]{0x0000002002000000L});
+    public static final BitSet FOLLOW_methodBody_in_methodDeclaratorRest839 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_methodDeclaratorRest853 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_formalParameters_in_voidMethodDeclaratorRest875 = new BitSet(new long[]{0x0000082002000000L});
+    public static final BitSet FOLLOW_43_in_voidMethodDeclaratorRest878 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedNameList_in_voidMethodDeclaratorRest880 = new BitSet(new long[]{0x0000002002000000L});
+    public static final BitSet FOLLOW_methodBody_in_voidMethodDeclaratorRest896 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_voidMethodDeclaratorRest910 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_formalParameters_in_interfaceMethodDeclaratorRest932 = new BitSet(new long[]{0x00000A0002000000L});
+    public static final BitSet FOLLOW_41_in_interfaceMethodDeclaratorRest935 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_interfaceMethodDeclaratorRest937 = new BitSet(new long[]{0x00000A0002000000L});
+    public static final BitSet FOLLOW_43_in_interfaceMethodDeclaratorRest942 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedNameList_in_interfaceMethodDeclaratorRest944 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_interfaceMethodDeclaratorRest948 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_typeParameters_in_interfaceGenericMethodDecl960 = new BitSet(new long[]{0x7F80010000000010L});
+    public static final BitSet FOLLOW_type_in_interfaceGenericMethodDecl963 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_40_in_interfaceGenericMethodDecl967 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_interfaceGenericMethodDecl970 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceMethodDeclaratorRest_in_interfaceGenericMethodDecl980 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_formalParameters_in_voidInterfaceMethodDeclaratorRest992 = new BitSet(new long[]{0x0000080002000000L});
+    public static final BitSet FOLLOW_43_in_voidInterfaceMethodDeclaratorRest995 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedNameList_in_voidInterfaceMethodDeclaratorRest997 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_voidInterfaceMethodDeclaratorRest1001 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_formalParameters_in_constructorDeclaratorRest1013 = new BitSet(new long[]{0x0000082000000000L});
+    public static final BitSet FOLLOW_43_in_constructorDeclaratorRest1016 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedNameList_in_constructorDeclaratorRest1018 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_methodBody_in_constructorDeclaratorRest1022 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_constantDeclarator1033 = new BitSet(new long[]{0x0000120000000000L});
+    public static final BitSet FOLLOW_constantDeclaratorRest_in_constantDeclarator1035 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableDeclarator_in_variableDeclarators1047 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_variableDeclarators1050 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclarator_in_variableDeclarators1052 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_Identifier_in_variableDeclarator1084 = new BitSet(new long[]{0x0000120000000002L});
+    public static final BitSet FOLLOW_variableDeclaratorRest_in_variableDeclarator1088 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_variableDeclaratorRest1106 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_variableDeclaratorRest1108 = new BitSet(new long[]{0x0000120000000002L});
+    public static final BitSet FOLLOW_44_in_variableDeclaratorRest1113 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_variableInitializer_in_variableDeclaratorRest1115 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_44_in_variableDeclaratorRest1122 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_variableInitializer_in_variableDeclaratorRest1124 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_constantDeclaratorRest_in_constantDeclaratorsRest1144 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_constantDeclaratorsRest1147 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_constantDeclarator_in_constantDeclaratorsRest1149 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_41_in_constantDeclaratorRest1166 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_constantDeclaratorRest1168 = new BitSet(new long[]{0x0000120000000000L});
+    public static final BitSet FOLLOW_44_in_constantDeclaratorRest1172 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_variableInitializer_in_constantDeclaratorRest1174 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_variableDeclaratorId1186 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_41_in_variableDeclaratorId1189 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_variableDeclaratorId1191 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_arrayInitializer_in_variableInitializer1204 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expression_in_variableInitializer1214 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_arrayInitializer1226 = new BitSet(new long[]{0x7F80016200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_variableInitializer_in_arrayInitializer1229 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_34_in_arrayInitializer1232 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_variableInitializer_in_arrayInitializer1234 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_34_in_arrayInitializer1239 = new BitSet(new long[]{0x0000004000000000L});
+    public static final BitSet FOLLOW_38_in_arrayInitializer1246 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotation_in_modifier1262 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_45_in_modifier1272 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_46_in_modifier1282 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_47_in_modifier1292 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_27_in_modifier1302 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_48_in_modifier1312 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_49_in_modifier1322 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_50_in_modifier1332 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_51_in_modifier1342 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_52_in_modifier1352 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_53_in_modifier1362 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_54_in_modifier1372 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_packageOrTypeName1386 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_28_in_packageOrTypeName1389 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_packageOrTypeName1391 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_Identifier_in_enumConstantName1409 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_typeName1425 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_packageOrTypeName_in_typeName1435 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_28_in_typeName1437 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_typeName1439 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_type1450 = new BitSet(new long[]{0x0000020210000002L});
+    public static final BitSet FOLLOW_typeArguments_in_type1453 = new BitSet(new long[]{0x0000020010000002L});
+    public static final BitSet FOLLOW_28_in_type1458 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_type1460 = new BitSet(new long[]{0x0000020210000002L});
+    public static final BitSet FOLLOW_typeArguments_in_type1463 = new BitSet(new long[]{0x0000020010000002L});
+    public static final BitSet FOLLOW_41_in_type1471 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_type1473 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_primitiveType_in_type1480 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_41_in_type1483 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_type1485 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_set_in_primitiveType0 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_49_in_variableModifier1573 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotation_in_variableModifier1583 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_33_in_typeArguments1594 = new BitSet(new long[]{0xFF80000000000010L});
+    public static final BitSet FOLLOW_typeArgument_in_typeArguments1596 = new BitSet(new long[]{0x0000000C00000000L});
+    public static final BitSet FOLLOW_34_in_typeArguments1599 = new BitSet(new long[]{0xFF80000000000010L});
+    public static final BitSet FOLLOW_typeArgument_in_typeArguments1601 = new BitSet(new long[]{0x0000000C00000000L});
+    public static final BitSet FOLLOW_35_in_typeArguments1605 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_typeArgument1617 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_63_in_typeArgument1622 = new BitSet(new long[]{0x0000000080000002L,0x0000000000000001L});
+    public static final BitSet FOLLOW_set_in_typeArgument1625 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_type_in_typeArgument1633 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_qualifiedName_in_qualifiedNameList1647 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_qualifiedNameList1650 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_qualifiedName_in_qualifiedNameList1652 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_65_in_formalParameters1666 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000084L});
+    public static final BitSet FOLLOW_formalParameterDecls_in_formalParameters1668 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_formalParameters1671 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_formalParameterDecls1683 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_formalParameterDecls1686 = new BitSet(new long[]{0x0000000000000012L,0x0000000000000008L});
+    public static final BitSet FOLLOW_formalParameterDeclsRest_in_formalParameterDecls1688 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableDeclaratorId_in_formalParameterDeclsRest1701 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_formalParameterDeclsRest1704 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_formalParameterDecls_in_formalParameterDeclsRest1706 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_67_in_formalParameterDeclsRest1715 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclaratorId_in_formalParameterDeclsRest1717 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_block_in_methodBody1729 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_qualifiedName1740 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_28_in_qualifiedName1743 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_qualifiedName1745 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_integerLiteral_in_literal1762 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FloatingPointLiteral_in_literal1772 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_CharacterLiteral_in_literal1782 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_StringLiteral_in_literal1792 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_booleanLiteral_in_literal1802 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_68_in_literal1812 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_set_in_integerLiteral0 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_set_in_booleanLiteral0 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotation_in_annotations1893 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000080L});
+    public static final BitSet FOLLOW_71_in_annotation1905 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_annotationName_in_annotation1907 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_annotation1910 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E600000000F7L});
+    public static final BitSet FOLLOW_elementValuePairs_in_annotation1912 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_annotation1915 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_annotationName1929 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_28_in_annotationName1932 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_annotationName1934 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_elementValuePair_in_elementValuePairs1948 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_elementValuePairs1951 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_elementValuePair_in_elementValuePairs1953 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_Identifier_in_elementValuePair1968 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_elementValuePair1970 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_elementValue_in_elementValuePair1974 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_conditionalExpression_in_elementValue1986 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotation_in_elementValue1993 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_elementValueArrayInitializer_in_elementValue2000 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_elementValueArrayInitializer2012 = new BitSet(new long[]{0x7F80016200000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_elementValue_in_elementValueArrayInitializer2015 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_34_in_elementValueArrayInitializer2018 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_elementValue_in_elementValueArrayInitializer2020 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_38_in_elementValueArrayInitializer2027 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_71_in_annotationTypeDeclaration2039 = new BitSet(new long[]{0x0000008000000000L});
+    public static final BitSet FOLLOW_39_in_annotationTypeDeclaration2041 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_annotationTypeDeclaration2043 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_annotationTypeBody_in_annotationTypeDeclaration2045 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_annotationTypeBody2057 = new BitSet(new long[]{0x7FFFE0C048000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_annotationTypeElementDeclarations_in_annotationTypeBody2060 = new BitSet(new long[]{0x0000004000000000L});
+    public static final BitSet FOLLOW_38_in_annotationTypeBody2064 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotationTypeElementDeclaration_in_annotationTypeElementDeclarations2077 = new BitSet(new long[]{0x7FFFE08048000032L,0x0000000000000080L});
+    public static final BitSet FOLLOW_annotationTypeElementDeclaration_in_annotationTypeElementDeclarations2081 = new BitSet(new long[]{0x7FFFE08048000032L,0x0000000000000080L});
+    public static final BitSet FOLLOW_modifier_in_annotationTypeElementDeclaration2096 = new BitSet(new long[]{0x7FFFE08048000030L,0x0000000000000080L});
+    public static final BitSet FOLLOW_annotationTypeElementRest_in_annotationTypeElementDeclaration2100 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_annotationTypeElementRest2112 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_annotationMethodOrConstantRest_in_annotationTypeElementRest2114 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_annotationTypeElementRest2116 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classDeclaration_in_annotationTypeElementRest2123 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_annotationTypeElementRest2125 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceDeclaration_in_annotationTypeElementRest2133 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_annotationTypeElementRest2135 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enumDeclaration_in_annotationTypeElementRest2143 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_annotationTypeElementRest2145 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotationTypeDeclaration_in_annotationTypeElementRest2153 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_annotationTypeElementRest2155 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotationMethodRest_in_annotationMethodOrConstantRest2168 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotationConstantRest_in_annotationMethodOrConstantRest2175 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_annotationMethodRest2188 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_annotationMethodRest2190 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_annotationMethodRest2192 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000100L});
+    public static final BitSet FOLLOW_defaultValue_in_annotationMethodRest2195 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableDeclarators_in_annotationConstantRest2212 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_72_in_defaultValue2227 = new BitSet(new long[]{0x7F80012200000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_elementValue_in_defaultValue2229 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_37_in_block2269 = new BitSet(new long[]{0x7FFFE1E24A000FF0L,0x0007E60000FDEAF3L});
+    public static final BitSet FOLLOW_blockStatement_in_block2271 = new BitSet(new long[]{0x7FFFE1E24A000FF0L,0x0007E60000FDEAF3L});
+    public static final BitSet FOLLOW_38_in_block2274 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_localVariableDeclaration_in_blockStatement2286 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classOrInterfaceDeclaration_in_blockStatement2291 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_statement_in_blockStatement2300 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_localVariableDeclaration2348 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_localVariableDeclaration2365 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclarators_in_localVariableDeclaration2376 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_localVariableDeclaration2378 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_block_in_statement2390 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_73_in_statement2398 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_statement2400 = new BitSet(new long[]{0x0000000002000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_statement2403 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_statement2405 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2409 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_75_in_statement2417 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_statement2419 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2421 = new BitSet(new long[]{0x0000000000000002L,0x0000000000001000L});
+    public static final BitSet FOLLOW_76_in_statement2431 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2433 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_77_in_statement2443 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_statement2445 = new BitSet(new long[]{0x7F82010202000FD0L,0x0007E600000000F3L});
+    public static final BitSet FOLLOW_forControl_in_statement2447 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_statement2449 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2451 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_78_in_statement2459 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_statement2461 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2463 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_79_in_statement2471 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2473 = new BitSet(new long[]{0x0000000000000000L,0x0000000000004000L});
+    public static final BitSet FOLLOW_78_in_statement2475 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_statement2477 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2479 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_80_in_statement2487 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_statement2489 = new BitSet(new long[]{0x0000000000000000L,0x0000000001020000L});
+    public static final BitSet FOLLOW_catches_in_statement2499 = new BitSet(new long[]{0x0000000000000000L,0x0000000000020000L});
+    public static final BitSet FOLLOW_81_in_statement2501 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_statement2503 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_catches_in_statement2513 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_81_in_statement2523 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_statement2525 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_82_in_statement2541 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_statement2543 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_37_in_statement2545 = new BitSet(new long[]{0x0000004000000000L,0x0000000002000100L});
+    public static final BitSet FOLLOW_switchBlockStatementGroups_in_statement2547 = new BitSet(new long[]{0x0000004000000000L});
+    public static final BitSet FOLLOW_38_in_statement2549 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_51_in_statement2557 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_statement2559 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_statement2561 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_83_in_statement2569 = new BitSet(new long[]{0x7F80010202000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_statement2571 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2574 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_84_in_statement2582 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_statement2584 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2586 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_85_in_statement2594 = new BitSet(new long[]{0x0000000002000010L});
+    public static final BitSet FOLLOW_Identifier_in_statement2596 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2599 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_86_in_statement2607 = new BitSet(new long[]{0x0000000002000010L});
+    public static final BitSet FOLLOW_Identifier_in_statement2609 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2612 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_modifyStatement_in_statement2625 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_25_in_statement2633 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_statementExpression_in_statement2641 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_statement2643 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_statement2651 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_statement2653 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_statement2655 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_87_in_modifyStatement2675 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_modifyStatement2677 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_37_in_modifyStatement2684 = new BitSet(new long[]{0x7F80014200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_modifyStatement2692 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_34_in_modifyStatement2705 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_modifyStatement2709 = new BitSet(new long[]{0x0000004400000000L});
+    public static final BitSet FOLLOW_38_in_modifyStatement2728 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_catchClause_in_catches2752 = new BitSet(new long[]{0x0000000000000002L,0x0000000001000000L});
+    public static final BitSet FOLLOW_catchClause_in_catches2755 = new BitSet(new long[]{0x0000000000000002L,0x0000000001000000L});
+    public static final BitSet FOLLOW_88_in_catchClause2769 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_catchClause2771 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_formalParameter_in_catchClause2773 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_catchClause2775 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_catchClause2777 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_formalParameter2788 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_formalParameter2791 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclaratorId_in_formalParameter2793 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_switchBlockStatementGroup_in_switchBlockStatementGroups2807 = new BitSet(new long[]{0x0000000000000002L,0x0000000002000100L});
+    public static final BitSet FOLLOW_switchLabel_in_switchBlockStatementGroup2821 = new BitSet(new long[]{0x7FFFE1A24A000FF2L,0x0007E60000FDEAF3L});
+    public static final BitSet FOLLOW_blockStatement_in_switchBlockStatementGroup2823 = new BitSet(new long[]{0x7FFFE1A24A000FF2L,0x0007E60000FDEAF3L});
+    public static final BitSet FOLLOW_89_in_switchLabel2836 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_constantExpression_in_switchLabel2838 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_switchLabel2840 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_89_in_switchLabel2847 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_enumConstantName_in_switchLabel2849 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_switchLabel2851 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_72_in_switchLabel2858 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_switchLabel2860 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_34_in_moreStatementExpressions2873 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_statementExpression_in_moreStatementExpressions2875 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_forVarControl_in_forControl2896 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_forInit_in_forControl2901 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_forControl2904 = new BitSet(new long[]{0x7F80010202000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_forControl2906 = new BitSet(new long[]{0x0000000002000000L});
+    public static final BitSet FOLLOW_25_in_forControl2909 = new BitSet(new long[]{0x7F80010200000FD2L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_forUpdate_in_forControl2911 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_forInit2949 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_forInit2952 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclarators_in_forInit2954 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expressionList_in_forInit2959 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_forVarControl2971 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_forVarControl2974 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_forVarControl2976 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_forVarControl2978 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_forVarControl2980 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expressionList_in_forUpdate2991 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_parExpression3004 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_parExpression3006 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_parExpression3008 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expression_in_expressionList3025 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_34_in_expressionList3028 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_expressionList3030 = new BitSet(new long[]{0x0000000400000002L});
+    public static final BitSet FOLLOW_expression_in_statementExpression3046 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expression_in_constantExpression3058 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_conditionalExpression_in_expression3070 = new BitSet(new long[]{0x0000100A00000002L,0x00000003FC000000L});
+    public static final BitSet FOLLOW_assignmentOperator_in_expression3073 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_expression3075 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_44_in_assignmentOperator3089 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_90_in_assignmentOperator3099 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_91_in_assignmentOperator3109 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_92_in_assignmentOperator3119 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_93_in_assignmentOperator3129 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_94_in_assignmentOperator3139 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_95_in_assignmentOperator3149 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_96_in_assignmentOperator3159 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_97_in_assignmentOperator3169 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_33_in_assignmentOperator3179 = new BitSet(new long[]{0x0000000200000000L});
+    public static final BitSet FOLLOW_33_in_assignmentOperator3181 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_assignmentOperator3183 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_assignmentOperator3193 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_assignmentOperator3195 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_assignmentOperator3197 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_assignmentOperator3207 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_assignmentOperator3209 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_assignmentOperator3211 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_assignmentOperator3213 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_conditionalOrExpression_in_conditionalExpression3229 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_63_in_conditionalExpression3233 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_conditionalExpression3235 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_conditionalExpression3237 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_conditionalExpression3239 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_conditionalAndExpression_in_conditionalOrExpression3258 = new BitSet(new long[]{0x0000000000000002L,0x0000000400000000L});
+    public static final BitSet FOLLOW_98_in_conditionalOrExpression3262 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_conditionalAndExpression_in_conditionalOrExpression3264 = new BitSet(new long[]{0x0000000000000002L,0x0000000400000000L});
+    public static final BitSet FOLLOW_inclusiveOrExpression_in_conditionalAndExpression3283 = new BitSet(new long[]{0x0000000000000002L,0x0000000800000000L});
+    public static final BitSet FOLLOW_99_in_conditionalAndExpression3287 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_inclusiveOrExpression_in_conditionalAndExpression3289 = new BitSet(new long[]{0x0000000000000002L,0x0000000800000000L});
+    public static final BitSet FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression3308 = new BitSet(new long[]{0x0000000000000002L,0x0000001000000000L});
+    public static final BitSet FOLLOW_100_in_inclusiveOrExpression3312 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression3314 = new BitSet(new long[]{0x0000000000000002L,0x0000001000000000L});
+    public static final BitSet FOLLOW_andExpression_in_exclusiveOrExpression3333 = new BitSet(new long[]{0x0000000000000002L,0x0000002000000000L});
+    public static final BitSet FOLLOW_101_in_exclusiveOrExpression3337 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_andExpression_in_exclusiveOrExpression3339 = new BitSet(new long[]{0x0000000000000002L,0x0000002000000000L});
+    public static final BitSet FOLLOW_equalityExpression_in_andExpression3358 = new BitSet(new long[]{0x0000001000000002L});
+    public static final BitSet FOLLOW_36_in_andExpression3362 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_equalityExpression_in_andExpression3364 = new BitSet(new long[]{0x0000001000000002L});
+    public static final BitSet FOLLOW_instanceOfExpression_in_equalityExpression3383 = new BitSet(new long[]{0x0000000000000002L,0x000000C000000000L});
+    public static final BitSet FOLLOW_set_in_equalityExpression3387 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_instanceOfExpression_in_equalityExpression3395 = new BitSet(new long[]{0x0000000000000002L,0x000000C000000000L});
+    public static final BitSet FOLLOW_relationalExpression_in_instanceOfExpression3414 = new BitSet(new long[]{0x0000000000000002L,0x0000010000000000L});
+    public static final BitSet FOLLOW_104_in_instanceOfExpression3417 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_type_in_instanceOfExpression3419 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_shiftExpression_in_relationalExpression3437 = new BitSet(new long[]{0x0000000A00000002L});
+    public static final BitSet FOLLOW_relationalOp_in_relationalExpression3441 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_shiftExpression_in_relationalExpression3443 = new BitSet(new long[]{0x0000000A00000002L});
+    public static final BitSet FOLLOW_33_in_relationalOp3459 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_relationalOp3461 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_relationalOp3465 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_relationalOp3467 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_33_in_relationalOp3471 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_relationalOp3475 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_additiveExpression_in_shiftExpression3492 = new BitSet(new long[]{0x0000000A00000002L});
+    public static final BitSet FOLLOW_shiftOp_in_shiftExpression3496 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_additiveExpression_in_shiftExpression3498 = new BitSet(new long[]{0x0000000A00000002L});
+    public static final BitSet FOLLOW_33_in_shiftOp3522 = new BitSet(new long[]{0x0000000200000000L});
+    public static final BitSet FOLLOW_33_in_shiftOp3524 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_shiftOp3528 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_shiftOp3530 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_shiftOp3532 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_shiftOp3536 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_shiftOp3538 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_multiplicativeExpression_in_additiveExpression3556 = new BitSet(new long[]{0x0000000000000002L,0x0000060000000000L});
+    public static final BitSet FOLLOW_set_in_additiveExpression3560 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_multiplicativeExpression_in_additiveExpression3568 = new BitSet(new long[]{0x0000000000000002L,0x0000060000000000L});
+    public static final BitSet FOLLOW_unaryExpression_in_multiplicativeExpression3587 = new BitSet(new long[]{0x0000000020000002L,0x0000180000000000L});
+    public static final BitSet FOLLOW_set_in_multiplicativeExpression3591 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_multiplicativeExpression3605 = new BitSet(new long[]{0x0000000020000002L,0x0000180000000000L});
+    public static final BitSet FOLLOW_105_in_unaryExpression3625 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_unaryExpression3627 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_106_in_unaryExpression3635 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_unaryExpression3637 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_109_in_unaryExpression3647 = new BitSet(new long[]{0x7F80010200000FD0L,0x0006000000000073L});
+    public static final BitSet FOLLOW_primary_in_unaryExpression3649 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_110_in_unaryExpression3659 = new BitSet(new long[]{0x7F80010200000FD0L,0x0006000000000073L});
+    public static final BitSet FOLLOW_primary_in_unaryExpression3661 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_unaryExpressionNotPlusMinus_in_unaryExpression3671 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_111_in_unaryExpressionNotPlusMinus3690 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus3692 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_112_in_unaryExpressionNotPlusMinus3701 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus3703 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_castExpression_in_unaryExpressionNotPlusMinus3713 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_primary_in_unaryExpressionNotPlusMinus3723 = new BitSet(new long[]{0x0000020010000002L,0x0000600000000000L});
+    public static final BitSet FOLLOW_selector_in_unaryExpressionNotPlusMinus3725 = new BitSet(new long[]{0x0000020010000002L,0x0000600000000000L});
+    public static final BitSet FOLLOW_set_in_unaryExpressionNotPlusMinus3728 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_castExpression3751 = new BitSet(new long[]{0x7F80000000000000L});
+    public static final BitSet FOLLOW_primitiveType_in_castExpression3753 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_castExpression3755 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_castExpression3757 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_castExpression3766 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_type_in_castExpression3769 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_expression_in_castExpression3773 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_castExpression3776 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007800000000073L});
+    public static final BitSet FOLLOW_unaryExpressionNotPlusMinus_in_castExpression3778 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_parExpression_in_primary3795 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_nonWildcardTypeArguments_in_primary3805 = new BitSet(new long[]{0x0000000000000010L,0x0002000000000001L});
+    public static final BitSet FOLLOW_explicitGenericInvocationSuffix_in_primary3816 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_113_in_primary3820 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_primary3822 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_113_in_primary3833 = new BitSet(new long[]{0x0000020010000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_primary3836 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_primary3838 = new BitSet(new long[]{0x0000020010000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_identifierSuffix_in_primary3843 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_64_in_primary3855 = new BitSet(new long[]{0x0000000010000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_superSuffix_in_primary3857 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_in_primary3867 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_114_in_primary3877 = new BitSet(new long[]{0x7F80000200000010L});
+    public static final BitSet FOLLOW_creator_in_primary3879 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_primary3891 = new BitSet(new long[]{0x0000020010000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_primary3896 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_primary3898 = new BitSet(new long[]{0x0000020010000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_identifierSuffix_in_primary3903 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_primitiveType_in_primary3915 = new BitSet(new long[]{0x0000020010000000L});
+    public static final BitSet FOLLOW_41_in_primary3918 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_primary3920 = new BitSet(new long[]{0x0000020010000000L});
+    public static final BitSet FOLLOW_28_in_primary3924 = new BitSet(new long[]{0x0000000040000000L});
+    public static final BitSet FOLLOW_30_in_primary3926 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_40_in_primary3936 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_28_in_primary3938 = new BitSet(new long[]{0x0000000040000000L});
+    public static final BitSet FOLLOW_30_in_primary3940 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_identifierSuffix3952 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_identifierSuffix3954 = new BitSet(new long[]{0x0000020010000000L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix3958 = new BitSet(new long[]{0x0000000040000000L});
+    public static final BitSet FOLLOW_30_in_identifierSuffix3960 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_identifierSuffix3966 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_identifierSuffix3968 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_identifierSuffix3970 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_arguments_in_identifierSuffix3983 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix3993 = new BitSet(new long[]{0x0000000040000000L});
+    public static final BitSet FOLLOW_30_in_identifierSuffix3995 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix4005 = new BitSet(new long[]{0x0000000200000000L});
+    public static final BitSet FOLLOW_explicitGenericInvocation_in_identifierSuffix4007 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix4017 = new BitSet(new long[]{0x0000000000000000L,0x0002000000000000L});
+    public static final BitSet FOLLOW_113_in_identifierSuffix4019 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix4029 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_64_in_identifierSuffix4031 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_identifierSuffix4033 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_identifierSuffix4043 = new BitSet(new long[]{0x0000000000000000L,0x0004000000000000L});
+    public static final BitSet FOLLOW_114_in_identifierSuffix4045 = new BitSet(new long[]{0x0000000200000010L});
+    public static final BitSet FOLLOW_nonWildcardTypeArguments_in_identifierSuffix4048 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_innerCreator_in_identifierSuffix4052 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_nonWildcardTypeArguments_in_creator4064 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_createdName_in_creator4067 = new BitSet(new long[]{0x0000020000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arrayCreatorRest_in_creator4078 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classCreatorRest_in_creator4082 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_createdName4094 = new BitSet(new long[]{0x0000000210000002L});
+    public static final BitSet FOLLOW_typeArguments_in_createdName4096 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_28_in_createdName4108 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_createdName4110 = new BitSet(new long[]{0x0000000210000002L});
+    public static final BitSet FOLLOW_typeArguments_in_createdName4112 = new BitSet(new long[]{0x0000000010000002L});
+    public static final BitSet FOLLOW_primitiveType_in_createdName4123 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_innerCreator4135 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_classCreatorRest_in_innerCreator4137 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_arrayCreatorRest4148 = new BitSet(new long[]{0x7F80050200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_42_in_arrayCreatorRest4162 = new BitSet(new long[]{0x0000022000000000L});
+    public static final BitSet FOLLOW_41_in_arrayCreatorRest4165 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_arrayCreatorRest4167 = new BitSet(new long[]{0x0000022000000000L});
+    public static final BitSet FOLLOW_arrayInitializer_in_arrayCreatorRest4171 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_expression_in_arrayCreatorRest4185 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_arrayCreatorRest4187 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_41_in_arrayCreatorRest4190 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_arrayCreatorRest4192 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_arrayCreatorRest4194 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_41_in_arrayCreatorRest4199 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_arrayCreatorRest4201 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_arguments_in_classCreatorRest4224 = new BitSet(new long[]{0x0000002000000002L});
+    public static final BitSet FOLLOW_classBody_in_classCreatorRest4226 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_nonWildcardTypeArguments_in_explicitGenericInvocation4239 = new BitSet(new long[]{0x0000000000000010L,0x0000000000000001L});
+    public static final BitSet FOLLOW_explicitGenericInvocationSuffix_in_explicitGenericInvocation4241 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_33_in_nonWildcardTypeArguments4253 = new BitSet(new long[]{0x7F80000000000010L});
+    public static final BitSet FOLLOW_typeList_in_nonWildcardTypeArguments4255 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_nonWildcardTypeArguments4257 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_64_in_explicitGenericInvocationSuffix4269 = new BitSet(new long[]{0x0000000010000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_superSuffix_in_explicitGenericInvocationSuffix4271 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_Identifier_in_explicitGenericInvocationSuffix4278 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_explicitGenericInvocationSuffix4280 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_selector4292 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_selector4294 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_selector4297 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_selector4306 = new BitSet(new long[]{0x0000000000000000L,0x0002000000000000L});
+    public static final BitSet FOLLOW_113_in_selector4308 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_selector4315 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_64_in_selector4317 = new BitSet(new long[]{0x0000000010000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_superSuffix_in_selector4319 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_selector4326 = new BitSet(new long[]{0x0000000000000000L,0x0004000000000000L});
+    public static final BitSet FOLLOW_114_in_selector4328 = new BitSet(new long[]{0x0000000200000010L});
+    public static final BitSet FOLLOW_nonWildcardTypeArguments_in_selector4331 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_innerCreator_in_selector4335 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_selector4342 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_selector4344 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_selector4346 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_superSuffix4358 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_superSuffix4365 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_superSuffix4367 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000002L});
+    public static final BitSet FOLLOW_arguments_in_superSuffix4370 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_arguments4386 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000077L});
+    public static final BitSet FOLLOW_expressionList_in_arguments4388 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_arguments4391 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotations_in_synpred170 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_methodDeclaration_in_synpred38577 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fieldDeclaration_in_synpred39582 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_synpred851389 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_synpred851391 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_annotation_in_synpred1201893 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classDeclaration_in_synpred1352123 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_synpred1352125 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_interfaceDeclaration_in_synpred1372133 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_synpred1372135 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enumDeclaration_in_synpred1392143 = new BitSet(new long[]{0x0000000002000002L});
+    public static final BitSet FOLLOW_25_in_synpred1392145 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_localVariableDeclaration_in_synpred1442286 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_classOrInterfaceDeclaration_in_synpred1452291 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_76_in_synpred1502431 = new BitSet(new long[]{0x7F88012202000FD0L,0x0007E60000FDEA73L});
+    public static final BitSet FOLLOW_statement_in_synpred1502433 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_catches_in_synpred1552499 = new BitSet(new long[]{0x0000000000000000L,0x0000000000020000L});
+    public static final BitSet FOLLOW_81_in_synpred1552501 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_block_in_synpred1552503 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_catches_in_synpred1562513 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_89_in_synpred1762836 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_constantExpression_in_synpred1762838 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_synpred1762840 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_89_in_synpred1772847 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_enumConstantName_in_synpred1772849 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L});
+    public static final BitSet FOLLOW_74_in_synpred1772851 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_forVarControl_in_synpred1792896 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variableModifier_in_synpred1842949 = new BitSet(new long[]{0x7F82000000000010L,0x0000000000000080L});
+    public static final BitSet FOLLOW_type_in_synpred1842952 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_variableDeclarators_in_synpred1842954 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_assignmentOperator_in_synpred1873073 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_synpred1873075 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_synpred1983193 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_synpred1983195 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_synpred1983197 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_relationalOp_in_synpred2083441 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_shiftExpression_in_synpred2083443 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_shiftOp_in_synpred2123496 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_additiveExpression_in_synpred2123498 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_35_in_synpred2143528 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_synpred2143530 = new BitSet(new long[]{0x0000000800000000L});
+    public static final BitSet FOLLOW_35_in_synpred2143532 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_castExpression_in_synpred2263713 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_65_in_synpred2303751 = new BitSet(new long[]{0x7F80000000000000L});
+    public static final BitSet FOLLOW_primitiveType_in_synpred2303753 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L});
+    public static final BitSet FOLLOW_66_in_synpred2303755 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_unaryExpression_in_synpred2303757 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_in_synpred2313769 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_synpred2353836 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_synpred2353838 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifierSuffix_in_synpred2363843 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_28_in_synpred2413896 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_Identifier_in_synpred2413898 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifierSuffix_in_synpred2423903 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_synpred2483966 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_synpred2483968 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_synpred2483970 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_41_in_synpred2644190 = new BitSet(new long[]{0x7F80010200000FD0L,0x0007E60000000073L});
+    public static final BitSet FOLLOW_expression_in_synpred2644192 = new BitSet(new long[]{0x0000040000000000L});
+    public static final BitSet FOLLOW_42_in_synpred2644194 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.drools.base.accumulators.AccumulateFunction;
+import org.drools.base.accumulators.MVELAccumulatorFunctionExecutor;
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELAccumulator;
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.rule.Accumulate;
+import org.drools.rule.Declaration;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.spi.Accumulator;
+
+/**
+ * A builder for the java dialect accumulate version
+ * 
+ * @author etirelli
+ */
+public class MVELAccumulateBuilder
+    implements
+    AccumulateBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+
+        final AccumulateDescr accumDescr = (AccumulateDescr) descr;
+
+        if( ! accumDescr.hasValidInput() ) {
+            return null;
+        }
+
+        final RuleConditionBuilder builder = context.getDialect().getBuilder( accumDescr.getInput().getClass() );
+
+        // create source CE
+        final RuleConditionElement source = builder.build( context,
+                                                           accumDescr.getInput() );
+
+        if ( source == null ) {
+            return null;
+        }
+
+        MVELDialect dialect = (MVELDialect) context.getDialect();
+
+        final Declaration[] sourceDeclArr = (Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[0] );
+
+        final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
+                                                                 source.getOuterDeclarations(),
+                                                                 context.getPkg().getGlobals() );
+
+        Accumulator accumulator = null;
+        Declaration[] declarations = null;
+
+        if ( accumDescr.isExternalFunction() ) {
+            // build an external function executor
+            final Dialect.AnalysisResult analysis = dialect.analyzeExpression( context,
+                                                                               accumDescr,
+                                                                               accumDescr.getExpression(),
+                                                                               new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            int size = analysis.getBoundIdentifiers()[0].size();
+            declarations = new Declaration[size];
+            for ( int i = 0; i < size; i++ ) {
+                declarations[i] = context.getDeclarationResolver().getDeclaration( (String) analysis.getBoundIdentifiers()[0].get( i ) );
+            }
+
+            final Serializable expression = dialect.compile( (String) accumDescr.getExpression(),
+                                                             analysis,
+                                                             null,
+                                                             source.getOuterDeclarations(),
+                                                             null,
+                                                             context );
+
+            AccumulateFunction function = context.getConfiguration().getAccumulateFunction( accumDescr.getFunctionIdentifier() );
+
+            accumulator = new MVELAccumulatorFunctionExecutor( factory,
+                                                               expression,
+                                                               function );
+        } else {
+            // it is a custom accumulate
+            final MVELAnalysisResult initCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
+                                                                                                   accumDescr,
+                                                                                                   accumDescr.getInitCode(),
+                                                                                                   new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final MVELAnalysisResult actionCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
+                                                                                                     accumDescr,
+                                                                                                     null,
+                                                                                                     accumDescr.getActionCode(),
+                                                                                                     new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()},
+                                                                                                     initCodeAnalysis.getMvelVariables() );
+            //actionCodeAnalysis.setMvelVariables( initCodeAnalysis.getMvelVariables() );
+            final MVELAnalysisResult resultCodeAnalysis = (MVELAnalysisResult) dialect.analyzeExpression( context,
+                                                                                                          accumDescr,
+                                                                                                          accumDescr.getResultCode(),
+                                                                                                          new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()},
+                                                                                                          initCodeAnalysis.getMvelVariables() );
+            //resultCodeAnalysis.setMvelVariables( initCodeAnalysis.getMvelVariables() );
+
+            final List requiredDeclarations = new ArrayList( initCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( actionCodeAnalysis.getBoundIdentifiers()[0] );
+            requiredDeclarations.addAll( resultCodeAnalysis.getBoundIdentifiers()[0] );
+
+            if ( accumDescr.getReverseCode() != null ) {
+                final Dialect.AnalysisResult reverseCodeAnalysis = context.getDialect().analyzeBlock( context,
+                                                                                                      accumDescr,
+                                                                                                      accumDescr.getActionCode(),
+                                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+                requiredDeclarations.addAll( reverseCodeAnalysis.getBoundIdentifiers()[0] );
+            }
+
+            declarations = new Declaration[requiredDeclarations.size()];
+            for ( int i = 0, size = requiredDeclarations.size(); i < size; i++ ) {
+                declarations[i] = context.getDeclarationResolver().getDeclaration( (String) requiredDeclarations.get( i ) );
+            }
+
+            final Serializable init = dialect.compile( (String) accumDescr.getInitCode(),
+                                                       initCodeAnalysis,
+                                                       null,
+                                                       source.getOuterDeclarations(),
+                                                       null,
+                                                       context );
+            final Serializable action = dialect.compile( (String) accumDescr.getActionCode(),
+                                                         actionCodeAnalysis,
+                                                         null,
+                                                         source.getOuterDeclarations(),
+                                                         initCodeAnalysis.getMvelVariables(),
+                                                         context );
+
+            Serializable reverse = null;
+            if ( accumDescr.getReverseCode() != null ) {
+                reverse = dialect.compile( (String) accumDescr.getReverseCode(),
+                                           resultCodeAnalysis,
+                                           null,
+                                           source.getOuterDeclarations(),
+                                           initCodeAnalysis.getMvelVariables(),
+                                           context );
+            }
+
+            final Serializable result = dialect.compile( (String) accumDescr.getResultCode(),
+                                                         resultCodeAnalysis,
+                                                         null,
+                                                         source.getOuterDeclarations(),
+                                                         initCodeAnalysis.getMvelVariables(),
+                                                         context );
+
+            accumulator = new MVELAccumulator( factory,
+                                               init,
+                                               action,
+                                               reverse,
+                                               result );
+
+        }
+
+        final Accumulate accumulate = new Accumulate( source,
+                                                      declarations,
+                                                      sourceDeclArr,
+                                                      accumulator );
+        return accumulate;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,121 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELAction;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.workflow.core.node.ActionNode;
+import org.mvel.Macro;
+import org.mvel.MacroProcessor;
+
+public class MVELActionBuilder
+    implements
+    ActionBuilder {
+
+    public MVELActionBuilder() {
+
+    }
+
+    public void build(final PackageBuildContext context,
+                      final ActionNode actionNode,
+                      final ActionDescr actionDescr) {
+
+        String text = actionDescr.getText();
+
+        try {
+            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+            Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+                                                                    actionDescr,
+                                                                    dialect.getInterceptors(),
+                                                                    text,
+                                                                    new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()},
+                                                                    null );
+
+            final Serializable expr = dialect.compile( text,
+                                                       analysis,
+                                                       dialect.getInterceptors(),
+                                                       null,
+                                                       null,
+                                                       context );
+
+            final DroolsMVELFactory factory = new DroolsMVELFactory( null,
+                                                                     null,
+                                                                     context.getPkg().getGlobals(),
+                                                                     analysis.getBoundIdentifiers() );
+            
+            actionNode.setAction( new MVELAction( expr, factory )  );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          actionDescr,
+                                                          null,
+                                                          "Unable to build expression for 'action' '" + actionDescr.getText() + "'" ) );
+        }
+    }
+
+    /**
+     * Allows newlines to demarcate expressions, as per MVEL command line.
+     * If expression spans multiple lines (ie inside an unbalanced bracket) then
+     * it is left alone.
+     * Uses character based iteration which is at least an order of magnitude faster then a single
+     * simple regex.
+     */
+    public static String delimitExpressions(String s) {
+
+        StringBuffer result = new StringBuffer();
+        char[] cs = s.toCharArray();
+        int brace = 0;
+        int sqre = 0;
+        int crly = 0;
+        char lastNonWhite = ';';
+        for ( int i = 0; i < cs.length; i++ ) {
+            char c = cs[i];
+            switch ( c ) {
+                case '(' :
+                    brace++;
+                    break;
+                case '{' :
+                    crly++;
+                    break;
+                case '[' :
+                    sqre++;
+                    break;
+                case ')' :
+                    brace--;
+                    break;
+                case '}' :
+                    crly--;
+                    break;
+                case ']' :
+                    sqre--;
+                    break;
+                default :
+                    break;
+            }
+            if ( (brace == 0 && sqre == 0 && crly == 0) && (c == '\n' || c == '\r') ) {
+                if ( lastNonWhite != ';' ) {
+                    result.append( ';' );
+                    lastNonWhite = ';';
+                }
+            } else if ( !Character.isWhitespace( c ) ) {
+                lastNonWhite = c;
+            }
+            result.append( c );
+
+        }
+        return result.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAnalysisResult.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAnalysisResult.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAnalysisResult.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jun 18, 2007
+ */
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.compiler.Dialect.AnalysisResult;
+
+/**
+ * An analysis result implementation for the MVEL dialect
+ * 
+ * @author etirelli
+ */
+public class MVELAnalysisResult implements AnalysisResult {
+    private static final List[] EMPTY_ARRAY_OF_LISTS = new List[0];
+    
+    private List[] boundIdentifiers = EMPTY_ARRAY_OF_LISTS;
+    private List identifiers = Collections.EMPTY_LIST;
+    private List localVariables = Collections.EMPTY_LIST;
+    private List notBoundedIdentifiers = Collections.EMPTY_LIST;
+    
+    private Map mvelVariables;
+    private Map mvelInputs;
+    
+    public List[] getBoundIdentifiers() {
+        return boundIdentifiers;
+    }
+    public void setBoundIdentifiers(List[] boundIdentifiers) {
+        this.boundIdentifiers = boundIdentifiers;
+    }
+    public List getIdentifiers() {
+        return identifiers;
+    }
+    public void setIdentifiers(List identifiers) {
+        this.identifiers = identifiers;
+    }
+    public List getLocalVariables() {
+        return this.localVariables;
+    }
+    public void setLocalVariables(List localVariables) {
+        this.localVariables = localVariables;
+    }
+    public List getNotBoundedIdentifiers() {
+        return notBoundedIdentifiers;
+    }
+    public void setNotBoundedIdentifiers(List notBoundedIdentifiers) {
+        this.notBoundedIdentifiers = notBoundedIdentifiers;
+    }
+
+    public Map getMvelVariables() {
+        return mvelVariables;
+    }
+    
+    public void setMvelVariables(Map mvelVariables) {
+        this.mvelVariables = mvelVariables;
+    }
+    
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,163 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.Macro;
+import org.mvel.MacroProcessor;
+
+public class MVELConsequenceBuilder
+    implements
+    ConsequenceBuilder {
+
+    //private final Interceptor assertInterceptor;
+    //private final Interceptor modifyInterceptor;
+
+    private static final Map macros = new HashMap( 5 );
+    static {
+        macros.put( "insert",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.insert";
+                        }
+                    } );
+
+        macros.put( "insertLogical",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.insertLogical";
+                        }
+                    } );
+
+        macros.put( "modify",
+                    new Macro() {
+                        public String doMacro() {
+                            return "@Modify with";
+                        }
+                    } );
+
+        macros.put( "update",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.update";
+                        }
+                    } );
+
+        macros.put( "retract",
+                    new Macro() {
+                        public String doMacro() {
+                            return "drools.retract";
+                        }
+                    } );;
+    }
+
+    public MVELConsequenceBuilder() {
+
+    }
+
+    public void build(final RuleBuildContext context) {
+        // pushing consequence LHS into the stack for variable resolution
+        context.getBuildStack().push( context.getRule().getLhs() );
+
+        try {
+            MVELDialect dialect = (MVELDialect) context.getDialect();
+
+            String text = processMacros( (String) context.getRuleDescr().getConsequence() );
+
+            Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+                                                                    context.getRuleDescr(),
+                                                                    dialect.getInterceptors(),
+                                                                    text,
+                                                                    new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()},
+                                                                    null );
+
+            final Serializable expr = dialect.compile( text,
+                                                       analysis,
+                                                       dialect.getInterceptors(),
+                                                       null,
+                                                       null,
+                                                       context );
+
+            final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
+                                                                     null,
+                                                                     context.getPkg().getGlobals(),
+                                                                     analysis.getBoundIdentifiers() );
+
+            context.getRule().setConsequence( new MVELConsequence( expr,
+                                                                   factory ) );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                    context.getRuleDescr(),
+                                                    null,
+                                                    "Unable to build expression for 'consequence': "+e.getMessage()+" '" + context.getRuleDescr().getConsequence() + "'" ) );
+        }
+    }
+
+    public static String processMacros(String consequence) {
+        MacroProcessor macroProcessor = new MacroProcessor();
+        macroProcessor.setMacros( macros );
+        return macroProcessor.parse( delimitExpressions( consequence ) );
+    }
+
+    /**
+     * Allows newlines to demarcate expressions, as per MVEL command line.
+     * If expression spans multiple lines (ie inside an unbalanced bracket) then
+     * it is left alone.
+     * Uses character based iteration which is at least an order of magnitude faster then a single
+     * simple regex.
+     */
+    public static String delimitExpressions(String s) {
+
+        StringBuffer result = new StringBuffer();
+        char[] cs = s.toCharArray();
+        int brace = 0;
+        int sqre = 0;
+        int crly = 0;
+        char lastNonWhite = ';';
+        for ( int i = 0; i < cs.length; i++ ) {
+            char c = cs[i];
+            switch ( c ) {
+                case '(' :
+                    brace++;
+                    break;
+                case '{' :
+                    crly++;
+                    break;
+                case '[' :
+                    sqre++;
+                    break;
+                case ')' :
+                    brace--;
+                    break;
+                case '}' :
+                    crly--;
+                    break;
+                case ']' :
+                    sqre--;
+                    break;
+                default :
+                    break;
+            }
+            if ( (brace == 0 && sqre == 0 && crly == 0) && (c == '\n' || c == '\r') ) {
+                if ( lastNonWhite != ';' ) {
+                    result.append( ';' );
+                    lastNonWhite = ';';
+                }
+            } else if ( !Character.isWhitespace( c ) ) {
+                lastNonWhite = c;
+            }
+            result.append( c );
+
+        }
+        return result.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,585 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ModifyInterceptor;
+import org.drools.base.TypeResolver;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.commons.jci.readers.MemoryResourceReader;
+import org.drools.compiler.ActionError;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.ImportError;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EntryPointDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.LineMappings;
+import org.drools.rule.Package;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.CollectBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.EntryPointBuilder;
+import org.drools.rule.builder.ForallBuilder;
+import org.drools.rule.builder.FromBuilder;
+import org.drools.rule.builder.GroupElementBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.PatternBuilder;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ProcessClassBuilder;
+import org.drools.rule.builder.QueryBuilder;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleClassBuilder;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.SalienceBuilder;
+import org.drools.rule.builder.TimeWindowBuilder;
+import org.drools.rule.builder.dialect.java.JavaDialect;
+import org.drools.rule.builder.dialect.java.JavaFunctionBuilder;
+import org.drools.spi.DeclarationScopeResolver;
+import org.drools.spi.KnowledgeHelper;
+import org.drools.util.StringUtils;
+import org.mvel.AbstractParser;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+import org.mvel.optimizers.OptimizerFactory;
+import org.mvel.util.ParseTools;
+
+public class MVELDialect
+    implements
+    Dialect {
+
+    public final static String           ID                      = "mvel";
+
+    private final static String                   EXPRESSION_DIALECT_NAME     = "MVEL";
+
+    private final PatternBuilder                  pattern                     = new PatternBuilder();
+    private final QueryBuilder                    query                       = new QueryBuilder();
+    private final MVELAccumulateBuilder           accumulate                  = new MVELAccumulateBuilder();
+    private final SalienceBuilder                 salience                    = new MVELSalienceBuilder();
+    private final MVELEvalBuilder                 eval                        = new MVELEvalBuilder();
+    private final MVELPredicateBuilder            predicate                   = new MVELPredicateBuilder();
+    private final MVELReturnValueBuilder          returnValue                 = new MVELReturnValueBuilder();
+    private final MVELConsequenceBuilder          consequence                 = new MVELConsequenceBuilder();
+    private final MVELActionBuilder               actionBuilder               = new MVELActionBuilder();
+    private final MVELReturnValueEvaluatorBuilder returnValueEvaluatorBuilder = new MVELReturnValueEvaluatorBuilder();
+    //private final JavaRuleClassBuilder            rule        = new JavaRuleClassBuilder();
+    private final MVELFromBuilder        from                    = new MVELFromBuilder();
+    private final JavaFunctionBuilder    function                = new JavaFunctionBuilder();
+    private final CollectBuilder         collect                 = new CollectBuilder();
+    private final ForallBuilder          forall                  = new ForallBuilder();
+    private final EntryPointBuilder      entrypoint              = new EntryPointBuilder();
+
+    private Map                          interceptors;
+
+    private List                         results;
+    //private final JavaFunctionBuilder             function    = new JavaFunctionBuilder();
+
+    private MemoryResourceReader         src;
+
+    private Package                               pkg;
+    private MVELDialectConfiguration              configuration;
+    private TypeResolver                          typeResolver;
+    private ClassFieldExtractorCache              classFieldExtractorCache;
+    private MVELExprAnalyzer                      analyzer;
+
+    private Map                                   imports;
+    private Map                                   packageImports;
+
+    private boolean                               strictMode;
+
+    private static Boolean                        languageSet                 = new Boolean( false );
+
+    public void addFunction(FunctionDescr functionDescr,
+                            TypeResolver typeResolver) {
+        throw new UnsupportedOperationException( "MVEL does not support functions" );
+
+    }
+
+    // a map of registered builders
+    private Map builders;
+
+    public MVELDialect() {
+    }
+
+    public static void setLanguageLevel(int level) {
+        synchronized ( languageSet ) {
+            // this synchronisation is needed as setLanguageLevel is now thread safe
+            // and we do not want ot be calling this while something else is being parsed.
+            // the flag ensures it is just called once and no more.
+            if ( languageSet.booleanValue() == false ) {
+                languageSet = new Boolean( true );
+                AbstractParser.setLanguageLevel( level );
+            }
+        }
+    }
+
+    public void init(PackageBuilder builder) {
+        setLanguageLevel( 4 );
+        this.pkg = builder.getPackage();
+        this.configuration = (MVELDialectConfiguration) builder.getPackageBuilderConfiguration().getDialectConfiguration( "mvel" );
+        this.typeResolver = builder.getTypeResolver();
+        this.classFieldExtractorCache = builder.getClassFieldExtractorCache();
+        this.strictMode = this.configuration.isStrict();
+
+        // we currently default to reflective optimisation
+        OptimizerFactory.setDefaultOptimizer( "reflective" );
+
+        MVEL.setThreadSafe( true );
+
+        this.analyzer = new MVELExprAnalyzer();
+        this.imports = new HashMap();
+        this.packageImports = new HashMap();
+
+        this.interceptors = new HashMap( 1 );
+        this.interceptors.put( "Modify",
+                               new ModifyInterceptor() );
+
+        this.results = new ArrayList();
+
+        if ( pkg != null ) {
+            init( pkg );
+        }
+
+        initBuilder();
+    }
+
+    public void initBuilder() {
+        // statically adding all builders to the map
+        // but in the future we can move that to a configuration
+        // if we want to
+        this.builders = new HashMap();
+
+        final GroupElementBuilder gebuilder = new GroupElementBuilder();
+
+        this.builders.put( AndDescr.class,
+                           gebuilder );
+
+        this.builders.put( OrDescr.class,
+                           gebuilder );
+
+        this.builders.put( NotDescr.class,
+                           gebuilder );
+
+        this.builders.put( ExistsDescr.class,
+                           gebuilder );
+
+        this.builders.put( PatternDescr.class,
+                           getPatternBuilder() );
+
+        this.builders.put( FromDescr.class,
+                           getFromBuilder() );
+
+        this.builders.put( QueryDescr.class,
+                           getQueryBuilder() );
+
+        this.builders.put( AccumulateDescr.class,
+                           getAccumulateBuilder() );
+
+        this.builders.put( EvalDescr.class,
+                           getEvalBuilder() );
+
+        this.builders.put( CollectDescr.class,
+                           this.collect );
+
+        this.builders.put( ForallDescr.class,
+                           this.forall );
+
+        this.builders.put( FunctionDescr.class,
+                           this.function );
+        
+        this.builders.put( EntryPointDescr.class,
+                           this.entrypoint );
+    }
+
+    public void init(Package pkg) {
+        this.pkg = pkg;
+        this.results = new ArrayList();
+        this.src = new MemoryResourceReader();
+        if ( this.pkg != null ) {
+            this.addImport( this.pkg.getName() + ".*" );
+        }
+    }
+
+    public void init(RuleDescr ruleDescr) {
+        //MVEL:test null to Fix failing test on org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilderTest.testImperativeCodeError()
+
+        // @todo: why is this here, MVEL doesn't compile anything? mdp
+        String pkgName = this.pkg == null ? "" : this.pkg.getName();
+        final String ruleClassName = JavaDialect.getUniqueLegalName( pkgName,
+                                                                     ruleDescr.getName(),
+                                                                     "mvel",
+                                                                     "Rule",
+                                                                     this.src );
+        ruleDescr.setClassName( StringUtils.ucFirst( ruleClassName ) );
+    }
+
+    public void init(final ProcessDescr processDescr) {
+        final String processDescrClassName = JavaDialect.getUniqueLegalName( this.pkg.getName(),
+                                                                             processDescr.getName(),
+                                                                             "mvel",
+                                                                             "Process",
+                                                                             this.src );
+        processDescr.setClassName( StringUtils.ucFirst( processDescrClassName ) );
+    }
+
+    public String getExpressionDialectName() {
+        return EXPRESSION_DIALECT_NAME;
+    }
+
+    public void addRule(RuleBuildContext context) {
+        //MVEL: Compiler change
+        final RuleDescr ruleDescr = context.getRuleDescr();
+
+        // setup the line mappins for this rule
+        final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
+        final LineMappings mapping = new LineMappings( name );
+        mapping.setStartLine( ruleDescr.getConsequenceLine() );
+        mapping.setOffset( ruleDescr.getConsequenceOffset() );
+
+        context.getPkg().getPackageCompilationData().getLineMappings().put( name,
+                                                                            mapping );
+
+    }
+
+    public void addProcess(final ProcessBuildContext context) {
+        // @TODO setup line mappings
+    }
+
+    public void addImport(String importEntry) {
+        if ( importEntry.endsWith( ".*" ) ) {
+            importEntry = importEntry.substring( 0,
+                                                 importEntry.length() - 2 );
+            this.packageImports.put( importEntry,
+                                     importEntry );
+        } else {
+            try {
+                Class cls = this.typeResolver.resolveType( importEntry );
+                this.imports.put( ParseTools.getSimpleClassName( cls ),
+                                  cls );
+            } catch ( ClassNotFoundException e ) {
+                this.results.add( new ImportError( importEntry,
+                                                   1 ) );
+            }
+        }
+    }
+
+    public Map getImports() {
+        return this.imports;
+    }
+
+    public Map getPackgeImports() {
+        return this.packageImports;
+    }
+
+    public void addStaticImport(String staticImportEntry) {
+        if ( staticImportEntry.endsWith( "*" ) ) {
+            return;
+        }
+
+        int index = staticImportEntry.lastIndexOf( '.' );
+        String className = staticImportEntry.substring( 0,
+                                                        index );
+        String methodName = staticImportEntry.substring( index + 1 );
+
+        try {
+            Class cls = this.pkg.getPackageCompilationData().getClassLoader().loadClass( className );
+            Method[] methods = cls.getDeclaredMethods();
+            for ( int i = 0; i < methods.length; i++ ) {
+                if ( methods[i].getName().equals( methodName ) ) {
+                    this.imports.put( methodName,
+                                      methods[i] );
+                    break;
+                }
+            }
+        } catch ( ClassNotFoundException e ) {
+            this.results.add( new ImportError( staticImportEntry,
+                                               -1 ) );
+        }
+    }
+
+    public boolean isStrictMode() {
+        return strictMode;
+    }
+
+    public void setStrictMode(boolean strictMode) {
+        this.strictMode = strictMode;
+    }
+
+    public void compileAll() {
+    }
+
+    public Dialect.AnalysisResult analyzeExpression(PackageBuildContext context,
+                                                    BaseDescr descr,
+                                                    Object content,
+                                                    final Set[] availableIdentifiers) {
+        return analyzeExpression( context,
+                                  descr,
+                                  content,
+                                  availableIdentifiers,
+                                  null );
+    }
+
+    public Dialect.AnalysisResult analyzeExpression(PackageBuildContext context,
+                                                    BaseDescr descr,
+                                                    Object content,
+                                                    final Set[] availableIdentifiers,
+                                                    Map localTypes) {
+        //new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()},
+
+        Dialect.AnalysisResult result = null;
+        try {
+            result = this.analyzer.analyzeExpression( context,
+                                                      (String) content,
+                                                      availableIdentifiers,
+                                                      localTypes );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          null,
+                                                          "Unable to determine the used declarations.\n" + e.getMessage() ) );
+        }
+        return result;
+    }
+
+    public Dialect.AnalysisResult analyzeBlock(PackageBuildContext context,
+                                               BaseDescr descr,
+                                               String text,
+                                               final Set[] availableIdentifiers) {
+        return analyzeBlock( context,
+                             descr,
+                             null,
+                             text,
+                             availableIdentifiers,
+                             null );
+    }
+
+    public Dialect.AnalysisResult analyzeBlock(PackageBuildContext context,
+                                               BaseDescr descr,
+                                               Map interceptors,
+                                               String text,
+                                               final Set[] availableIdentifiers,
+                                               Map localTypes) {
+        //new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()}
+
+        Dialect.AnalysisResult result = null;
+        try {
+            result = this.analyzer.analyzeExpression( context,
+                                                      text,
+                                                      availableIdentifiers,
+                                                      localTypes );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          e,
+                                                          "Unable to determine the used declarations.\n" + e.getMessage() ) );
+        }
+        return result;
+    }
+
+    public Serializable compile(final String text,
+                                final Dialect.AnalysisResult analysis,
+                                final Map interceptors,
+                                final Map outerDeclarations,
+                                final Map otherInputVariables,
+                                final PackageBuildContext context) {
+        final ParserContext parserContext = getParserContext( analysis,
+                                                              outerDeclarations,
+                                                              otherInputVariables,
+                                                              context );
+
+        ExpressionCompiler compiler = new ExpressionCompiler( text.trim() );
+
+        if ( MVELDebugHandler.isDebugMode() ) {
+            System.out.println( "Source before MVEL Compilation:\n" + text.trim() );
+            compiler.setDebugSymbols( true );
+        }
+
+        Serializable expr = compiler.compile( parserContext );
+        return expr;
+    }
+
+    public ParserContext getParserContext(final Dialect.AnalysisResult analysis,
+                                          final Map outerDeclarations,
+                                          final Map otherInputVariables,
+                                          final PackageBuildContext context) {
+        // @todo proper source file name
+        final ParserContext parserContext = new ParserContext( this.imports,
+                                                               null,
+                                                               "xxx" );//context.getPkg().getName()+"."+context.getRuleDescr().getClassName() );
+
+        for ( Iterator it = this.packageImports.values().iterator(); it.hasNext(); ) {
+            String packageImport = (String) it.next();
+            parserContext.addPackageImport( packageImport );
+        }
+
+        parserContext.setStrictTypeEnforcement( strictMode );
+
+        if ( interceptors != null ) {
+            parserContext.setInterceptors( interceptors );
+        }
+
+        List list[] = analysis.getBoundIdentifiers();
+
+        // @TODO yuck, we don't want conditions for configuration :(
+        if ( context instanceof RuleBuildContext ) {
+            //FIXME: analysis can be null, throws an NPE
+            DeclarationScopeResolver resolver = ((RuleBuildContext) context).getDeclarationResolver();
+            for ( Iterator it = list[0].iterator(); it.hasNext(); ) {
+                String identifier = (String) it.next();
+                Class cls = resolver.getDeclaration( identifier ).getExtractor().getExtractToClass();
+                parserContext.addInput( identifier,
+                                        cls );
+            }
+        }
+
+        Map globalTypes = context.getPkg().getGlobals();
+        for ( Iterator it = list[1].iterator(); it.hasNext(); ) {
+            String identifier = (String) it.next();
+            parserContext.addInput( identifier,
+                                    (Class) globalTypes.get( identifier ) );
+        }
+
+        if( otherInputVariables != null ) {
+            for ( Iterator it = otherInputVariables.entrySet().iterator(); it.hasNext(); ) {
+                Entry entry = (Entry) it.next();
+                parserContext.addInput( (String) entry.getKey(),
+                                        (Class) entry.getValue() );
+            }
+        }
+
+        if ( outerDeclarations != null ) {
+            for ( Iterator it = outerDeclarations.entrySet().iterator(); it.hasNext(); ) {
+                Entry entry = (Entry) it.next();
+                parserContext.addInput( (String) entry.getKey(),
+                                        ((Declaration) entry.getValue()).getExtractor().getExtractToClass() );
+            }
+        }
+
+        parserContext.addInput( "drools",
+                                KnowledgeHelper.class );
+
+        return parserContext;
+    }
+
+    public RuleConditionBuilder getBuilder(final Class clazz) {
+        return (RuleConditionBuilder) this.builders.get( clazz );
+    }
+
+    public Map getBuilders() {
+        return this.builders;
+    }
+
+    public ClassFieldExtractorCache getClassFieldExtractorCache() {
+        return this.classFieldExtractorCache;
+    }
+
+    public PatternBuilder getPatternBuilder() {
+        return this.pattern;
+    }
+
+    public QueryBuilder getQueryBuilder() {
+        return this.query;
+    }
+
+    public AccumulateBuilder getAccumulateBuilder() {
+        return this.accumulate;
+    }
+
+    public ConsequenceBuilder getConsequenceBuilder() {
+        return this.consequence;
+    }
+
+    public ActionBuilder getActionBuilder() {
+        return this.actionBuilder;
+    }
+
+    public MVELReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+        return this.returnValueEvaluatorBuilder;
+    }
+
+    public RuleConditionBuilder getEvalBuilder() {
+        return this.eval;
+    }
+
+    public FromBuilder getFromBuilder() {
+        return this.from;
+    }
+
+    public EntryPointBuilder getEntryPointBuilder() {
+        return this.entrypoint;
+    }
+
+    public PredicateBuilder getPredicateBuilder() {
+        return this.predicate;
+    }
+
+    public PredicateBuilder getExpressionPredicateBuilder() {
+        return this.predicate;
+    }
+
+    public SalienceBuilder getSalienceBuilder() {
+        return this.salience;
+    }
+
+    public List getResults() {
+        return results;
+    }
+
+    public ReturnValueBuilder getReturnValueBuilder() {
+        return this.returnValue;
+    }
+
+    public RuleClassBuilder getRuleClassBuilder() {
+        throw new UnsupportedOperationException( "MVELDialect.getRuleClassBuilder is not supported" );
+    }
+
+    public ProcessClassBuilder getProcessClassBuilder() {
+        throw new UnsupportedOperationException( "MVELDialect.getProcessClassBuilder is not supported" );
+    }
+
+    public TypeResolver getTypeResolver() {
+        return this.typeResolver;
+    }
+
+    public Map getInterceptors() {
+        return this.interceptors;
+    }
+
+    public String getId() {
+        return ID;
+    }
+
+	@Override
+	public TimeWindowBuilder getTimeWindowBuilder() {
+		// TODO MVEL dialect for TimeWindowBuilder is not supported yet, only Java dialect is supported
+		return null;
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialectConfiguration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialectConfiguration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialectConfiguration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+
+/**
+ * The MVEL dialect.
+ * 
+ * drools.dialect.mvel.strict = <true|false>
+ * 
+ * Default strict is true, which means all expressions and the consequence are type safe.
+ * However dynamic mode is still used while executed nested accessors in the field constraints.
+ *
+ */
+public class MVELDialectConfiguration
+    implements
+    DialectConfiguration {
+
+    private PackageBuilderConfiguration conf;
+
+    private boolean                     strict;
+
+    public Dialect getDialect() {
+        return new MVELDialect();
+    }
+
+    public void init(PackageBuilderConfiguration conf) {
+        this.conf = conf;
+        setStrict( getStrict() );
+    }
+
+    public PackageBuilderConfiguration getPackageBuilderConfiguration() {
+        return this.conf;
+    }
+
+    public void setStrict(boolean strict) {
+        this.strict = strict;
+    }
+
+    public boolean isStrict() {
+        return this.strict;
+    }
+
+    private boolean getStrict() {
+        final String prop = this.conf.getChainedProperties().getProperty( "drools.dialect.mvel.strict",
+                                                                          "true" );
+        return Boolean.valueOf( prop ).booleanValue();
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELEvalExpression;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.EvalCondition;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.spi.DeclarationScopeResolver;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+import org.mvel.util.ParseTools;
+
+/**
+ * @author etirelli
+ *
+ */
+public class MVELEvalBuilder
+    implements
+    RuleConditionBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    /**
+     * Builds and returns an Eval Conditional Element
+     * 
+     * @param context The current build context
+     * @param utils The current build utils instance
+     * @param patternBuilder not used by EvalBuilder
+     * @param descr The Eval Descriptor to build the eval conditional element from
+     * 
+     * @return the Eval Conditional Element
+     */
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+        // it must be an EvalDescr
+        final EvalDescr evalDescr = (EvalDescr) descr;
+
+        try {
+            final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
+                                                                     null,
+                                                                     context.getPkg().getGlobals() );
+
+            Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                      evalDescr,
+                                                                                      evalDescr.getContent(),
+                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+            final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+            final Declaration[] declarations = new Declaration[usedIdentifiers[0].size()];
+            for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
+                declarations[i] = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
+            }
+
+            final EvalCondition eval = new EvalCondition( declarations );
+
+            Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) evalDescr.getContent(),
+                                                                              analysis,
+                                                                              null,
+                                                                              null,
+                                                                              null,
+                                                                              context );
+
+            eval.setEvalExpression( new MVELEvalExpression( expr,
+                                                            factory ) );
+
+            return eval;
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                    evalDescr,
+                                                    e,
+                                                    "Unable to build expression for 'eval' node '" + evalDescr.getContent() + "'" ) );
+            return null;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,142 @@
+package org.drools.rule.builder.dialect.mvel;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.antlr.runtime.RecognitionException;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+import org.mvel.integration.impl.MapVariableResolver;
+
+/**
+ * Expression analyzer.
+ * 
+ */
+public class MVELExprAnalyzer {
+
+    public MVELExprAnalyzer() {
+        // intentionally left blank.
+    }
+
+    // ------------------------------------------------------------
+    // Instance methods
+    // ------------------------------------------------------------
+
+    /**
+     * Analyze an expression.
+     * 
+     * @param expr
+     *            The expression to analyze.
+     * @param availDecls
+     *            Total set of declarations available.
+     * 
+     * @return The <code>Set</code> of declarations used by the expression.
+     * @throws RecognitionException 
+     *             If an error occurs in the parser.
+     */
+    public MVELAnalysisResult analyzeExpression(final PackageBuildContext context,
+                                                final String expr,
+                                                final Set[] availableIdentifiers,
+                                                final Map localTypes) throws RecognitionException {
+        MVELAnalysisResult result = null;
+        if ( expr.trim().length() > 0 ) {
+            ExpressionCompiler compiler = new ExpressionCompiler( expr );
+
+            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+            // @todo proper source file name
+            final ParserContext parserContext = new ParserContext( dialect.getImports(),
+                                                                   null,
+                                                                   "xxx" ); //context.getPkg().getName() + "." + context.getRuleDescr().getClassName() );
+
+            if ( dialect.getPackgeImports() != null && !dialect.getPackgeImports().isEmpty() ) {
+	            for ( Iterator it = dialect.getPackgeImports().values().iterator(); it.hasNext(); ) {
+	                String packageImport = (String) it.next();
+	                parserContext.addPackageImport( packageImport );
+	            }
+            }
+            
+            parserContext.setStrictTypeEnforcement( false );
+
+            parserContext.setInterceptors( dialect.getInterceptors() );
+
+            compiler.compile( parserContext );
+
+            result = analyze( compiler.getParserContextState().getInputs().keySet(),
+                              availableIdentifiers );
+
+            result.setMvelVariables( compiler.getParserContextState().getVariables() );
+        } else {
+            result = analyze( Collections.EMPTY_SET,
+                              availableIdentifiers );
+            result.setMvelVariables( new HashMap() );
+
+        }
+        return result;
+    }
+
+    /**
+     * Analyze an expression.
+     * 
+     * @param availDecls
+     *            Total set of declarations available.
+     * @param ast
+     *            The AST for the expression.
+     * 
+     * @return The <code>Set</code> of declarations used by the expression.
+     * 
+     * @throws RecognitionException
+     *             If an error occurs in the parser.
+     */
+    private MVELAnalysisResult analyze(final Set identifiers,
+                                       final Set[] availableIdentifiers) throws RecognitionException {
+
+        MVELAnalysisResult result = new MVELAnalysisResult();
+        result.setIdentifiers( new ArrayList( identifiers ) );
+
+        final Set notBound = new HashSet( identifiers );
+        final List[] used = new List[availableIdentifiers.length];
+        for ( int i = 0, length = used.length; i < length; i++ ) {
+            used[i] = new ArrayList();
+        }
+
+        for ( int i = 0, length = availableIdentifiers.length; i < length; i++ ) {
+            final Set set = availableIdentifiers[i];
+            for ( final Iterator it = set.iterator(); it.hasNext(); ) {
+                final String eachDecl = (String) it.next();
+                if ( identifiers.contains( eachDecl ) ) {
+                    used[i].add( eachDecl );
+                    notBound.remove( eachDecl );
+                }
+            }
+        }
+        result.setBoundIdentifiers( used );
+        result.setNotBoundedIdentifiers( new ArrayList( notBound ) );
+
+        return result;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.drools.base.dataproviders.MVELDataProvider;
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.AccessorDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.rule.From;
+import org.drools.rule.Pattern;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.FromBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.spi.DataProvider;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+import org.mvel.integration.impl.ClassImportResolverFactory;
+
+/**
+ * A builder for "from" conditional element
+ * 
+ * @author etirelli
+ */
+public class MVELFromBuilder
+    implements
+    FromBuilder {
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr) {
+        return build( context,
+                      descr,
+                      null );
+    }
+
+    public RuleConditionElement build(final RuleBuildContext context,
+                                      final BaseDescr descr,
+                                      final Pattern prefixPattern) {
+        final FromDescr fromDescr = (FromDescr) descr;
+
+        final AccessorDescr accessor = (AccessorDescr) fromDescr.getDataSource();
+        DataProvider dataProvider = null;
+        try {
+            final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
+                                                                     null,
+                                                                     context.getPkg().getGlobals() );
+
+            // This builder is re-usable in other dialects, so specify by name
+            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+            String text = (String) accessor.toString();
+            Dialect.AnalysisResult analysis = dialect.analyzeExpression( context,
+                                                                         descr,
+                                                                         text,
+                                                                         new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final Serializable expr = dialect.compile( text,
+                                                       analysis,
+                                                       null,
+                                                       null,
+                                                       null,
+                                                       context );
+
+            dataProvider = new MVELDataProvider( expr,
+                                                 factory );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          fromDescr,
+                                                          null,
+                                                          "Unable to build expression for 'from' node '" + accessor + "'" ) );
+            return null;
+        }
+
+        return new From( dataProvider );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELPredicateExpression;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.PredicateConstraint;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+
+/**
+ * @author etirelli
+ *
+ */
+public class MVELPredicateBuilder
+    implements
+    PredicateBuilder {
+
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final PredicateConstraint predicate,
+                      final PredicateDescr predicateDescr) {
+        Map previousMap = new HashMap();
+        for ( int i = 0, length = previousDeclarations.length; i < length; i++ ) {
+            previousMap.put( previousDeclarations[i].getIdentifier(),
+                             previousDeclarations[i] );
+        }
+
+        Map localMap = new HashMap();
+        for ( int i = 0, length = localDeclarations.length; i < length; i++ ) {
+            localMap.put( localDeclarations[i].getIdentifier(),
+                          localDeclarations[i] );
+        }
+
+        try {
+            final DroolsMVELFactory factory = new DroolsMVELFactory( previousMap,
+                                                                     localMap,
+                                                                     context.getPkg().getGlobals() );
+
+            Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                      predicateDescr,
+                                                                                      predicateDescr.getContent(),
+                                                                                      new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) predicateDescr.getContent(),
+                                                                                    analysis,
+                                                                                    null,
+                                                                                    null,
+                                                                                    null,
+                                                                                    context );
+
+            predicate.setPredicateExpression( new MVELPredicateExpression( expr,
+                                                                           factory ) );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                    predicateDescr,
+                                                    e,
+                                                    "Unable to build expression for 'inline-eval' node '" + predicateDescr.getContent() + "'\n" + e.getMessage() ) );
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELReturnValueExpression;
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.ReturnValueRestriction;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+
+/**
+ * @author etirelli
+ *
+ */
+public class MVELReturnValueBuilder
+    implements
+    ReturnValueBuilder {
+
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final ReturnValueRestriction returnValueRestriction,
+                      final ReturnValueRestrictionDescr returnValueRestrictionDescr) {
+
+        Map previousMap = new HashMap();
+        for ( int i = 0, length = previousDeclarations.length; i < length; i++ ) {
+            previousMap.put( previousDeclarations[i].getIdentifier(),
+                             previousDeclarations[i] );
+        }
+
+        Map localMap = new HashMap();
+        for ( int i = 0, length = localDeclarations.length; i < length; i++ ) {
+            localMap.put( localDeclarations[i].getIdentifier(),
+                          localDeclarations[i] );
+        }
+
+        final DroolsMVELFactory factory = new DroolsMVELFactory( previousMap,
+                                                                 localMap,
+                                                                 context.getPkg().getGlobals() );
+
+        Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+                                                                                  returnValueRestrictionDescr,
+                                                                                  returnValueRestrictionDescr.getContent(),
+                                                                                  new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+        final Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) returnValueRestrictionDescr.getContent(),
+                                                                                analysis,
+                                                                                null,
+                                                                                null,
+                                                                                null,
+                                                                                context );
+
+        returnValueRestriction.setReturnValueExpression( new MVELReturnValueExpression( expr,
+                                                                                        factory ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,126 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELAction;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELReturnValueEvaluator;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.spi.ReturnValueEvaluator;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+import org.mvel.Macro;
+import org.mvel.MacroProcessor;
+
+public class MVELReturnValueEvaluatorBuilder
+    implements
+    ReturnValueEvaluatorBuilder {
+
+    public MVELReturnValueEvaluatorBuilder() {
+
+    }
+
+    public void build(final PackageBuildContext context,
+                      final ReturnValueConstraintEvaluator constraintNode,
+                      final ReturnValueDescr descr) {
+
+        String text = descr.getText();
+
+        try {
+            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+            Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+                                                                    descr,
+                                                                    dialect.getInterceptors(),
+                                                                    text,
+                                                                    new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()},
+                                                                    null );
+
+            final Serializable expr = dialect.compile( text,
+                                                       analysis,
+                                                       dialect.getInterceptors(),
+                                                       null,
+                                                       null,
+                                                       context );
+
+            final DroolsMVELFactory factory = new DroolsMVELFactory( null,
+                                                                     null,
+                                                                     context.getPkg().getGlobals(),
+                                                                     analysis.getBoundIdentifiers() );
+            
+            constraintNode.setEvaluator( new MVELReturnValueEvaluator( expr, factory ) );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          descr,
+                                                          null,
+                                                          "Unable to build expression for 'returnValuEvaluator' '" + descr.getText() + "'" ) );
+        }
+    }
+
+    /**
+     * Allows newlines to demarcate expressions, as per MVEL command line.
+     * If expression spans multiple lines (ie inside an unbalanced bracket) then
+     * it is left alone.
+     * Uses character based iteration which is at least an order of magnitude faster then a single
+     * simple regex.
+     */
+    public static String delimitExpressions(String s) {
+
+        StringBuffer result = new StringBuffer();
+        char[] cs = s.toCharArray();
+        int brace = 0;
+        int sqre = 0;
+        int crly = 0;
+        char lastNonWhite = ';';
+        for ( int i = 0; i < cs.length; i++ ) {
+            char c = cs[i];
+            switch ( c ) {
+                case '(' :
+                    brace++;
+                    break;
+                case '{' :
+                    crly++;
+                    break;
+                case '[' :
+                    sqre++;
+                    break;
+                case ')' :
+                    brace--;
+                    break;
+                case '}' :
+                    crly--;
+                    break;
+                case ']' :
+                    sqre--;
+                    break;
+                default :
+                    break;
+            }
+            if ( (brace == 0 && sqre == 0 && crly == 0) && (c == '\n' || c == '\r') ) {
+                if ( lastNonWhite != ';' ) {
+                    result.append( ';' );
+                    lastNonWhite = ';';
+                }
+            } else if ( !Character.isWhitespace( c ) ) {
+                lastNonWhite = c;
+            }
+            result.append( c );
+
+        }
+        return result.toString();
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,57 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELSalienceExpression;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.SalienceBuilder;
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+import org.mvel.integration.impl.ClassImportResolverFactory;
+
+public class MVELSalienceBuilder
+    implements
+    SalienceBuilder {
+
+    public void build(RuleBuildContext context) {
+        // pushing consequence LHS into the stack for variable resolution
+        context.getBuildStack().push( context.getRule().getLhs() );
+
+        try {
+            final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
+                                                                     null,
+                                                                     context.getPkg().getGlobals() );
+
+            // This builder is re-usable in other dialects, so specify by name            
+            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+            Dialect.AnalysisResult analysis = dialect.analyzeExpression( context,
+                                                                         context.getRuleDescr(),
+                                                                         (String) context.getRuleDescr().getSalience(),
+                                                                         new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
+
+            final Serializable expr = dialect.compile( (String) context.getRuleDescr().getSalience(),
+                                                       analysis,
+                                                       null,
+                                                       null,
+                                                       null,
+                                                       context );
+
+            MVELSalienceExpression salience = new MVELSalienceExpression( expr,
+                                                                          factory );
+
+            context.getRule().setSalience( salience );
+        } catch ( final Exception e ) {
+            context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+                                                          context.getRuleDescr(),
+                                                          null,
+                                                          "Unable to build expression for 'salience' node '" + context.getRuleDescr().getSalience() + "'" ) );
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/RuleCoverageListener.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/RuleCoverageListener.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/RuleCoverageListener.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+package org.drools.testframework;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.drools.WorkingMemory;
+import org.drools.event.ActivationCancelledEvent;
+import org.drools.event.ActivationCreatedEvent;
+import org.drools.event.AfterActivationFiredEvent;
+import org.drools.event.AgendaEventListener;
+import org.drools.event.AgendaGroupPoppedEvent;
+import org.drools.event.AgendaGroupPushedEvent;
+import org.drools.event.BeforeActivationFiredEvent;
+
+/**
+ * Measure the rule coverage.
+ * @author Michael Neale
+ */
+public class RuleCoverageListener implements AgendaEventListener {
+
+	final Set<String> rules;
+	private int totalCount;
+
+	/**
+	 * Pass in the expected rules to fire.
+	 * @param expectedRuleNames
+	 */
+	public RuleCoverageListener(HashSet<String> expectedRuleNames) {
+		this.rules = expectedRuleNames;
+		this.totalCount = expectedRuleNames.size();
+	}
+
+	public void activationCancelled(ActivationCancelledEvent event,
+			WorkingMemory workingMemory) {
+	}
+
+	public void activationCreated(ActivationCreatedEvent event,
+			WorkingMemory workingMemory) {
+	}
+
+	public void afterActivationFired(AfterActivationFiredEvent event,
+			WorkingMemory workingMemory) {
+		rules.remove(event.getActivation().getRule().getName());
+	}
+
+	public void agendaGroupPopped(AgendaGroupPoppedEvent event,
+			WorkingMemory workingMemory) {
+	}
+
+	public void agendaGroupPushed(AgendaGroupPushedEvent event,
+			WorkingMemory workingMemory) {
+	}
+
+	public void beforeActivationFired(BeforeActivationFiredEvent event,
+			WorkingMemory workingMemory) {
+	}
+
+	/**
+	 * @return A set of rules that were not fired.
+	 */
+	public String[] getUnfiredRules() {
+		return rules.toArray(new String[rules.size()]);
+	}
+
+	public int getPercentCovered() {
+		float left = totalCount - rules.size();
+
+		return (int) ((left / totalCount) * 100);
+	}
+
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/ScenarioRunner.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/ScenarioRunner.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/ScenarioRunner.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,261 @@
+package org.drools.testframework;
+
+import static org.mvel.MVEL.eval;
+
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.drools.FactHandle;
+import org.drools.base.TypeResolver;
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.Expectation;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.Fixture;
+import org.drools.brms.client.modeldriven.testing.RetractFact;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.rule.TimeMachine;
+import org.mvel.integration.impl.BaseVariableResolverFactory;
+
+/**
+ * This actually runs the test scenarios.
+ *
+ * @author Michael Neale
+ *
+ */
+public class ScenarioRunner {
+
+	final Scenario scenario;
+	final Map<String, Object> populatedData = new HashMap<String, Object>();
+	final Map<String, Object> globalData = new HashMap<String, Object>();
+	final Map<String, FactHandle> factHandles = new HashMap<String, FactHandle>();
+
+	final InternalWorkingMemory workingMemory;
+
+
+	/**
+	 * @param scenario
+	 *            The scenario to run.
+	 * @param resolver
+	 *            A populated type resolved to be used to resolve the types in
+	 *            the scenario.
+	 *
+	 * For info on how to invoke this, see
+	 * ContentPackageAssemblerTest.testPackageWithRuleflow in drools-jbrms This
+	 * requires that the classloader for the thread context be set
+	 * appropriately. The PackageBuilder can provide a suitable TypeResolver for
+	 * a given package header, and the Package config can provide a classloader.
+	 *
+	 */
+	public ScenarioRunner(final Scenario scenario, final TypeResolver resolver,
+			final InternalWorkingMemory wm) throws ClassNotFoundException {
+		this.scenario = scenario;
+		this.workingMemory = wm;
+		scenario.lastRunResult = new Date();
+
+
+
+			//stub out any rules we don't want to have the consequences firing of.
+			HashSet<String> ruleList = new HashSet<String>();
+			ruleList.addAll(scenario.rules);
+			//TestingEventListener.stubOutRules(ruleList, wm.getRuleBase(), scenario.inclusive);
+
+			TestingEventListener listener = null;
+
+			for (Iterator iterator = scenario.globals.iterator(); iterator.hasNext();) {
+				FactData fact = (FactData) iterator.next();
+				Object f = eval("new " + resolver.getFullTypeName(fact.type) + "()");
+				populateFields(fact, globalData, f);
+				globalData.put(fact.name, f);
+				wm.setGlobal(fact.name, f);
+			}
+
+			for (Iterator<Fixture> iterator = scenario.fixtures.iterator(); iterator.hasNext();) {
+				Fixture fx = iterator.next();
+
+				if (fx instanceof FactData) {
+					//deal with facts and globals
+					FactData fact = (FactData)fx;
+					Object f = (fact.isModify)? this.populatedData.get(fact.name) : eval("new " + resolver.getFullTypeName(fact.type) + "()");
+					if (fact.isModify) {
+						if (!this.factHandles.containsKey(fact.name)) {
+							throw new IllegalArgumentException("Was not a previously inserted fact. [" + fact.name  + "]");
+						}
+						populateFields(fact, populatedData, f);
+						this.workingMemory.update(this.factHandles.get(fact.name), f);
+					} else /* a new one */ {
+						populateFields(fact, populatedData, f);
+						populatedData.put(fact.name, f);
+						this.factHandles.put(fact.name, wm.insert(f));
+					}
+				} else if (fx instanceof RetractFact) {
+					RetractFact f = (RetractFact)fx;
+					this.workingMemory.retract(this.factHandles.get(f.name));
+					this.populatedData.remove(f.name);
+				} else if (fx instanceof ExecutionTrace) {
+					ExecutionTrace executionTrace = (ExecutionTrace)fx;
+					//create the listener to trace rules
+
+					if (listener != null) wm.removeEventListener(listener); //remove the old
+					listener = new TestingEventListener();
+
+					wm.addEventListener(listener);
+
+					//set up the time machine
+					applyTimeMachine(wm, executionTrace);
+
+					//love you
+					long time = System.currentTimeMillis();
+					wm.fireAllRules(listener.getAgendaFilter(ruleList, scenario.inclusive),scenario.maxRuleFirings);
+					executionTrace.executionTimeResult = System.currentTimeMillis() - time;
+					executionTrace.numberOfRulesFired = listener.totalFires;
+
+				} else if (fx instanceof Expectation) {
+						Expectation assertion = (Expectation) fx;
+						if (assertion instanceof VerifyFact) {
+							verify((VerifyFact) assertion);
+						} else if (assertion instanceof VerifyRuleFired) {
+							verify((VerifyRuleFired) assertion,
+									(listener.firingCounts != null) ? listener.firingCounts : new HashMap<String, Integer>());
+						}
+				} else {
+					throw new IllegalArgumentException("Not sure what to do with " + fx);
+				}
+
+
+
+			}
+
+
+
+	}
+
+	private void applyTimeMachine(final InternalWorkingMemory wm,
+			ExecutionTrace executionTrace) {
+		if (executionTrace.scenarioSimulatedDate != null) {
+			final Calendar now = Calendar.getInstance();
+			now.setTimeInMillis(executionTrace.scenarioSimulatedDate.getTime());
+			wm.setTimeMachine(new TimeMachine() {
+				@Override
+				public Calendar getNow() {
+					return now;
+				}
+			});
+		} else {
+			//normal time.
+			wm.setTimeMachine(new TimeMachine());
+		}
+	}
+
+	void verify(VerifyRuleFired assertion, Map<String, Integer> firingCounts) {
+
+		assertion.actualResult = firingCounts.containsKey(assertion.ruleName) ? firingCounts
+				.get(assertion.ruleName)
+				: 0;
+		if (assertion.expectedFire != null) {
+			if (assertion.expectedFire) {
+				if (assertion.actualResult > 0) {
+					assertion.successResult = true;
+					assertion.explanation = "Rule [" + assertion.ruleName + "] was actived " + assertion.actualResult + " times.";
+				} else {
+					assertion.successResult = false;
+					assertion.explanation = "Rule [" + assertion.ruleName + "] was not activated. Expected it to be activated.";
+				}
+			} else {
+				if (assertion.actualResult == 0) {
+					assertion.successResult = true;
+					assertion.explanation = "Rule [" + assertion.ruleName + "] was not activated.";
+				} else {
+					assertion.successResult = false;
+					assertion.explanation = "Rule [" + assertion.ruleName + "] was activated " + assertion.actualResult + " times, but expected none.";
+				}
+			}
+		}
+
+		if (assertion.expectedCount != null) {
+			if (assertion.actualResult.equals(assertion.expectedCount)) {
+				assertion.successResult = true;
+				assertion.explanation = "Rule [" + assertion.ruleName + "] activated " + assertion.actualResult + " times.";
+			} else {
+				assertion.successResult = false;
+				assertion.explanation = "Rule [" + assertion.ruleName + "] activated " + assertion.actualResult + " times. Expected " + assertion.expectedCount + " times.";
+			}
+		}
+	}
+
+
+	void verify(VerifyFact value) {
+
+		Object fact = this.populatedData.get(value.name);
+		if (fact == null) fact = this.globalData.get(value.name);
+		for (int i = 0; i < value.fieldValues.size(); i++) {
+			VerifyField fld = (VerifyField) value.fieldValues.get(i);
+			Map<String, Object> st = new HashMap<String, Object>();
+			st.put("__fact__", fact);
+			if (fld.expected != null) {
+				Object expectedVal = fld.expected.trim();
+				if (fld.expected.startsWith("=")) {
+					expectedVal = eval(fld.expected.substring(1), this.populatedData);
+				}
+				st.put("__expected__", expectedVal);
+
+				fld.successResult = (Boolean) eval("__fact__." + fld.fieldName
+						+ " " + fld.operator  + " __expected__", st);
+
+
+				if (!fld.successResult) {
+					Object actual = eval("__fact__." + fld.fieldName, st);
+					fld.actualResult = (actual != null) ? actual.toString() : "";
+
+					if (fld.operator.equals("==")) {
+						fld.explanation = "[" + value.name + "] field [" + fld.fieldName + "] was [" + fld.actualResult
+											+ "] expected [" + fld.expected + "].";
+					} else {
+						fld.explanation = "[" + value.name + "] field [" + fld.fieldName + "] was not expected to be [" + fld.actualResult
+						+ "].";
+					}
+				} else {
+					if (fld.operator.equals("==")) {
+						fld.explanation = "[" + value.name + "] field [" + fld.fieldName + "] was [" + fld.expected + "].";
+					} else if (fld.operator.equals("!=")){
+						fld.explanation = "[" + value.name + "] field [" + fld.fieldName + "] was not [" + fld.expected + "].";
+					}
+				}
+			}
+
+		}
+	}
+
+	Object populateFields(FactData fact, Map<String, Object> factData, Object factObject) {
+		for (int i = 0; i < fact.fieldData.size(); i++) {
+			FieldData field = (FieldData) fact.fieldData.get(i);
+			Object val;
+			if (field.value != null && !field.value.equals("")) {
+				if (field.value.startsWith("=")) {
+					// eval the val into existence
+					val = eval(field.value.substring(1), factData);
+				} else {
+					val = field.value;
+				}
+				Map<String, Object> vars = new HashMap<String, Object>();
+				vars.putAll(factData);
+				vars.put("__val__", val);
+				vars.put("__fact__", factObject);
+				eval("__fact__." + field.name + " = __val__", vars);
+			}
+		}
+		return factObject;
+	}
+
+
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/TestingEventListener.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/TestingEventListener.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/testframework/TestingEventListener.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,165 @@
+package org.drools.testframework;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.drools.RuleBase;
+import org.drools.WorkingMemory;
+import org.drools.event.ActivationCancelledEvent;
+import org.drools.event.ActivationCreatedEvent;
+import org.drools.event.AfterActivationFiredEvent;
+import org.drools.event.AgendaEventListener;
+import org.drools.event.AgendaGroupPoppedEvent;
+import org.drools.event.AgendaGroupPushedEvent;
+import org.drools.event.BeforeActivationFiredEvent;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaFilter;
+import org.drools.spi.Consequence;
+import org.drools.spi.KnowledgeHelper;
+
+/**
+ * This tracks what is happening in the engine with rule activations and firings.
+ * It also allows you to choose what to include/exclude from firing.
+ *
+ * If a rule is not allowed to fire, it will still be counted as an activation.
+ * If it is allowed to fire, then it will only be counted after the activation is fired.
+ *
+ * @author Michael Neale
+ */
+public class TestingEventListener implements AgendaEventListener {
+
+    final Map<String, Integer>	firingCounts = new HashMap<String, Integer>(100);
+
+	long totalFires;
+
+
+    public TestingEventListener() {
+    }
+
+    public AgendaFilter getAgendaFilter(final HashSet<String> ruleNames, final boolean inclusive) {
+    	return new AgendaFilter() {
+			public boolean accept(Activation activation) {
+				if (ruleNames.size() ==0) return true;
+				String ruleName = activation.getRule().getName();
+				if (inclusive) {
+					if (ruleNames.contains(ruleName)) {
+						return true;
+					} else {
+						record(activation.getRule(), firingCounts);
+						return false;
+					}
+				} else {
+					if (!ruleName.contains(ruleName)) {
+						return true;
+					} else {
+						record(activation.getRule(), firingCounts);
+						return false;
+					}
+				}
+			}
+    	};
+    }
+
+
+
+//    /**
+//     * Exclusive means DO NOT fire the rules mentioned.
+//     * For those rules, they will still be counted, just not allowed to activate.
+//     * Inclusive means only the rules on the given set are allowed to fire.
+//     * The other rules will have their activation counted but not be allowed to fire.
+//     */
+//	static void stubOutRules(HashSet<String> ruleNames, RuleBase ruleBase,
+//			boolean inclusive) {
+//		if (ruleNames.size() > 0) {
+//	    	if (inclusive) {
+//	    		Package[] pkgs = ruleBase.getPackages();
+//	    		for (int i = 0; i < pkgs.length; i++) {
+//					Rule[] rules = pkgs[i].getRules();
+//					for (int j = 0; j < rules.length; j++) {
+//						Rule rule = rules[j];
+//						if (!ruleNames.contains(rule.getName())) {
+//							rule.setConsequence(new NilConsequence());
+//						}
+//					}
+//				}
+//	    	} else {
+//	    		Package[] pkgs = ruleBase.getPackages();
+//	    		for (int i = 0; i < pkgs.length; i++) {
+//	    			Package pkg = pkgs[i];
+//	    			for (Iterator iter = ruleNames.iterator(); iter.hasNext();) {
+//						String name = (String) iter.next();
+//						Rule rule = pkg.getRule(name);
+//						rule.setConsequence(new NilConsequence());
+//					}
+//
+//	    		}
+//	    	}
+//    	}
+//	}
+
+
+
+
+
+    public void activationCancelled(ActivationCancelledEvent event,
+            WorkingMemory workingMemory) {
+    }
+
+    public void activationCreated(ActivationCreatedEvent event,
+            WorkingMemory workingMemory) {
+    }
+
+    public void afterActivationFired(AfterActivationFiredEvent event,
+            WorkingMemory workingMemory) {
+    	recordFiring(event.getActivation().getRule());
+    }
+
+	private void recordFiring(Rule rule) {
+		record(rule, this.firingCounts);
+	}
+
+	public void agendaGroupPopped(AgendaGroupPoppedEvent event,
+            WorkingMemory workingMemory) {
+    }
+
+    public void agendaGroupPushed(AgendaGroupPushedEvent event,
+            WorkingMemory workingMemory) {
+    }
+
+	public void beforeActivationFired(BeforeActivationFiredEvent event, WorkingMemory workingMemory) {
+	}
+
+	private void record(Rule rule, Map<String, Integer> counts) {
+		this.totalFires++;
+		String name = rule.getName();
+		if (!counts.containsKey(name)) {
+			counts.put(name, 1);
+		} else {
+			counts.put(name, counts.get(name) + 1);
+		}
+	}
+
+
+
+	/**
+	 * @return A map of the number of times a given rule "fired".
+	 * (of course in reality the side effect of its firing may have been nilled out).
+	 */
+	public Map<String, Integer> getFiringCounts() {
+		return this.firingCounts;
+	}
+
+
+
+}
+
+class NilConsequence implements Consequence {
+
+	public void evaluate(KnowledgeHelper knowledgeHelper, WorkingMemory workingMemory) throws Exception {
+	}
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/BaseAbstractHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/BaseAbstractHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/BaseAbstractHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,63 @@
+package org.drools.xml;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Set;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ */
+public abstract class BaseAbstractHandler {
+    protected Set     validPeers;
+    protected Set     validParents;
+    protected boolean allowNesting;
+
+    public Set getValidParents() {
+        return this.validParents;
+    }
+
+    public Set getValidPeers() {
+        return this.validPeers;
+    }
+
+    public boolean allowNesting() {
+        return this.allowNesting;
+    }
+
+    public void emptyAttributeCheck(final String element,
+                                    final String attributeName,
+                                    final String attribute,
+                                    final ExtensibleXmlParser xmlPackageReader) throws SAXException {
+        if ( attribute == null || attribute.trim().equals( "" ) ) {
+            throw new SAXParseException( "<" + element + "> requires a '" + attributeName + "' attribute",
+                                         xmlPackageReader.getLocator() );
+        }
+    }
+
+    public void emptyContentCheck(final String element,
+                                  final String content,
+                                  final ExtensibleXmlParser xmlPackageReader) throws SAXException {
+        if ( content == null || content.trim().equals( "" ) ) {
+            throw new SAXParseException( "<" + element + "> requires content",
+                                         xmlPackageReader.getLocator() );
+        }
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Configuration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Configuration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Configuration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,103 @@
+package org.drools.xml;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Configuration passed to a configurable <code>SemanticComponent</code>.
+ * 
+ * <p>
+ * A <code>Configuration</code> may actually form a tree-shaped structure in
+ * order to hold complex configuration data. Each node in the tree is
+ * represented by a <code>Configuration</code> object that has a name and may
+ * contain attributes, children and text.
+ * </p>
+ * 
+ * @author <a href="mailto:bob at werken.com">bob mcwhirter </a>
+ * 
+ * @version $Id: Configuration.java,v 1.5 2005/01/23 18:16:20 mproctor Exp $
+ */
+public interface Configuration {
+    // ----------------------------------------------------------------------
+    //     Constants
+    // ----------------------------------------------------------------------
+
+    /** Empty <code>Configuration</code> array. */
+    Configuration[] EMPTY_ARRAY = new Configuration[0];
+
+    // ----------------------------------------------------------------------
+    //     Interface
+    // ----------------------------------------------------------------------
+
+    /**
+     * Retrieve the node name.
+     * 
+     * @return The node name.
+     */
+    String getName();
+
+    /**
+     * Retrieve the node text.
+     * 
+     * @return The node text.
+     */
+    String getText();
+
+    /**
+     * Retrieve an attribute value.
+     * 
+     * @param name The attribute name.
+     * 
+     * @return The attribute value or <code>null</code> if no attribute
+     *         matches the specified name.
+     */
+    String getAttribute(String name);
+
+    /**
+     * Retrieve all attribute names.
+     * 
+     * @return The attribute names.
+     */
+    String[] getAttributeNames();
+
+    /**
+     * Retrieve a child node.
+     * 
+     * @param name The child name.
+     * 
+     * @return The first child matching the specified name, otherwise
+     *         <code>null</code> if none match.
+     */
+    Configuration getChild(String name);
+
+    /**
+     * Retrieve children nodes.
+     * 
+     * @param name The child name.
+     * 
+     * @return All children matching the specified name, otherwise an empty
+     *         array if none match.
+     */
+    Configuration[] getChildren(String name);
+
+    /**
+     * Retrieve all children nodes.
+     * 
+     * @return All children nodes, otherwise an empty array if this node
+     *         contains no children.
+     */
+    Configuration[] getChildren();
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultConfiguration.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultConfiguration.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultConfiguration.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,176 @@
+package org.drools.xml;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Default implementation of <code>Configuration</code>.
+ * 
+ * @author <a href="mailto:bob at werken.com">bob mcwhirter </a>
+ * 
+ * @version $Id: DefaultConfiguration.java,v 1.2 2004/09/17 00:25:09 mproctor
+ *          Exp $
+ */
+public class DefaultConfiguration
+    implements
+    Configuration {
+    // ----------------------------------------------------------------------
+    //     Class members
+    // ----------------------------------------------------------------------
+
+    /** Empty <code>String</code> array. */
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    // ----------------------------------------------------------------------
+    //     Instance members
+    // ----------------------------------------------------------------------
+
+    /** Node name. */
+    private final String          name;
+
+    /** Node text. */
+    private String                text               = "";
+
+    /** Node attributes. */
+    private final Map             attrs;
+
+    /** Children nodes. */
+    private final List            children;
+
+    // ----------------------------------------------------------------------
+    //     Constructors
+    // ----------------------------------------------------------------------
+
+    /**
+     * Construct.
+     * 
+     * @param name
+     *            The name of the node.
+     */
+    public DefaultConfiguration(final String name) {
+        this.name = name;
+        this.attrs = new HashMap();
+        this.children = new ArrayList();
+    }
+
+    /**
+     * @see Configuration
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * Set the node text.
+     * 
+     * @param text
+     *            The text.
+     */
+    public void setText(final String text) {
+        this.text = text;
+    }
+
+    /**
+     * @see Configuration
+     */
+    public String getText() {
+        return this.text;
+    }
+
+    /**
+     * Set an attribute value.
+     * 
+     * @param name
+     *            The attribute name.
+     * @param value
+     *            The attribute value.
+     */
+    public void setAttribute(final String name,
+                             final String value) {
+        this.attrs.put( name,
+                        value );
+    }
+
+    /**
+     * @see Configuration
+     */
+    public String getAttribute(final String name) {
+        return (String) this.attrs.get( name );
+    }
+
+    /**
+     * @see Configuration
+     */
+    public String[] getAttributeNames() {
+        return (String[]) this.attrs.keySet().toArray( DefaultConfiguration.EMPTY_STRING_ARRAY );
+    }
+
+    /**
+     * Add a child <code>Configuration</code>.
+     * 
+     * @param config
+     *            The child.
+     */
+    public void addChild(final Configuration config) {
+        this.children.add( config );
+    }
+
+    /**
+     * @see Configuration
+     */
+    public Configuration getChild(final String name) {
+        for ( final Iterator childIter = this.children.iterator(); childIter.hasNext(); ) {
+            final Configuration eachConfig = (Configuration) childIter.next();
+
+            if ( eachConfig.getName().equals( name ) ) {
+                return eachConfig;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * @see Configuration
+     */
+    public Configuration[] getChildren(final String name) {
+        final List result = new ArrayList();
+
+        for ( final Iterator childIter = this.children.iterator(); childIter.hasNext(); ) {
+            final Configuration eachConfig = (Configuration) childIter.next();
+
+            if ( eachConfig.getName().equals( name ) ) {
+                result.add( eachConfig );
+            }
+        }
+
+        return (Configuration[]) result.toArray( Configuration.EMPTY_ARRAY );
+    }
+
+    /**
+     * @see Configuration
+     */
+    public Configuration[] getChildren() {
+        return (Configuration[]) this.children.toArray( Configuration.EMPTY_ARRAY );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultSemanticModule.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultSemanticModule.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/DefaultSemanticModule.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,27 @@
+package org.drools.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultSemanticModule implements SemanticModule {
+    public String uri;
+    public Map<String, Handler> handlers;
+    
+    public DefaultSemanticModule(String uri) {
+        this.uri = uri;
+        this.handlers = new HashMap<String, Handler>();
+    }    
+
+    public String getUri() {
+        return this.uri;
+    }
+    
+    public void addHandler(String name, Handler handler) {
+        this.handlers.put( name, handler );
+    }
+
+    public Handler getHandler(String name) {
+        return this.handlers.get( name );
+    }
+            
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ExtensibleXmlParser.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ExtensibleXmlParser.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ExtensibleXmlParser.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,719 @@
+package org.drools.xml;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * <code>RuleSet</code> loader.
+ *
+ * Note you can override the default entity resolver by setting the System property of:
+ *  <code>org.drools.io.EntityResolve</code> to your own custom entity resolver.
+ *  This can be done using -Dorg.drools.io.EntityResolver=YourClassHere on the command line, for instance.
+ *
+ * @author <a href="mailto:bob at werken.com">bob mcwhirter </a>
+ */
+public class ExtensibleXmlParser extends DefaultHandler {
+    // ----------------------------------------------------------------------
+    // Constants
+    // ----------------------------------------------------------------------
+    public static final String  ENTITY_RESOLVER_PROPERTY_NAME = "org.drools.io.EntityResolver";
+
+    /** Namespace URI for the general tags. */
+    public static final String  RULES_NAMESPACE_URI           = "http://drools.org/rules";
+
+    private static final String JAXP_SCHEMA_LANGUAGE          = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+
+    private static final String W3C_XML_SCHEMA                = "http://www.w3.org/2001/XMLSchema";
+
+    // ----------------------------------------------------------------------
+    // Instance members
+    // ----------------------------------------------------------------------
+    /** SAX parser. */
+    private SAXParser           parser;
+
+    /** isValidating */
+    private boolean             isValidating                  = true;
+
+    /** Locator for errors. */
+    private Locator             locator;
+
+    // private Map repo;
+
+    /** Stack of configurations. */
+    private LinkedList          configurationStack;
+
+    /** Current configuration text. */
+    private StringBuilder       characters;
+
+    private SemanticModules     modules;
+
+    private boolean             lastWasEndElement;
+
+    private LinkedList          parents;
+
+    private Object              peer;
+
+    private Object              current;
+
+    private Object              data;
+
+    private final MessageFormat message                       = new MessageFormat( "({0}: {1}, {2}): {3}" );
+
+    private final Map           namespaces                    = new HashMap();
+
+    EntityResolver              entityResolver;
+
+    // ----------------------------------------------------------------------
+    // Constructors
+    // ----------------------------------------------------------------------
+
+    /**
+     * Construct.
+     *
+     * <p>
+     * Uses the default JAXP SAX parser and the default classpath-based
+     * <code>DefaultSemanticModule</code>.
+     * </p>
+     */
+    public ExtensibleXmlParser() {
+        // init
+        this.configurationStack = new LinkedList();
+        this.parents = new LinkedList();
+
+        initEntityResolver();
+    }
+
+    public void setSemanticModules(SemanticModules modules) {
+        this.modules = modules;
+    }
+
+    /**
+     * Construct.
+     *
+     * <p>
+     * Uses the default classpath-based <code>DefaultSemanticModule</code>.
+     * </p>
+     *
+     * @param parser
+     *            The SAX parser.
+     */
+    public ExtensibleXmlParser(final SAXParser parser) {
+        this();
+        this.parser = parser;
+    }
+
+    // ----------------------------------------------------------------------
+    // Instance methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Read a <code>RuleSet</code> from a <code>Reader</code>.
+     *
+     * @param reader
+     *            The reader containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public Object read(final Reader reader) throws SAXException,
+                                           IOException {
+        return read( new InputSource( reader ) );
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputStream</code>.
+     *
+     * @param inputStream
+     *            The input-stream containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public Object read(final InputStream inputStream) throws SAXException,
+                                                     IOException {
+        return read( new InputSource( inputStream ) );
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputSource</code>.
+     *
+     * @param in
+     *            The rule-set input-source.
+     *
+     * @return The rule-set.
+     */
+    public Object read(final InputSource in) throws SAXException,
+                                            IOException {
+        SAXParser localParser = null;
+        if ( this.parser == null ) {
+            final SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware( true );
+
+            final String isValidatingString = System.getProperty( "drools.schema.validating" );
+            if ( System.getProperty( "drools.schema.validating" ) != null ) {
+                this.isValidating = Boolean.getBoolean( "drools.schema.validating" );
+            }
+
+            if ( this.isValidating == true ) {
+                factory.setValidating( true );
+                try {
+                    localParser = factory.newSAXParser();
+                } catch ( final ParserConfigurationException e ) {
+                    throw new RuntimeException( e.getMessage() );
+                }
+
+                try {
+                    localParser.setProperty( ExtensibleXmlParser.JAXP_SCHEMA_LANGUAGE,
+                                             ExtensibleXmlParser.W3C_XML_SCHEMA );
+                } catch ( final SAXNotRecognizedException e ) {
+                    boolean hideWarnings = Boolean.getBoolean( "drools.schema.hidewarnings" );
+                    if ( !hideWarnings ) {
+                        System.err.println( "Your SAX parser is not JAXP 1.2 compliant - turning off validation." );
+                    }
+                    localParser = null;
+                }
+            }
+
+            if ( localParser == null ) {
+                // not jaxp1.2 compliant so turn off validation
+                try {
+                    this.isValidating = false;
+                    factory.setValidating( this.isValidating );
+                    localParser = factory.newSAXParser();
+                } catch ( final ParserConfigurationException e ) {
+                    throw new RuntimeException( e.getMessage() );
+                }
+            }
+        } else {
+            localParser = this.parser;
+        }
+
+        if ( !localParser.isNamespaceAware() ) {
+            throw new RuntimeException( "parser must be namespace-aware" );
+        }
+
+        localParser.parse( in,
+                           this );
+
+        return this.data;
+    }
+
+    public void setData(final Object data) {
+        this.data = data;
+    }
+
+    public Object getData() {
+        return this.data;
+    }
+
+    /**
+     * @see org.xml.sax.ContentHandler
+     */
+    public void setDocumentLocator(final Locator locator) {
+        this.locator = locator;
+    }
+
+    /**
+     * Get the <code>Locator</code>.
+     *
+     * @return The locator.
+     */
+    public Locator getLocator() {
+        return this.locator;
+    }
+
+    public void startDocument() {
+        this.isValidating = true;
+        this.current = null;
+        this.peer = null;
+        this.lastWasEndElement = false;
+        this.parents.clear();
+        this.characters = null;
+        this.configurationStack.clear();
+        this.namespaces.clear();
+    }
+
+    private int direction = 0;
+
+    /**
+     * @param uri
+     * @param localName
+     * @param qname
+     * @param attrs
+     * @throws SAXException
+     * @see org.xml.sax.ContentHandler
+     *
+     * @todo: better way to manage unhandled elements
+     */
+    public void startElement(final String uri,
+                             final String localName,
+                             final String qname,
+                             final Attributes attrs) throws SAXException {
+        if ( direction == 1 ) {
+            // going down again, so clear 
+            this.peer = null;
+        } else {
+            direction = 1;
+        }
+
+        final Handler handler = getHandler( uri,
+                                            localName );
+
+        if ( handler == null ) {
+            startConfiguration( localName,
+                                attrs );
+            return;
+        }
+
+        validate( uri,
+                  localName,
+                  handler );
+
+        final Object node = handler.start( uri,
+                                           localName,
+                                           attrs,
+                                           this );
+
+        if ( node == null ) {
+            this.parents.add( Null.instance );
+        } else {
+            this.parents.add( node );
+        }
+    }
+
+    /**
+     * @param uri
+     * @param localName
+     * @param qname
+     * @throws SAXException
+     * @see org.xml.sax.ContentHandler
+     */
+
+    public void endElement(final String uri,
+                           final String localName,
+                           final String qname) throws SAXException {
+        direction = -1;
+        final Handler handler = getHandler( uri,
+                                            localName );
+
+        if ( handler == null ) {
+            if ( this.configurationStack.size() >= 1 ) {
+                endConfiguration();
+            }
+            return;
+        }
+
+        this.current = removeParent();
+
+        this.peer = handler.end( uri,
+                                 localName,
+                                 this );
+    }
+    
+    public static class Null {
+        public static final Null instance = new Null();
+    }
+
+    private void validate(final String uri,
+                          final String localName,
+                          final Handler handler) throws SAXParseException {
+        boolean validParent = false;
+        boolean validPeer = false;
+        boolean invalidNesting = false;
+
+        final Set validParents = handler.getValidParents();
+        final Set validPeers = handler.getValidPeers();
+        boolean allowNesting = handler.allowNesting();
+
+        // get parent
+        Object parent;
+        if ( this.parents.size() != 0 ) {
+            parent = this.parents.getLast();
+        } else {
+            parent = null;
+        }
+
+        // check valid parents
+        // null parent means localname is rule-set
+        // dont process if elements are the same
+        // instead check for allowed nesting
+        final Class nodeClass = getHandler( uri,
+                                            localName ).generateNodeFor();
+        if ( nodeClass != null && !nodeClass.isInstance( parent ) ) {
+            Object allowedParent;
+            final Iterator it = validParents.iterator();
+            while ( !validParent && it.hasNext() ) {
+                allowedParent = it.next();
+                if ( parent == null && allowedParent == null ) {
+                    validParent = true;
+                } else if ( allowedParent != null && ((Class) allowedParent).isInstance( parent ) ) {
+                    validParent = true;
+                }
+            }
+            if ( !validParent ) {
+                throw new SAXParseException( "<" + localName + "> has an invalid parent element [" + parent + "]",
+                                             getLocator() );
+            }
+        }
+
+        // check valid peers
+        // null peer means localname is rule-set
+        final Object peer = this.peer;
+
+        Object allowedPeer;
+        Iterator it = validPeers.iterator();
+        while ( !validPeer && it.hasNext() ) {
+            allowedPeer = it.next();
+            if ( peer == null && allowedPeer == null ) {
+                validPeer = true;
+            } else if ( allowedPeer != null && ((Class) allowedPeer).isInstance( peer ) ) {
+                validPeer = true;
+            }
+        }
+        if ( !validPeer ) {
+            throw new SAXParseException( "<" + localName + "> is after an invalid element: " + Handler.class.getName(),
+                                         getLocator() );
+        }
+
+        if ( nodeClass != null && !allowNesting ) {
+            it = this.parents.iterator();
+            while ( !invalidNesting && it.hasNext() ) {
+                if ( nodeClass.isInstance( it.next() ) ) {
+                    invalidNesting = true;
+                }
+            }
+        }
+        if ( invalidNesting ) {
+            throw new SAXParseException( "<" + localName + ">  may not be nested",
+                                         getLocator() );
+        }
+
+    }
+
+    /**
+     * Start a configuration node.
+     *
+     * @param name
+     *            Tag name.
+     * @param attrs
+     *            Tag attributes.
+     */
+    public void startConfiguration(final String name,
+                                   final Attributes attrs) {
+        this.characters = new StringBuilder();
+
+        final DefaultConfiguration config = new DefaultConfiguration( name );
+
+        final int numAttrs = attrs.getLength();
+
+        for ( int i = 0; i < numAttrs; ++i ) {
+            config.setAttribute( attrs.getLocalName( i ),
+                                 attrs.getValue( i ) );
+        }
+
+        // lets add the namespaces as attributes
+        for ( final Iterator iter = this.namespaces.entrySet().iterator(); iter.hasNext(); ) {
+            final Map.Entry entry = (Map.Entry) iter.next();
+            String ns = (String) entry.getKey();
+            final String value = (String) entry.getValue();
+            if ( ns == null || ns.length() == 0 ) {
+                ns = "xmlns";
+            } else {
+                ns = "xmlns:" + ns;
+            }
+            config.setAttribute( ns,
+                                 value );
+        }
+
+        if ( this.configurationStack.isEmpty() ) {
+            this.configurationStack.addLast( config );
+        } else {
+            ((DefaultConfiguration) this.configurationStack.getLast()).addChild( config );
+            this.configurationStack.addLast( config );
+        }
+    }
+
+    Handler getHandler(final String uri,
+                       final String localName) {
+        SemanticModule module = this.modules.getSemanticModule( uri );
+        if ( module != null ) {
+            return module.getHandler( localName );
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @param chars
+     * @param start
+     * @param len
+     * @see org.xml.sax.ContentHandler
+     */
+    public void characters(final char[] chars,
+                           final int start,
+                           final int len) {
+        if ( this.characters != null ) {
+            this.characters.append( chars,
+                                    start,
+                                    len );
+        }
+    }
+
+    /**
+     * End a configuration node.
+     *
+     * @return The configuration.
+     */
+    public Configuration endConfiguration() {
+        final DefaultConfiguration config = (DefaultConfiguration) this.configurationStack.removeLast();
+        if ( this.characters != null ) {
+            config.setText( this.characters.toString() );
+        }
+
+        this.characters = null;
+
+        return config;
+    }
+
+    public Object getParent() {
+        return this.parents.getLast();
+    }
+
+    public Object getParent(int index) {
+        ListIterator it = this.parents.listIterator( this.parents.size() );
+        int x = 0;
+        Object parent = null;
+        while ( x++ <= index ) {
+            parent = it.previous();
+        }
+        return parent;
+    }
+
+    public Object removeParent() {
+        Object parent = this.parents.removeLast();
+        while ( parent == null && !this.parents.isEmpty() ) {
+            parent = this.parents.removeLast();
+        }
+        return parent;
+    }
+
+    public LinkedList getParents() {
+        return this.parents;
+    }
+
+    public Object getParent(final Class parent) {
+        final ListIterator it = this.parents.listIterator( this.parents.size() );
+        Object node = null;
+        while ( it.hasPrevious() ) {
+            node = it.previous();
+            if ( parent.isInstance( node ) ) {
+                break;
+            }
+        }
+        return node;
+    }
+
+    public Object getPeer() {
+        return this.peer;
+    }
+
+    public Object getCurrent() {
+        return this.current;
+    }
+
+    public InputSource resolveEntity(final String publicId,
+                                     final String systemId) throws SAXException {
+        try {
+            final InputSource inputSource = resolveSchema( publicId,
+                                                           systemId );
+            if ( inputSource != null ) {
+                return inputSource;
+            }
+            if ( this.entityResolver != null ) {
+                return this.entityResolver.resolveEntity( publicId,
+                                                          systemId );
+            }
+        } catch ( final IOException ioe ) {
+        }
+        return null;
+    }
+
+    public void startPrefixMapping(final String prefix,
+                                   final String uri) throws SAXException {
+        super.startPrefixMapping( prefix,
+                                  uri );
+        this.namespaces.put( prefix,
+                             uri );
+    }
+
+    public void endPrefixMapping(final String prefix) throws SAXException {
+        super.endPrefixMapping( prefix );
+        this.namespaces.remove( prefix );
+    }
+
+    private void print(final SAXParseException x) {
+        final String msg = this.message.format( new Object[]{x.getSystemId(), new Integer( x.getLineNumber() ), new Integer( x.getColumnNumber() ), x.getMessage()} );
+        System.out.println( msg );
+    }
+
+    public void warning(final SAXParseException x) {
+        print( x );
+    }
+
+    public void error(final SAXParseException x) {
+        print( x );
+    }
+
+    public void fatalError(final SAXParseException x) throws SAXParseException {
+        print( x );
+        throw x;
+    }
+
+    private InputSource resolveSchema(final String publicId,
+                                      final String systemId) throws SAXException,
+                                                            IOException {
+        // Schema files must end with xsd
+        if ( !systemId.toLowerCase().endsWith( "xsd" ) ) {
+            return null;
+        }
+
+        // try the actual location given by systemId
+        try {
+            final URL url = new URL( systemId );
+            return new InputSource( url.openStream() );
+        } catch ( final Exception e ) {
+        }
+
+        // Try and get the index for the filename, else return null
+        String xsd;
+        int index = systemId.lastIndexOf( "/" );
+        if ( index == -1 ) {
+            index = systemId.lastIndexOf( "\\" );
+        }
+        if ( index != -1 ) {
+            xsd = systemId.substring( index + 1 );
+        } else {
+            xsd = systemId;
+        }
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+        if ( cl == null ) {
+            cl = ExtensibleXmlParser.class.getClassLoader();
+        }
+
+        // Try looking in META-INF
+        {
+            final InputStream is = cl.getResourceAsStream( "META-INF/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        // Try looking in /META-INF
+        {
+            final InputStream is = cl.getResourceAsStream( "/META-INF/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        // Try looking at root of classpath
+        {
+            final InputStream is = cl.getResourceAsStream( "/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        // Try current working directory
+        {
+            final File file = new File( xsd );
+            if ( file.exists() ) {
+                return new InputSource( new BufferedInputStream( new FileInputStream( file ) ) );
+            }
+        }
+
+        cl = ClassLoader.getSystemClassLoader();
+
+        // Try looking in META-INF
+        {
+            final InputStream is = cl.getResourceAsStream( "META-INF/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        // Try looking in /META-INF
+        {
+            final InputStream is = cl.getResourceAsStream( "/META-INF/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        // Try looking at root of classpath
+        {
+            final InputStream is = cl.getResourceAsStream( "/" + xsd );
+            if ( is != null ) {
+                return new InputSource( is );
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Intializes EntityResolver that is configured via system property ENTITY_RESOLVER_PROPERTY_NAME.
+     */
+    private void initEntityResolver() {
+        final String entityResolveClazzName = System.getProperty( ExtensibleXmlParser.ENTITY_RESOLVER_PROPERTY_NAME );
+        if ( entityResolveClazzName != null && entityResolveClazzName.length() > 0 ) {
+            try {
+                final Class entityResolverClazz = Thread.currentThread().getContextClassLoader().loadClass( entityResolveClazzName );
+                this.entityResolver = (EntityResolver) entityResolverClazz.newInstance();
+            } catch ( final Exception ignoreIt ) {
+            }
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Handler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Handler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/Handler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,46 @@
+package org.drools.xml;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Set;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author mproctor
+ * 
+ */
+public interface Handler {
+
+    Object start(String uri,
+                 String localName,
+                 Attributes attrs,
+                 ExtensibleXmlParser xmlPackageReader) throws SAXException;
+
+    Object end(String uri,
+               String localName,
+               ExtensibleXmlParser xmlPackageReader) throws SAXException;
+
+    Set getValidParents();
+
+    Set getValidPeers();
+
+    boolean allowNesting();
+
+    Class generateNodeFor();
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessBuildData.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessBuildData.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessBuildData.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+/**
+ * 
+ */
+package org.drools.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.Node;
+
+public class ProcessBuildData {
+    private Process process;
+    private Map<String, Node> nodes = new HashMap<String, Node>();               
+    
+    public Process getProcess() {
+        return process;
+    }
+    
+    public void setProcess(Process process) {
+        this.process = process;
+    }
+    
+    public Map<String, Node> getNodes() {
+        return nodes;
+    }
+    public boolean addNode(Node node) {
+        return( this.nodes.put( node.getName(),
+                               node ) != null );
+    }               
+    
+    public Node getNode(String name) {
+        return this.nodes.get( name );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessSemanticModule.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessSemanticModule.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/ProcessSemanticModule.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools.xml;
+
+import org.drools.xml.processes.ActionNodeHandler;
+import org.drools.xml.processes.ConnectionHandler;
+import org.drools.xml.processes.EndNodeHandler;
+import org.drools.xml.processes.GlobalHandler;
+import org.drools.xml.processes.ImportHandler;
+import org.drools.xml.processes.ProcessHandler;
+import org.drools.xml.processes.StartNodeHandler;
+
+public class ProcessSemanticModule extends DefaultSemanticModule implements SemanticModule {    
+    public ProcessSemanticModule() {
+        super ( "http://drools.org/drools-4.0/process" );
+
+        addHandler( "process",
+                           new ProcessHandler() );
+        addHandler( "start",
+                           new StartNodeHandler() );
+        addHandler( "end",
+                           new EndNodeHandler() );
+        addHandler( "action",
+                           new ActionNodeHandler() );
+        addHandler( "connection",
+                           new ConnectionHandler() );
+        addHandler( "import",
+                           new ImportHandler() );
+        addHandler( "global",
+                           new GlobalHandler() );        
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/RulesSemanticModule.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/RulesSemanticModule.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/RulesSemanticModule.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,120 @@
+package org.drools.xml;
+
+import org.drools.xml.rules.AccumulateHandler;
+import org.drools.xml.rules.AccumulateHelperHandler;
+import org.drools.xml.rules.AndHandler;
+import org.drools.xml.rules.CollectHandler;
+import org.drools.xml.rules.EvalHandler;
+import org.drools.xml.rules.ExistsHandler;
+import org.drools.xml.rules.ExpressionHandler;
+import org.drools.xml.rules.FieldBindingHandler;
+import org.drools.xml.rules.FieldConstraintHandler;
+import org.drools.xml.rules.ForallHandler;
+import org.drools.xml.rules.FromHandler;
+import org.drools.xml.rules.FunctionHandler;
+import org.drools.xml.rules.LiteralRestrictionHandler;
+import org.drools.xml.rules.NotHandler;
+import org.drools.xml.rules.OrHandler;
+import org.drools.xml.rules.PackageHandler;
+import org.drools.xml.rules.PatternHandler;
+import org.drools.xml.rules.PredicateHandler;
+import org.drools.xml.rules.QualifiedIdentifierRestrictionHandler;
+import org.drools.xml.rules.QueryHandler;
+import org.drools.xml.rules.RestrictionConnectiveHandler;
+import org.drools.xml.rules.ReturnValueRestrictionHandler;
+import org.drools.xml.rules.RuleHandler;
+import org.drools.xml.rules.VariableRestrictionsHandler;
+
+public class RulesSemanticModule extends DefaultSemanticModule
+    implements
+    SemanticModule {
+    public RulesSemanticModule() {
+        super( "http://drools.org/drools-4.0" );
+
+        addHandler( "package",
+                    new PackageHandler() );
+        addHandler( "rule",
+                    new RuleHandler() );
+        addHandler( "query",
+                    new QueryHandler() );
+        addHandler( "attribute",
+                    null );
+        addHandler( "function",
+                    new FunctionHandler() );
+
+        // Conditional Elements
+        addHandler( "lhs",
+                    new AndHandler() );
+
+        addHandler( "and-restriction-connective",
+                    new RestrictionConnectiveHandler() );
+
+        addHandler( "or-restriction-connective",
+                    new RestrictionConnectiveHandler() );
+
+        addHandler( "and-conditional-element",
+                    new AndHandler() );
+
+        addHandler( "or-conditional-element",
+                    new OrHandler() );
+
+        addHandler( "and-constraint-connective",
+                    new AndHandler() );
+        addHandler( "or-constraint-connective",
+                    new OrHandler() );
+
+        addHandler( "not",
+                    new NotHandler() );
+        addHandler( "exists",
+                    new ExistsHandler() );
+        addHandler( "eval",
+                    new EvalHandler() );
+        addHandler( "pattern",
+                    new PatternHandler() );
+
+        addHandler( "from",
+                    new FromHandler() );
+        addHandler( "forall",
+                    new ForallHandler() );
+        addHandler( "collect",
+                    new CollectHandler() );
+        addHandler( "accumulate",
+                    new AccumulateHandler() );
+
+        // Field Constraints
+        addHandler( "field-constraint",
+                    new FieldConstraintHandler() );
+        addHandler( "literal-restriction",
+                    new LiteralRestrictionHandler() );
+        addHandler( "variable-restriction",
+                    new VariableRestrictionsHandler() );
+        addHandler( "predicate",
+                    new PredicateHandler() );
+
+        addHandler( "return-value-restriction",
+                    new ReturnValueRestrictionHandler() );
+        addHandler( "qualified-identifier-restriction",
+                    new QualifiedIdentifierRestrictionHandler() );
+
+        addHandler( "field-binding",
+                    new FieldBindingHandler() );
+
+        addHandler( "field-binding",
+                    new FieldBindingHandler() );
+
+        addHandler( "init",
+                    new AccumulateHelperHandler() );
+        addHandler( "action",
+                    new AccumulateHelperHandler() );
+        addHandler( "result",
+                    new AccumulateHelperHandler() );
+        addHandler( "reverse",
+                    new AccumulateHelperHandler() );
+
+        addHandler( "external-function",
+                    new AccumulateHelperHandler() );
+
+        addHandler( "expression",
+                    new ExpressionHandler() );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModule.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModule.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModule.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.xml;
+
+public interface SemanticModule {
+    public String getUri();
+    
+    public void addHandler(String name, Handler handler);
+
+    public Handler getHandler(String name);
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModules.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModules.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/SemanticModules.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+
+package org.drools.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SemanticModules {
+    public Map<String, SemanticModule> modules;
+
+    public SemanticModules() {
+        this.modules = new HashMap<String, SemanticModule>();
+    }
+
+    public void addSemanticModule(SemanticModule module) {
+        this.modules.put( module.getUri(),
+                          module );
+    }
+
+    public SemanticModule getSemanticModule(String uri) {
+        return this.modules.get( uri );
+    }
+    
+    public String toString() {
+        return this.modules.toString();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlDumper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlDumper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlDumper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,419 @@
+package org.drools.xml;
+
+/*
+ * 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PackageDescrDumper;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.util.ReflectiveVisitor;
+import org.drools.xml.rules.RestrictionConnectiveHandler;
+
+
+/**
+ * This utility will take a AST of a rule package, and emit XML.
+ * This can be used in porting from DRL to XML.
+ * @author <a href="mailto:jayaramcs at gmail.com">Author Jayaram C S</a>
+ */
+public class XmlDumper extends ReflectiveVisitor
+    implements
+    PackageDescrDumper {
+
+    private StringBuffer        xmlDump;
+    private boolean             patternContext;
+    private final static String eol = System.getProperty( "line.separator" );
+    private String              template;
+
+    public synchronized String dump(final PackageDescr packageDescr) {
+        this.xmlDump = new StringBuffer();
+        visitPackageDescr( packageDescr );
+        return this.xmlDump.toString();
+    }
+
+    public void visitAndDescr(final AndDescr descr) {
+        this.template = new String();
+        if ( descr.getDescrs() != Collections.EMPTY_LIST ) {
+            if ( !this.patternContext ) this.template = "<and-conditional-element>" + processDescrList( descr.getDescrs() ) + "</and-conditional-element>";
+            else this.template = "<and-constraint-connective>" + processDescrList( descr.getDescrs() ) + "</and-constraint-connective>";
+        }
+    }
+
+    public void visitAttributeDescr(final AttributeDescr attributeDescr) {
+        this.template = new String();
+        this.template = "<rule-attribute name=\"" + attributeDescr.getName() + "\" value=\"" + attributeDescr.getValue() + "\" />" + XmlDumper.eol;
+    }
+
+    public void visitVariableRestrictionDescr(final VariableRestrictionDescr descr) {
+        this.template = new String();
+        this.template = "<variable-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\" identifier=\"" + descr.getIdentifier() + "\" />" + XmlDumper.eol;
+    }
+
+    public void visitPatternDescr(final PatternDescr descr) {
+        this.patternContext = true;
+        this.template = new String();
+        StringBuffer localString = new StringBuffer();
+
+        if ( descr.getDescrs() != Collections.EMPTY_LIST ) {
+            if ( descr.getIdentifier() != null ) {
+                localString.append( "<pattern identifier=\"" + descr.getIdentifier() + "\" object-type=\"" + descr.getObjectType() + "\" >" + XmlDumper.eol + processDescrList( descr.getDescrs() ) + XmlDumper.eol );
+            } else {
+                localString.append( "<pattern object-type=\"" + descr.getObjectType() + "\" >" + XmlDumper.eol + processDescrList( descr.getDescrs() ) + XmlDumper.eol );
+            }
+        } else {
+            if ( descr.getIdentifier() != null ) {
+                localString.append( "<pattern identifier=\"" + descr.getIdentifier() + "\" object-type=\"" + descr.getObjectType() + "\" >" + XmlDumper.eol );;
+            } else {
+                localString.append( "<pattern object-type=\"" + descr.getObjectType() + "\" >" + XmlDumper.eol );
+            }
+        }
+
+        if ( descr.getSource() != null ) {
+            visit( descr.getSource() );
+            localString.append( this.template );
+        }
+        localString.append( "</pattern>" + XmlDumper.eol );
+
+        this.template = localString.toString();
+
+        this.patternContext = false;
+    }
+
+    public void visitFieldConstraintDescr(final FieldConstraintDescr descr) {
+        if ( !descr.getRestrictions().isEmpty() ) {
+            this.template = "<field-constraint field-name=\"" + descr.getFieldName() + "\"> " + XmlDumper.eol + processFieldConstraint( descr.getRestrictions() ) + XmlDumper.eol + "</field-constraint>";
+        }
+    }
+
+    public void visitCollectDescr(final CollectDescr descr) {
+        StringBuffer tmpstr = new StringBuffer();
+        tmpstr.append( "<from> <collect>" );
+        visit( descr.getInputPattern() );
+        tmpstr.append( this.template );
+        tmpstr.append( " </collect> </from> " );
+        this.template = tmpstr.toString();
+    }
+
+    public void visitAccumulateDescr(final AccumulateDescr descr) {
+        String tmpstr = new String();
+        tmpstr += this.template + " <from> <accumulate> ";
+
+        if ( descr.isSinglePattern() ) {
+            visitPatternDescr( descr.getInputPattern() );
+        } else {
+            this.patternContext = false;
+            visit( descr.getInput() );
+        }
+        tmpstr += this.template;
+
+        if ( descr.isExternalFunction() ) tmpstr += "<external-function evaluator=\"" + descr.getFunctionIdentifier() + "\" expression=\"" + descr.getExpression() + "\"/>";
+        else tmpstr += "<init>" + descr.getInitCode() + "</init><action>" + descr.getActionCode() + "</action><result>" + descr.getResultCode() + "</result>";
+
+        this.template = tmpstr + " </accumulate> </from> ";
+    }
+
+    public void visitFromDescr(final FromDescr descr) {
+        String tmpstr = new String();
+        tmpstr += this.template + " <from> <expression> ";
+        tmpstr += descr.getDataSource();
+        this.template = tmpstr + " </expression> </from> ";
+    }
+
+    public void visitForallDescr(final ForallDescr descr) {
+        this.template = "<forall>" + processDescrList( descr.getDescrs() ) + "</forall>";
+    }
+
+    public void visitEvalDescr(final EvalDescr descr) {
+        this.template = new String();
+        this.template = "<eval>" + replaceIllegalChars( (String) descr.getContent() ) + "</eval>" + XmlDumper.eol;
+    }
+
+    public void visitExistsDescr(final ExistsDescr descr) {
+        this.template = new String();
+        if ( descr.getDescrs() != Collections.EMPTY_LIST ) {
+            this.template = "<exists>" + processDescrList( descr.getDescrs() ) + "</exists>";
+        } else {
+            this.template = "<exists> </exists>";
+        }
+    }
+
+    public void visitFieldBindingDescr(final FieldBindingDescr descr) {
+        this.template = new String();
+        this.template = "<field-binding field-name=\"" + descr.getFieldName() + "\" identifier=\"" + descr.getIdentifier() + "\" />" + XmlDumper.eol;
+    }
+
+    public void visitFunctionDescr(final FunctionDescr functionDescr) {
+        this.template = new String();
+        final String parameterTemplate = processParameters( functionDescr.getParameterNames(),
+                                                            functionDescr.getParameterTypes() );
+
+        this.template = "<function return-type=\"" + functionDescr.getReturnType() + "\" name=\"" + functionDescr.getName() + "\">" + XmlDumper.eol + parameterTemplate + "<body>" + XmlDumper.eol + replaceIllegalChars( functionDescr.getText() )
+                        + XmlDumper.eol + "</body>" + XmlDumper.eol + "</function>" + XmlDumper.eol;
+    }
+
+    public void visitLiteralRestrictionDescr(final LiteralRestrictionDescr descr) {
+        this.template = new String();
+        this.template = "<literal-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\" value=\"" + replaceIllegalChars( descr.getText() ) + "\" />" + XmlDumper.eol;
+    }
+
+    public void visitQualifiedIdentifierRestrictionDescr(final QualifiedIdentifierRestrictionDescr descr) {
+        this.template = new String();
+        this.template = "<qualified-identifier-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\">" + replaceIllegalChars( descr.getText() ) + " </qualified-identifier-restriction>" + XmlDumper.eol;
+    }
+
+    public void visitNotDescr(final NotDescr descr) {
+        this.template = new String();
+        if ( descr.getDescrs() != Collections.EMPTY_LIST ) {
+            this.template = "<not>" + processDescrList( descr.getDescrs() ) + "</not>";
+        } else {
+            this.template = "<not> </not>";
+        }
+
+    }
+
+    public void visitOrDescr(final OrDescr descr) {
+        this.template = new String();
+        if ( descr.getDescrs() != Collections.EMPTY_LIST ) {
+            if ( !this.patternContext ) this.template = "<or-conditional-element>" + processDescrList( descr.getDescrs() ) + "</or-conditional-element>";
+            else this.template = "<or-constraint-connective>" + processDescrList( descr.getDescrs() ) + "</or-constraint-connective>";
+        }
+    }
+
+    public void visitPackageDescr(final PackageDescr packageDescr) {
+        final String packageName = packageDescr.getName();
+        final String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + XmlDumper.eol + " <package name=\"" + packageName + "\"  " + XmlDumper.eol + "\txmlns=\"http://drools.org/drools-4.0\" " + XmlDumper.eol
+                                 + "\txmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" " + XmlDumper.eol + "\txs:schemaLocation=\"http://drools.org/drools-4.0 drools-4.0.xsd\"> " + XmlDumper.eol;
+        appendXmlDump( xmlString );
+        appendXmlDump( processImportsList( packageDescr.getImports() ) );
+        appendXmlDump( processGlobalsList( packageDescr.getGlobals() ) );
+        appendXmlDump( processFunctionImportsList( packageDescr.getFunctionImports() ));
+        appendXmlDump( processFunctionsList( packageDescr.getFunctions() ) );
+        appendXmlDump( processRules( packageDescr.getRules() ) );
+        appendXmlDump( "</package>" );
+    }
+
+    public void visitPredicateDescr(final PredicateDescr descr) {
+        this.template = new String();
+        this.template = "<predicate>" + replaceIllegalChars( (String) descr.getContent() ) + "</predicate>" + XmlDumper.eol;
+    }
+
+    public void visitReturnValueRestrictionDescr(final ReturnValueRestrictionDescr descr) {
+        this.template = new String();
+        this.template = "<return-value-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\" >" + replaceIllegalChars( (String) descr.getContent() ) + "</return-value-restriction>" + XmlDumper.eol;
+    }
+
+    public void visitQueryDescr(final QueryDescr descr) {
+        this.template = new String();
+        this.template = "<query name=\"" + descr.getName() + "\">" + "<lhs>" + processDescrList( descr.getLhs().getDescrs() ) + "</lhs>" + "</query>";
+    }
+
+    private String processRules(final List rules) {
+        String ruleList = "";
+        for ( final Iterator iterator = rules.iterator(); iterator.hasNext(); ) {
+            final RuleDescr ruleDescr = (RuleDescr) iterator.next();
+            String rule = "<rule name=\"" + ruleDescr.getName() + "\">" + XmlDumper.eol;
+            final String attribute = processAttribute( ruleDescr.getAttributes() );
+            String lhs = "";
+            if ( ruleDescr.getLhs().getDescrs() != Collections.EMPTY_LIST ) {
+                lhs = "<lhs>" + processDescrList( ruleDescr.getLhs().getDescrs() ) + "</lhs>";
+            } else {
+
+                lhs = "<lhs> </lhs>";
+            }
+
+            final String rhs = "<rhs>" + replaceIllegalChars( (String) ruleDescr.getConsequence() ) + "</rhs>" + XmlDumper.eol;
+            rule += attribute;
+            rule += lhs;
+            rule += rhs;
+            rule += "</rule>";
+            ruleList += rule;
+        }
+
+        return ruleList + XmlDumper.eol;
+    }
+
+    private String processFieldConstraint(final List list) {
+        String descrString = "";
+        for ( final Iterator it = list.iterator(); it.hasNext(); ) {
+            final Object temp = it.next();
+            visit( temp );
+            descrString += this.template;
+        }
+        return descrString;
+    }
+
+    public void visitRestrictionConnectiveDescr(final RestrictionConnectiveDescr descr) {
+        this.template = new String();
+        final List restrictions = descr.getRestrictions();
+        final String xmlTag = descr.getConnective() == RestrictionConnectiveDescr.OR ? RestrictionConnectiveHandler.OR : RestrictionConnectiveHandler.AND;
+
+        if ( restrictions != Collections.EMPTY_LIST ) {
+            this.template = "<" + xmlTag + ">";
+            this.template += processDescrList( restrictions );
+            this.template += "</" + xmlTag + ">";
+        }
+    }
+
+    private String processDescrList(final List descr) {
+        String descrString = "";
+        for ( final Iterator iterator = descr.iterator(); iterator.hasNext(); ) {
+            visit( iterator.next() );
+            descrString += this.template;
+            descrString += XmlDumper.eol;
+        }
+        return descrString + XmlDumper.eol;
+    }
+
+    private String processFunctionsList(final List functions) {
+        String functionList = "";
+
+        for ( final Iterator iterator = functions.iterator(); iterator.hasNext(); ) {
+            visit( iterator.next() );
+            functionList += this.template;
+        }
+
+        return functionList + XmlDumper.eol;
+    }
+
+    private String processAttribute(final List attributes) {
+
+        String attributeList = "";
+        for ( final Iterator iterator = attributes.iterator(); iterator.hasNext(); ) {
+            final AttributeDescr attributeDescr = (AttributeDescr) iterator.next();
+            visit( attributeDescr );
+            attributeList += this.template;
+        }
+        return attributeList + XmlDumper.eol;
+    }
+
+    private String processParameters(final List parameterNames,
+                                     final List parameterTypes) {
+        String paramList = "";
+        int i = 0;
+        for ( final Iterator iterator = parameterNames.iterator(); iterator.hasNext(); i++ ) {
+            final String paramName = (String) iterator.next();
+            final String paramType = (String) parameterTypes.get( i );
+            final String paramTemplate = "<parameter identifier=\"" + paramName + "\" type=\"" + paramType + "\" />" + XmlDumper.eol;
+            paramList += paramTemplate;
+        }
+
+        return paramList + XmlDumper.eol;
+    }
+
+    private String processFunctionImportsList(final List imports) {
+        String importList = "";
+
+        for ( final Iterator it = imports.iterator(); it.hasNext(); ) {
+            final String importString = ((FunctionImportDescr) it.next()).getTarget();
+            final String importTemplate = "<importfunction name=\"" + importString + "\"/>" + XmlDumper.eol;
+            importList += importTemplate;
+        }
+        return importList + XmlDumper.eol;
+    }
+
+    private String processGlobalsList(final List globals) {
+        String globalList = "";
+        for ( final Iterator iterator = globals.iterator(); iterator.hasNext(); ) {
+            final GlobalDescr global = (GlobalDescr) iterator.next();
+            final String identifier = global.getIdentifier();
+            final String type = global.getType();
+            final String globalTemplate = "<global identifier=\"" + identifier + "\" type=\"" + type + "\" />" + XmlDumper.eol;
+            globalList += globalTemplate;
+        }
+
+        return globalList + XmlDumper.eol;
+    }
+
+    private String processImportsList(final List imports) {
+        String importList = "";
+
+        for ( final Iterator iterator = imports.iterator(); iterator.hasNext(); ) {
+            final String importString = ((ImportDescr) iterator.next()).getTarget();
+            final String importTemplate = "<import name=\"" + importString + "\" /> " + XmlDumper.eol;
+            importList += importTemplate;
+        }
+        return importList + XmlDumper.eol;
+    }
+
+    private void appendXmlDump(final String temp) {
+        this.xmlDump.append( temp );
+    }
+
+    /**
+     * Replace illegal xml characters with their escaped equivalent
+     * <P>The escaped characters are :
+     * <ul>
+     * <li> <
+     * <li> >
+     * <li> &
+     * </ul>
+     * </p>
+     * @author <a href="mailto:prietor at gmail.com">Author Javier Prieto</a>
+     */
+    private String replaceIllegalChars(final String code) {
+        final StringBuffer sb = new StringBuffer();
+        if ( code != null ) {
+            final int n = code.length();
+            for ( int i = 0; i < n; i++ ) {
+                final char c = code.charAt( i );
+                switch ( c ) {
+                    case '<' :
+                        sb.append( "&lt;" );
+                        break;
+                    case '>' :
+                        sb.append( "&gt;" );
+                        break;
+                    case '&' :
+                        sb.append( "&amp;" );
+                        break;
+                    default :
+                        sb.append( c );
+                        break;
+                }
+            }
+        } else {
+            sb.append( "null" );
+        }
+        return sb.toString();
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlPackageReader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlPackageReader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlPackageReader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,111 @@
+package org.drools.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.SAXParser;
+
+import org.drools.lang.descr.PackageDescr;
+import org.drools.xml.rules.AccumulateHandler;
+import org.drools.xml.rules.AccumulateHelperHandler;
+import org.drools.xml.rules.AndHandler;
+import org.drools.xml.rules.CollectHandler;
+import org.drools.xml.rules.EvalHandler;
+import org.drools.xml.rules.ExistsHandler;
+import org.drools.xml.rules.ExpressionHandler;
+import org.drools.xml.rules.FieldBindingHandler;
+import org.drools.xml.rules.FieldConstraintHandler;
+import org.drools.xml.rules.ForallHandler;
+import org.drools.xml.rules.FromHandler;
+import org.drools.xml.rules.FunctionHandler;
+import org.drools.xml.rules.LiteralRestrictionHandler;
+import org.drools.xml.rules.NotHandler;
+import org.drools.xml.rules.OrHandler;
+import org.drools.xml.rules.PackageHandler;
+import org.drools.xml.rules.PatternHandler;
+import org.drools.xml.rules.PredicateHandler;
+import org.drools.xml.rules.QualifiedIdentifierRestrictionHandler;
+import org.drools.xml.rules.QueryHandler;
+import org.drools.xml.rules.RestrictionConnectiveHandler;
+import org.drools.xml.rules.ReturnValueRestrictionHandler;
+import org.drools.xml.rules.RuleHandler;
+import org.drools.xml.rules.VariableRestrictionsHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+public class XmlPackageReader {
+    private ExtensibleXmlParser parser;
+
+    private PackageDescr        packageDescr;
+
+    public XmlPackageReader(final SemanticModules modules) {
+        this( modules, null );
+    }
+
+    public XmlPackageReader(final SemanticModules modules, final SAXParser parser) {
+        if ( parser == null ) {
+            this.parser = new ExtensibleXmlParser();
+        } else {
+            this.parser = new ExtensibleXmlParser( parser );
+        }      
+        this.parser.setSemanticModules( modules );
+    }
+    
+    public ExtensibleXmlParser getParser() {
+        return this.parser;
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from a <code>Reader</code>.
+     *
+     * @param reader
+     *            The reader containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public PackageDescr read(final Reader reader) throws SAXException,
+                                                 IOException {
+        this.packageDescr = (PackageDescr) this.parser.read( reader );
+        return this.packageDescr;
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputStream</code>.
+     *
+     * @param inputStream
+     *            The input-stream containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public PackageDescr read(final InputStream inputStream) throws SAXException,
+                                                           IOException {
+        this.packageDescr = (PackageDescr) this.parser.read( inputStream );
+        return this.packageDescr;
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputSource</code>.
+     *
+     * @param in
+     *            The rule-set input-source.
+     *
+     * @return The rule-set.
+     */
+    public PackageDescr read(final InputSource in) throws SAXException,
+                                                  IOException {
+        this.packageDescr = (PackageDescr) this.parser.read( in );
+        return this.packageDescr;
+    }
+
+    void setPackageDescr(final PackageDescr packageDescr) {
+        this.packageDescr = packageDescr;
+    }
+
+    public PackageDescr getPackageDescr() {
+        return this.packageDescr;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlProcessReader.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlProcessReader.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlProcessReader.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,108 @@
+package org.drools.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Set;
+
+import javax.xml.parsers.SAXParser;
+
+import org.drools.lang.descr.PackageDescr;
+import org.drools.xml.rules.AccumulateHandler;
+import org.drools.xml.rules.AccumulateHelperHandler;
+import org.drools.xml.rules.AndHandler;
+import org.drools.xml.rules.CollectHandler;
+import org.drools.xml.rules.EvalHandler;
+import org.drools.xml.rules.ExistsHandler;
+import org.drools.xml.rules.ExpressionHandler;
+import org.drools.xml.rules.FieldBindingHandler;
+import org.drools.xml.rules.FieldConstraintHandler;
+import org.drools.xml.rules.ForallHandler;
+import org.drools.xml.rules.FromHandler;
+import org.drools.xml.rules.FunctionHandler;
+import org.drools.xml.rules.LiteralRestrictionHandler;
+import org.drools.xml.rules.NotHandler;
+import org.drools.xml.rules.OrHandler;
+import org.drools.xml.rules.PackageHandler;
+import org.drools.xml.rules.PatternHandler;
+import org.drools.xml.rules.PredicateHandler;
+import org.drools.xml.rules.QualifiedIdentifierRestrictionHandler;
+import org.drools.xml.rules.QueryHandler;
+import org.drools.xml.rules.RestrictionConnectiveHandler;
+import org.drools.xml.rules.ReturnValueRestrictionHandler;
+import org.drools.xml.rules.RuleHandler;
+import org.drools.xml.rules.VariableRestrictionsHandler;
+import org.drools.process.core.Process;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+public class XmlProcessReader {
+    private ExtensibleXmlParser parser;
+
+    private Process        process;
+
+    public XmlProcessReader(final SemanticModules modules) {
+        this( modules, null );
+    }
+
+    public XmlProcessReader(final SemanticModules modules, final SAXParser parser) {
+        if ( parser == null ) {
+            this.parser = new ExtensibleXmlParser();
+        } else {
+            this.parser = new ExtensibleXmlParser( parser );
+        }      
+        this.parser.setSemanticModules( modules );
+        this.parser.setData( new ProcessBuildData() );
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from a <code>Reader</code>.
+     *
+     * @param reader
+     *            The reader containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public Process read(final Reader reader) throws SAXException,
+                                                 IOException {
+        this.process = ((ProcessBuildData) this.parser.read( reader )).getProcess();
+        return this.process;
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputStream</code>.
+     *
+     * @param inputStream
+     *            The input-stream containing the rule-set.
+     *
+     * @return The rule-set.
+     */
+    public Process read(final InputStream inputStream) throws SAXException,
+                                                           IOException {
+        this.process = ((ProcessBuildData) this.parser.read( inputStream )).getProcess();
+        return this.process;
+    }
+
+    /**
+     * Read a <code>RuleSet</code> from an <code>InputSource</code>.
+     *
+     * @param in
+     *            The rule-set input-source.
+     *
+     * @return The rule-set.
+     */
+    public Process read(final InputSource in) throws SAXException,
+                                                  IOException {
+        this.process = ((ProcessBuildData)this.parser.read( in )).getProcess();
+        return this.process;
+    }
+
+    void setProcess(final Process process) {
+        this.process = process;
+    }
+
+    public Process getProcess() {
+        return this.process;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,108 @@
+package org.drools.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.EndNode;
+import org.drools.workflow.core.node.StartNode;
+
+public class XmlRuleFlowProcesDumper {
+    
+    // TODO writing out should also be part of the NodeHandler ?
+
+    private final static String EOL = System.getProperty( "line.separator" );
+    
+    private StringBuffer xmlDump;
+    
+    public synchronized String dump(RuleFlowProcess process) {
+        this.xmlDump = new StringBuffer();
+        visitProcess(process);
+        return this.xmlDump.toString();
+    }
+    
+    private void visitProcess(RuleFlowProcess process) {
+        xmlDump.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + EOL
+            + "<process xmlns=\"http://drools.org/drools-4.0/process\"" + EOL
+            + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"" + EOL
+            + "         xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"" + EOL
+            + "         name=\"" + process.getName() + "\" id=\"" + process.getId() + "\" type=\"RuleFlow\" package-name=\"" + process.getPackageName() + "\" >" + EOL + EOL);
+        visitHeader(process);
+        visitNodes(process);
+        visitConnections(process);
+        xmlDump.append("</process>");
+    }
+    
+    private void visitHeader(RuleFlowProcess process) {
+        xmlDump.append("  <header>" + EOL);
+        visitImports(process.getImports());
+        visitGlobals(process.getGlobals());
+        xmlDump.append("  </header>" + EOL + EOL);
+    }
+    
+    private void visitImports(List<String> imports) {
+        xmlDump.append("    <imports>" + EOL);
+        for (String importString: imports) {
+            xmlDump.append("      <import name=\"" + importString + "\" />" + EOL);
+        }
+        xmlDump.append("    </imports>" + EOL);
+    }
+    
+    private void visitGlobals(Map<String, String> globals) {
+        xmlDump.append("    <globals>" + EOL);
+        for (Map.Entry<String, String> global: globals.entrySet()) {
+            xmlDump.append("      <global identifier=\"" + global.getKey() + "\" type=\"" + global.getValue() + "\" />" + EOL);
+        }
+        xmlDump.append("    </globals>" + EOL);
+    }
+    
+    private void visitNodes(RuleFlowProcess process) {
+        xmlDump.append("  <nodes>" + EOL);
+        for (Node node: process.getNodes()) {
+            if (node instanceof StartNode) {
+                visitStartNode((StartNode) node);
+            } else if (node instanceof EndNode) {
+                visitEndNode((EndNode) node);
+            } else if (node instanceof ActionNode) {
+                visitActionNode((ActionNode) node);
+            } else {
+                throw new IllegalArgumentException(
+                    "Unknown node type: " + node);
+            }
+        }
+        xmlDump.append("  </nodes>" + EOL + EOL);
+    }
+    
+    private void visitStartNode(StartNode startNode) {
+        xmlDump.append("    <start name=\"" + startNode.getName() + "\" />" + EOL);
+    }
+    
+    private void visitEndNode(EndNode endNode) {
+        xmlDump.append("    <end name=\"" + endNode.getName() + "\" />" + EOL);
+    }
+    
+    private void visitActionNode(ActionNode actionNode) {
+        DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
+        xmlDump.append("    <action name=\"" + actionNode.getName() 
+            + "\" dialect=\"" + action.getDialect() + "\">"
+            + action.getConsequence() + "</action>" + EOL);
+    }
+    
+    private void visitConnections(RuleFlowProcess process) {
+        List<Connection> connections = new ArrayList<Connection>();
+        for (Node node: process.getNodes()) {
+            connections.addAll(node.getIncomingConnections(Node.CONNECTION_DEFAULT_TYPE));
+        }
+        xmlDump.append("  <connections>" + EOL);
+        for (Connection connection: connections) {
+            xmlDump.append("    <connection from=\"" + connection.getFrom().getName() + "\" to=\"" + connection.getTo().getName() + "\"/>" + EOL);
+        }
+        xmlDump.append("  </connections>" + EOL + EOL);
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ActionNodeHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ActionNodeHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ActionNodeHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,86 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.StartNode;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ActionNodeHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ActionNodeHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();            
+            this.validPeers.add( StartNode.class );
+            this.validPeers.add( ActionNode.class );            
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) parser.getParent();
+        
+        ActionNode actionNode = new ActionNode();
+        
+        final String name = attrs.getValue( "name" );        
+        emptyAttributeCheck( localName, "name", name, parser );        
+        actionNode.setName( name );
+        
+        process.addNode( actionNode );
+        ((ProcessBuildData)parser.getData()).addNode( actionNode );
+        
+        return actionNode;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) parser.getParent();
+
+        ActionNode actionNode = ( ActionNode ) parser.getCurrent();
+        
+        String text = config.getText();
+        if ( text == null ) {
+            throw new SAXParseException( "<action-node> requires content",
+                                         parser.getLocator() );
+        }
+        
+        final String dialect = config.getAttribute( "dialect" );     
+        emptyAttributeCheck( localName, "dialect", dialect, parser );
+        
+        DroolsConsequenceAction actionText = new DroolsConsequenceAction( dialect, text);
+        
+        actionNode.setAction( actionText );
+        
+        return actionNode;
+    }
+
+    public Class generateNodeFor() {
+        return ActionNode.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ConnectionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ConnectionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ConnectionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,77 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ConnectionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ConnectionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( Connection.class );
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );     
+        
+        String fromName = attrs.getValue( "from" );
+        String toName = attrs.getValue( "to" );
+        emptyAttributeCheck( localName, "from", fromName, parser );
+        emptyAttributeCheck( localName, "to", toName, parser );
+        
+        ProcessBuildData buildData = (ProcessBuildData)parser.getData();
+        Node fromNode = buildData.getNode( fromName );
+        Node toNode = buildData.getNode( toName );
+        
+        if ( fromNode == null ) {
+                throw new SAXParseException( "from Node connection name '" + fromName + "' cannot be found",
+                                             parser.getLocator() );
+        }
+        if ( toNode == null ) {
+            throw new SAXParseException( "from Node connection name '" + toName + "' cannot be found",
+                                         parser.getLocator() );
+    }        
+        
+        ConnectionImpl connection = new ConnectionImpl(fromNode, Node.CONNECTION_DEFAULT_TYPE, toNode, Node.CONNECTION_DEFAULT_TYPE);
+        
+        return connection;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        return parser.getCurrent();
+    }
+
+    public Class generateNodeFor() {
+        return Connection.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/EndNodeHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/EndNodeHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/EndNodeHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,69 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.EndNode;
+import org.drools.workflow.core.node.StartNode;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class EndNodeHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public EndNodeHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();
+
+            this.validPeers.add( ActionNode.class );
+            this.validPeers.add( StartNode.class );            
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) parser.getParent();
+        
+        final EndNode endNode = new EndNode();
+        
+        final String name = attrs.getValue( "name" );        
+        emptyAttributeCheck( localName, "name", name, parser );
+        endNode.setName( name );
+        
+        process.addNode( endNode );        
+        ((ProcessBuildData)parser.getData()).addNode( endNode );
+        
+        return endNode;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        return parser.getCurrent();
+    }
+
+    public Class generateNodeFor() {
+        return EndNode.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/GlobalHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/GlobalHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/GlobalHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,70 @@
+package org.drools.xml.processes;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class GlobalHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public GlobalHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();         
+            this.validPeers.add( null );            
+            //this.validPeers.add( ImportDescr.class );            
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) parser.getParent();        
+        
+        final String identifier = attrs.getValue( "identifier" );
+        final String type = attrs.getValue( "type" );
+        
+        emptyAttributeCheck( localName, "identifier", identifier, parser );
+        emptyAttributeCheck( localName, "type", type, parser );
+        
+        Map<String, String> map = process.getGlobals();
+        if ( map == null ) {
+            map = new HashMap<String, String>();
+            process.setGlobals( map );
+        }
+        map.put( identifier, type );
+        
+        return null;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        return null;
+    }
+
+    public Class generateNodeFor() {
+        return null;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ImportHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ImportHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ImportHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,66 @@
+package org.drools.xml.processes;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ImportHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ImportHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();         
+            this.validPeers.add( null );            
+            //this.validPeers.add( ImportDescr.class );            
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) parser.getParent();        
+        
+        final String name = attrs.getValue( "name" );        
+        emptyAttributeCheck( localName, "name", name, parser );       
+        
+        java.util.List<String> list =process.getImports();
+        if ( list == null ) {
+            list = new ArrayList<String>();
+            process.setImports( list );
+        }
+        list.add( name );
+        
+        return null;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        return null;
+    }
+
+    public Class generateNodeFor() {
+        return null;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ProcessHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ProcessHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/ProcessHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ProcessHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ProcessHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( null );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        final String id = attrs.getValue( "id" );
+        final String name = attrs.getValue( "name" );
+        final String version = attrs.getValue( "version" );
+        final String type = attrs.getValue( "type" );
+        final String packageName = attrs.getValue( "package-name" );
+        
+        emptyAttributeCheck( localName, "id", name, parser );
+        emptyAttributeCheck( localName, "name", name, parser );
+        //emptyAttributeCheck( localName, "version", version, parser );
+        emptyAttributeCheck( localName, "package-name", packageName, parser );
+        
+
+        RuleFlowProcess process = new RuleFlowProcess();
+        process.setId( id );
+        process.setName( name );
+        process.setVersion( version );
+        process.setType( type );
+        process.setPackageName( packageName );
+
+        ((ProcessBuildData)parser.getData()).setProcess( process );
+        
+        return process;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();        
+        return parser.getCurrent();
+    }
+
+    public Class generateNodeFor() {
+        return org.drools.process.core.Process.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/StartNodeHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/StartNodeHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/processes/StartNodeHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,66 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.StartNode;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class StartNodeHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public StartNodeHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                   attrs );
+
+        WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
+
+        final StartNode startNode = new StartNode();
+
+        final String name = attrs.getValue( "name" );
+        emptyAttributeCheck( localName,
+                             "name",
+                             name,
+                             parser );
+        startNode.setName( name );
+
+        process.addNode( startNode );
+        ((ProcessBuildData) parser.getData()).addNode( startNode );
+
+        return startNode;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+        return parser.getCurrent();
+    }
+
+    public Class generateNodeFor() {
+        return StartNode.class;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author fernandomeyer
+ */
+public class AccumulateHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public AccumulateHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+
+            this.validParents.add( FromDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final AccumulateDescr accumulateDesrc = new AccumulateDescr();
+        return accumulateDesrc;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+        final AccumulateDescr accumulateDescr = (AccumulateDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent.getClass().getName().equals( FromDescr.class.getName() ) ) {
+            final PatternDescr result = (PatternDescr) parser.getParent( 1 );
+            result.setSource( accumulateDescr );
+
+        } else if ( parent instanceof ConditionalElementDescr ) {
+            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
+            parentDescr.addDescr( accumulateDescr );
+        }
+
+        return accumulateDescr;
+    }
+
+    public Class generateNodeFor() {
+        return AccumulateDescr.class;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHelperHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHelperHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AccumulateHelperHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,105 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author fernandomeyer
+ */
+
+public class AccumulateHelperHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public AccumulateHelperHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AccumulateDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( BaseDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        return new BaseDescr();
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+
+        final String expression = config.getText();
+
+        final Object parent = parser.getParent();
+
+        final AccumulateDescr accumulate = (AccumulateDescr) parent;
+
+        if ( localName.equals( "init" ) ) {
+            emptyContentCheck( localName, expression, parser );
+            accumulate.setInitCode( expression.trim() );
+        } else if ( localName.equals( "action" ) ) {  
+            emptyContentCheck( localName, expression, parser );
+            accumulate.setActionCode( expression.trim() );
+        } else if ( localName.equals( "result" ) ) { 
+            emptyContentCheck( localName, expression, parser );
+            accumulate.setResultCode( expression.trim() );
+        } else if ( localName.equals( "reverse" ) ) {
+            emptyContentCheck( localName, expression, parser );
+            accumulate.setReverseCode( expression.trim() );
+        } else if ( localName.equals( "external-function" ) ) {
+            accumulate.setExternalFunction( true );
+            accumulate.setFunctionIdentifier( config.getAttribute( "evaluator" ) );
+            accumulate.setExpression( config.getAttribute( "expression" ) );
+        }
+
+        return null;
+    }
+
+    public Class generateNodeFor() {
+        return BaseDescr.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AndHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AndHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/AndHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,111 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.MultiPatternDestinationDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class AndHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public AndHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( QueryDescr.class );
+            this.validParents.add( RuleDescr.class );
+            this.validParents.add( OrDescr.class );
+            this.validParents.add( LiteralRestrictionHandler.class );
+            this.validParents.add( AccumulateDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final AndDescr andDescr = new AndDescr();
+
+        return andDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final AndDescr andDescr = (AndDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof RuleDescr || parent instanceof QueryDescr ) {
+            final RuleDescr ruleDescr = (RuleDescr) parent;
+            ruleDescr.setLhs( andDescr );
+        } else if ( parent instanceof MultiPatternDestinationDescr) {
+        	final MultiPatternDestinationDescr mpDescr = (MultiPatternDestinationDescr) parent;
+        	mpDescr.setInput(andDescr);        	
+        } else if ( parent instanceof ConditionalElementDescr ) {
+            final ConditionalElementDescr ceDescr = (ConditionalElementDescr) parent;
+            ceDescr.addDescr( andDescr );
+        }
+
+        return andDescr;
+    }
+
+    public Class generateNodeFor() {
+        return AndDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/CollectHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/CollectHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/CollectHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author fernandomeyer
+ *
+ */
+public class CollectHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public CollectHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+
+            this.validParents.add( FromDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final CollectDescr collectDescr = new CollectDescr();
+        return collectDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+        final CollectDescr collectDescr = (CollectDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent.getClass().getName().equals( FromDescr.class.getName() ) ) {
+            final PatternDescr resultPattern = (PatternDescr) parser.getParent( 1 );
+            resultPattern.setSource( collectDescr );
+        } else if ( parent instanceof ConditionalElementDescr ) {
+            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
+            parentDescr.addDescr( collectDescr );
+        }
+
+        return collectDescr;
+    }
+
+    public Class generateNodeFor() {
+        return CollectDescr.class;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/EvalHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/EvalHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/EvalHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,102 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class EvalHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public EvalHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( OrDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final EvalDescr evalDescr = new EvalDescr();
+
+        return evalDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final EvalDescr evalDescr = (EvalDescr) parser.getCurrent();
+
+        final String expression = config.getText();
+
+        emptyContentCheck( localName, expression, parser );
+
+        evalDescr.setContent( expression );
+
+        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
+        parentDescr.addDescr( evalDescr );
+
+        return evalDescr;
+    }
+
+    public Class generateNodeFor() {
+        return EvalDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExistsHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExistsHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExistsHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,101 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class ExistsHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ExistsHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( OrDescr.class );
+            this.validParents.add( NotDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final ExistsDescr existsDescr = new ExistsDescr();
+
+        return existsDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final ExistsDescr existsDescr = (ExistsDescr) parser.getCurrent();
+
+        if ( (existsDescr.getDescrs().size() != 1) && (existsDescr.getDescrs().get( 0 ).getClass() != PatternDescr.class) ) {
+            throw new SAXParseException( "<exists> can only have a single <pattern...> as a child element",
+                                         parser.getLocator() );
+        }
+
+        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
+        parentDescr.addDescr( existsDescr );
+
+        return existsDescr;
+    }
+
+    public Class generateNodeFor() {
+        return ExistsDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExpressionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExpressionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ExpressionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,106 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.TokenStream;
+import org.drools.lang.DRLLexer;
+import org.drools.lang.DRLParser;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.DeclarativeInvokerDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author fernandomeyer
+ */
+
+public class ExpressionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public ExpressionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FromHandler.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( BaseDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Class generateNodeFor() {
+        return BaseDescr.class;
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        return new BaseDescr();
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+
+        final String expression = config.getText();
+        
+        emptyContentCheck( localName, expression, parser );
+
+        final Object parent = parser.getParent();
+
+        final FromDescr fromSource = (FromDescr) parent;
+        final CharStream charStream = new ANTLRStringStream( expression.trim() );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser drlParser = new DRLParser( tokenStream );
+
+        try {
+            final DeclarativeInvokerDescr declarativeInvoker = drlParser.from_source( fromSource );
+            fromSource.setDataSource( declarativeInvoker );
+        } catch ( final RecognitionException e ) {
+            throw new SAXParseException( "<" + localName + "> must have a valid expression content ",
+                                         parser.getLocator() );
+        }
+
+        return null;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldBindingHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldBindingHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldBindingHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,91 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ */
+public class FieldBindingHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public FieldBindingHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PatternDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FieldConstraintDescr.class );
+            this.validPeers.add( PredicateDescr.class );
+            this.validPeers.add( FieldBindingDescr.class );
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        
+        final String identifier = attrs.getValue( "identifier" );
+        final String fieldName = attrs.getValue( "field-name" );
+        
+        emptyAttributeCheck( localName, "identifier", identifier, parser );        
+        emptyAttributeCheck( localName, "fieldName", fieldName, parser );
+
+        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( fieldName,
+                                                                           identifier );
+
+        return fieldBindingDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) parser.getCurrent();
+
+        final PatternDescr patternDescr = (PatternDescr) parser.getParent( );
+
+        patternDescr.addConstraint( fieldBindingDescr );
+
+        return fieldBindingDescr;
+    }
+
+    public Class generateNodeFor() {
+        return FieldBindingDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldConstraintHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldConstraintHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FieldConstraintHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,108 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class FieldConstraintHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public FieldConstraintHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PatternDescr.class );
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( OrDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FieldConstraintDescr.class );
+            this.validPeers.add( PredicateDescr.class );
+            this.validPeers.add( FieldBindingDescr.class );
+
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String fieldName = attrs.getValue( "field-name" );
+        
+        emptyAttributeCheck( localName, "field-name", fieldName, parser );
+
+        final FieldConstraintDescr fieldConstraint = new FieldConstraintDescr( fieldName );
+
+        return fieldConstraint;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+
+        final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parser.getCurrent();
+        
+        final Object parent = parser.getParent( );
+
+        if ( parent instanceof PatternDescr ) {
+            final PatternDescr patternDescr = (PatternDescr) parent;
+            patternDescr.addConstraint( fieldConstraintDescr );
+        } else if ( parent instanceof ConditionalElementDescr ) {
+            final ConditionalElementDescr ceDescr = (ConditionalElementDescr) parent;
+            final FieldConstraintDescr field = (FieldConstraintDescr) parser.getCurrent();
+            ceDescr.addOrMerge( field );
+        }
+
+        return fieldConstraintDescr;
+    }
+
+    public Class generateNodeFor() {
+        return FieldConstraintDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ForallHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ForallHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ForallHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,109 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author fernandomeyer
+ *
+ */
+public class ForallHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public ForallHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.drools.xml.Handler#start(java.lang.String, java.lang.String, org.xml.sax.Attributes)
+     */
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                             attrs );
+
+        final ForallDescr forallDescr = new ForallDescr();
+
+        return forallDescr;
+    }    
+
+    /* (non-Javadoc)
+     * @see org.drools.xml.Handler#end(java.lang.String, java.lang.String)
+     */
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final ForallDescr forallDescr = (ForallDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
+        parentDescr.addDescr( forallDescr );
+
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.xml.Handler#generateNodeFor()
+     */
+    public Class generateNodeFor() {
+        return ForallDescr.class;
+    }
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FromHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FromHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FromHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,91 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author fernandomeyer
+ *
+ */
+public class FromHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public FromHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PatternDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FieldConstraintDescr.class );
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final FromDescr fromDesctiptor = new FromDescr();
+        return fromDesctiptor;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+
+        final FromDescr fromDescr = (FromDescr) parser.getCurrent();
+
+        Object parent = parser.getParent();
+
+        final PatternDescr patternDescr = (PatternDescr) parent;
+
+        final ConditionalElementDescr parentDescr = (ConditionalElementDescr)  parser.getParent( 1 );
+
+        if ( (config.getChild( "expression" ) != null) ) {
+            patternDescr.setSource( fromDescr );    
+        }
+
+        return fromDescr;
+    }
+
+    public Class generateNodeFor() {
+        return FromDescr.class;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FunctionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FunctionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/FunctionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,114 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class FunctionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public FunctionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PackageDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FunctionDescr.class );
+            this.validPeers.add( RuleDescr.class );
+            this.validPeers.add( QueryDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                             attrs );
+        final String name = attrs.getValue( "name" );
+        final String returnType = attrs.getValue( "return-type" );
+        
+        emptyAttributeCheck( localName, "name", name, parser );
+        emptyAttributeCheck( localName, "return-type", returnType, parser );
+
+        final FunctionDescr functionDescr = new FunctionDescr( name,
+                                                               returnType );
+        
+        return functionDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        FunctionDescr functionDescr = ( FunctionDescr ) parser.getCurrent();
+
+        final Configuration[] parameters = config.getChildren( "parameter" );
+
+        for ( int i = 0, length = parameters.length; i < length; i++ ) {
+            final String identifier = parameters[i].getAttribute( "identifier" );      
+            final String type = parameters[i].getAttribute( "type" );
+            
+            emptyAttributeCheck("parameter", "identifier", identifier, parser);                  
+            emptyAttributeCheck("parameter", "type", type, parser);
+            
+            functionDescr.addParameter( type,
+                                        identifier );
+        }
+
+        // we allow empty, "", bodies - but make sure that we atleast have a body element
+        final Configuration body = config.getChild( "body" );
+        if ( body == null ) {
+            throw new SAXParseException( "function must have a <body>",
+                                         parser.getLocator() );
+        }
+
+        functionDescr.setText( body.getText() );
+
+        final PackageDescr packageDescr = (PackageDescr) parser.getData();
+
+        packageDescr.addFunction( functionDescr );
+
+        return functionDescr;
+    }
+
+    public Class generateNodeFor() {
+        return FunctionDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/LiteralRestrictionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/LiteralRestrictionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/LiteralRestrictionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,104 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * @author fmeyer
+ * 
+ */
+public class LiteralRestrictionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public LiteralRestrictionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FieldConstraintDescr.class );
+            this.validParents.add( RestrictionConnectiveDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.validPeers.add( LiteralRestrictionDescr.class );
+            this.validPeers.add( ReturnValueRestrictionDescr.class );
+            this.validPeers.add( VariableRestrictionDescr.class );
+            this.validPeers.add( RestrictionConnectiveDescr.class );
+            this.validPeers.add( QualifiedIdentifierRestrictionDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String evaluator = attrs.getValue( "evaluator" );
+        emptyAttributeCheck( localName, "evaluator", evaluator, parser );
+
+        final String text = attrs.getValue( "value" );
+
+        final LiteralRestrictionDescr literalDescr = new LiteralRestrictionDescr( evaluator,
+                                                                                  text );
+
+        return literalDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final LiteralRestrictionDescr literalDescr = (LiteralRestrictionDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof FieldConstraintDescr ) {
+            final FieldConstraintDescr fieldConstriantDescr = (FieldConstraintDescr) parent;
+            fieldConstriantDescr.addRestriction( literalDescr );
+        } else if ( parent instanceof RestrictionConnectiveDescr ) {
+            final RestrictionConnectiveDescr restrictionDescr = (RestrictionConnectiveDescr) parent;
+            restrictionDescr.addRestriction( literalDescr );
+        }
+        return literalDescr;
+    }
+
+    public Class generateNodeFor() {
+        return LiteralRestrictionDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/NotHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/NotHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/NotHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class NotHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public NotHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( OrDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final NotDescr notDescr = new NotDescr();
+
+        return notDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final NotDescr notDescr = (NotDescr) parser.getCurrent();
+
+        if ( (notDescr.getDescrs().size() != 1) && (notDescr.getDescrs().get( 0 ).getClass() != PatternDescr.class) ) {
+            throw new SAXParseException( "<not> can only have a single <pattern...> as a child element",
+                                         parser.getLocator() );
+        }
+
+        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
+        parentDescr.addDescr( notDescr );
+
+        return null;
+    }
+
+    public Class generateNodeFor() {
+        return NotDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/OrHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/OrHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/OrHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author mproctor
+ */
+public class OrHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public OrHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( PatternDescr.class );
+            this.validParents.add( AccumulateDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final OrDescr orDescr = new OrDescr();
+
+        return orDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final OrDescr orDescr = (OrDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof ConditionalElementDescr ) {
+            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
+            parentDescr.addDescr( orDescr );
+        } else if ( parent instanceof PatternDescr ) {
+            final PatternDescr parentDescr = (PatternDescr) parent;
+            parentDescr.addConstraint( orDescr );
+        }
+
+        return orDescr;
+    }
+
+    public Class generateNodeFor() {
+        return OrDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PackageHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PackageHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PackageHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,135 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class PackageHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public PackageHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( null );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String ruleSetName = attrs.getValue( "name" );
+
+        if ( ruleSetName == null || ruleSetName.trim().equals( "" ) ) {
+            throw new SAXParseException( "<package> requires a 'name' attribute",
+                                         parser.getLocator() );
+        }
+
+        final PackageDescr packageDescr = new PackageDescr( ruleSetName.trim() );
+
+        parser.setData( packageDescr );
+        return packageDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final PackageDescr packageDescr = ( PackageDescr ) parser.getData();
+        final Configuration config = parser.endConfiguration();
+
+        final Configuration[] imports = config.getChildren( "import" );
+
+        for ( int i = 0, length = imports.length; i < length; i++ ) {
+            final String importEntry = imports[i].getAttribute( "name" );
+
+            if ( importEntry == null || importEntry.trim().equals( "" ) ) {
+                throw new SAXParseException( "<import> cannot be blank",
+                                             parser.getLocator() );
+            }
+            packageDescr.addImport( new ImportDescr( importEntry ) );
+        }
+        
+        final Configuration[] importfunctions = config.getChildren( "importfunction" );
+
+        for ( int i = 0, length = importfunctions.length; i < length; i++ ) {
+            final String importfunctionEntry = importfunctions[i].getAttribute( "name" );
+
+            if ( importfunctionEntry == null || importfunctionEntry.trim().equals( "" ) ) {
+                throw new SAXParseException( "<importfunction> cannot be blank",
+                                             parser.getLocator() );
+            }
+            
+            FunctionImportDescr funcdescr = new FunctionImportDescr();
+            funcdescr.setTarget( importfunctionEntry );
+            
+            packageDescr.addFunctionImport(funcdescr);
+        }
+        
+
+        final Configuration[] globals = config.getChildren( "global" );
+
+        for ( int i = 0, length = globals.length; i < length; i++ ) {
+            final String identifier = globals[i].getAttribute( "identifier" );
+
+            if ( identifier == null || identifier.trim().equals( "" ) ) {
+                throw new SAXParseException( "<global> must have an identifier",
+                                             parser.getLocator() );
+            }
+
+            final String type = globals[i].getAttribute( "type" );
+            if ( type == null || type.trim().equals( "" ) ) {
+                throw new SAXParseException( "<global> must have specify a type",
+                                             parser.getLocator() );
+            }
+            final GlobalDescr global = new GlobalDescr( identifier,
+                                                        type );
+            packageDescr.addGlobal( global );
+        }
+
+        return packageDescr;
+    }
+
+    public Class generateNodeFor() {
+        return PackageDescr.class;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PatternHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PatternHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PatternHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,125 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PatternDestinationDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class PatternHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public PatternHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( AndDescr.class );
+            this.validParents.add( OrDescr.class );
+            this.validParents.add( NotDescr.class );
+            this.validParents.add( ExistsDescr.class );
+            this.validParents.add( CollectDescr.class );
+            this.validParents.add( ForallDescr.class );
+            this.validParents.add( AccumulateDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( AndDescr.class );
+            this.validPeers.add( OrDescr.class );
+            this.validPeers.add( NotDescr.class );
+            this.validPeers.add( ExistsDescr.class );
+            this.validPeers.add( EvalDescr.class );
+            this.validPeers.add( PatternDescr.class );
+            this.validPeers.add( ForallDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String objectType = attrs.getValue( "object-type" );
+
+        if ( objectType == null || objectType.trim().equals( "" ) ) {
+            throw new SAXParseException( "<pattern> requires an 'object-type' attribute",
+                                         parser.getLocator() );
+        }
+
+        PatternDescr patternDescr = null;
+
+        final String identifier = attrs.getValue( "identifier" );
+        if ( identifier == null || identifier.trim().equals( "" ) ) {
+            patternDescr = new PatternDescr( objectType );
+        } else {
+            patternDescr = new PatternDescr( objectType,
+                                             identifier );
+        }
+
+        return patternDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+
+        final Configuration config = parser.endConfiguration();
+        final PatternDescr patternDescr = (PatternDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof PatternDestinationDescr ) {
+            final PatternDestinationDescr parentDescr = (PatternDestinationDescr) parent;
+            parentDescr.setInputPattern( patternDescr );
+        } else {
+            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
+            parentDescr.addDescr( patternDescr );
+        }
+        return patternDescr;
+    }
+
+    public Class generateNodeFor() {
+        return PatternDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PredicateHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PredicateHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/PredicateHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,96 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class PredicateHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public PredicateHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PatternDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FieldConstraintDescr.class );
+            this.validPeers.add( PredicateDescr.class );
+            this.validPeers.add( FieldBindingDescr.class );
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final PredicateDescr predicateDescr = new PredicateDescr();
+
+        return predicateDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final PredicateDescr predicateDescr = (PredicateDescr) parser.getCurrent();
+
+        final String expression = config.getText();
+
+        if ( expression == null || expression.trim().equals( "" ) ) {
+            throw new SAXParseException( "<predicate> must have some content",
+                                         parser.getLocator() );
+        }
+
+        predicateDescr.setContent( expression );
+
+        final PatternDescr patternDescr = (PatternDescr) parser.getParent();
+
+        patternDescr.addConstraint( predicateDescr );
+
+        return predicateDescr;
+    }
+
+    public Class generateNodeFor() {
+        return PredicateDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QualifiedIdentifierRestrictionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QualifiedIdentifierRestrictionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QualifiedIdentifierRestrictionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,110 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author fmeyer
+ */
+
+public class QualifiedIdentifierRestrictionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public QualifiedIdentifierRestrictionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FieldConstraintDescr.class );
+            this.validParents.add( RestrictionConnectiveDescr.class );
+
+            this.validPeers = new HashSet();
+
+            this.validPeers.add( null );
+            this.validPeers.add( LiteralRestrictionDescr.class );
+            this.validPeers.add( ReturnValueRestrictionDescr.class );
+            this.validPeers.add( VariableRestrictionDescr.class );
+            this.validPeers.add( RestrictionConnectiveDescr.class );
+            this.validPeers.add( QualifiedIdentifierRestrictionDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        String evaluator = attrs.getValue( "evaluator" );
+        emptyAttributeCheck( localName, "evaluator", evaluator, parser );
+        boolean isNegated = evaluator.startsWith( "not " );
+        if( isNegated ) {
+            evaluator = evaluator.substring( 4 );
+        }
+
+        final QualifiedIdentifierRestrictionDescr qualifiedIdentifierRestricionDescr = new QualifiedIdentifierRestrictionDescr( evaluator,
+                                                                                                                                isNegated,
+                                                                                                                                null,
+                                                                                                                                null );
+
+        return qualifiedIdentifierRestricionDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final QualifiedIdentifierRestrictionDescr qualifiedIdentifierRestricionDescr = (QualifiedIdentifierRestrictionDescr) parser.getCurrent();
+
+        final String expression = config.getText();
+
+        emptyContentCheck( localName, expression, parser );
+
+        qualifiedIdentifierRestricionDescr.setText( expression );
+        
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof FieldConstraintDescr ) {
+            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
+            fieldConstraintDescr.addRestriction( qualifiedIdentifierRestricionDescr );
+        } else if ( parent instanceof RestrictionConnectiveDescr ) {
+            final RestrictionConnectiveDescr restrictionConDescr = (RestrictionConnectiveDescr) parent;
+            restrictionConDescr.addRestriction( qualifiedIdentifierRestricionDescr );
+        }
+        return qualifiedIdentifierRestricionDescr;
+    }
+
+    public Class generateNodeFor() {
+        return QualifiedIdentifierRestrictionDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QueryHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QueryHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/QueryHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,95 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class QueryHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public QueryHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PackageDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FunctionDescr.class );
+            this.validPeers.add( RuleDescr.class );
+            this.validPeers.add( QueryDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String queryName = attrs.getValue( "name" );
+        emptyAttributeCheck( localName, "name", queryName, parser );
+
+        final QueryDescr queryDescr = new QueryDescr( queryName.trim() );
+
+        return queryDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final QueryDescr queryDescr = (QueryDescr) parser.getCurrent();
+
+        final AndDescr lhs = queryDescr.getLhs();
+
+        if ( lhs == null || lhs.getDescrs().isEmpty() ) {
+            throw new SAXParseException( "<query> requires a LHS",
+                                         parser.getLocator() );
+        }
+
+        (( PackageDescr ) parser.getData()).addRule( queryDescr );
+
+        return queryDescr;
+    }
+
+    public Class generateNodeFor() {
+        return QueryDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RestrictionConnectiveHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RestrictionConnectiveHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RestrictionConnectiveHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,107 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class RestrictionConnectiveHandler extends BaseAbstractHandler
+    implements
+    Handler {
+
+    public final static String AND = "and-restriction-connective";
+    public final static String OR  = "or-restriction-connective";
+
+   public RestrictionConnectiveHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FieldConstraintDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.validPeers.add( LiteralRestrictionDescr.class );
+            this.validPeers.add( ReturnValueRestrictionDescr.class );
+            this.validPeers.add( VariableRestrictionDescr.class );
+            this.validPeers.add( RestrictionConnectiveDescr.class );
+            this.validPeers.add( QualifiedIdentifierRestrictionDescr.class );
+
+            this.allowNesting = true;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        RestrictionConnectiveDescr connectiveDescr = null;
+        if ( localName.equals( RestrictionConnectiveHandler.OR ) ) {
+            connectiveDescr = new RestrictionConnectiveDescr( RestrictionConnectiveDescr.OR );
+        } else if ( localName.equals( RestrictionConnectiveHandler.AND ) ) {
+            connectiveDescr = new RestrictionConnectiveDescr( RestrictionConnectiveDescr.AND );
+        }
+
+        return connectiveDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final RestrictionConnectiveDescr connectiveDescr = (RestrictionConnectiveDescr) parser.getCurrent();
+
+        final Object obj = parser.getParent();
+
+        if ( obj instanceof FieldConstraintDescr ) {
+            final FieldConstraintDescr fieldConstriantDescr = (FieldConstraintDescr) obj;
+            fieldConstriantDescr.addRestriction( connectiveDescr );
+        } else if ( obj instanceof RestrictionConnectiveDescr ) {
+            final RestrictionConnectiveDescr restconective = (RestrictionConnectiveDescr) obj;
+            restconective.addRestriction( connectiveDescr );
+        }
+
+        return connectiveDescr;
+    }
+
+    public Class generateNodeFor() {
+        return RestrictionConnectiveDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ReturnValueRestrictionHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ReturnValueRestrictionHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/ReturnValueRestrictionHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,106 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class ReturnValueRestrictionHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public ReturnValueRestrictionHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FieldConstraintDescr.class );
+            this.validParents.add( RestrictionConnectiveDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+
+            this.validPeers.add( LiteralRestrictionDescr.class );
+            this.validPeers.add( ReturnValueRestrictionDescr.class );
+            this.validPeers.add( VariableRestrictionDescr.class );
+            this.validPeers.add( RestrictionConnectiveDescr.class );
+            this.validPeers.add( QualifiedIdentifierRestrictionDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+        final String evaluator = attrs.getValue( "evaluator" );
+        emptyAttributeCheck( localName, "evaluator", evaluator, parser );
+
+        final ReturnValueRestrictionDescr returnValueDescr = new ReturnValueRestrictionDescr( evaluator );
+
+        return returnValueDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final ReturnValueRestrictionDescr returnValueDescr = (ReturnValueRestrictionDescr) parser.getCurrent();
+
+        final String expression = config.getText();
+        emptyContentCheck( localName, expression, parser );
+
+        returnValueDescr.setContent( expression );
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof FieldConstraintDescr ) {
+            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
+            fieldConstraintDescr.addRestriction( returnValueDescr );
+        } else if ( parent instanceof RestrictionConnectiveDescr ) {
+            final RestrictionConnectiveDescr rcDescr = (RestrictionConnectiveDescr) parent;
+            rcDescr.addRestriction( returnValueDescr );
+        }
+        return returnValueDescr;
+    }
+
+    public Class generateNodeFor() {
+        return ReturnValueRestrictionDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RuleHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RuleHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/RuleHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,115 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class RuleHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public RuleHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( PackageDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( FunctionDescr.class );
+            this.validPeers.add( RuleDescr.class );
+            this.validPeers.add( QueryDescr.class );
+
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String ruleName = attrs.getValue( "name" );
+        emptyAttributeCheck(localName, "name", ruleName, parser );
+
+        final RuleDescr ruleDescr = new RuleDescr( ruleName.trim() );
+
+        return ruleDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final RuleDescr ruleDescr = (RuleDescr) parser.getCurrent();
+
+        final AndDescr lhs = ruleDescr.getLhs();
+
+        if ( lhs == null ) {
+            throw new SAXParseException( "<rule> requires a LHS",
+                                         parser.getLocator() );
+        }
+
+        final Configuration rhs = config.getChild( "rhs" );
+        if ( rhs == null ) {
+            throw new SAXParseException( "<rule> requires a <rh> child element",
+                                         parser.getLocator() );
+        }
+
+        ruleDescr.setConsequence( rhs.getText() );
+
+        final Configuration[] attributes = config.getChildren( "rule-attribute" );
+        for ( int i = 0, length = attributes.length; i < length; i++ ) {
+            final String name = attributes[i].getAttribute( "name" );
+            emptyAttributeCheck( "rule-attribute", "name", name, parser );
+
+            final String value = attributes[i].getAttribute( "value" );
+
+            ruleDescr.addAttribute( new AttributeDescr( name,
+                                                        value ) );
+        }
+
+        (( PackageDescr ) parser.getData()).addRule( ruleDescr );
+
+        return ruleDescr;
+    }
+
+    public Class generateNodeFor() {
+        return RuleDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/VariableRestrictionsHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/VariableRestrictionsHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/java/org/drools/xml/rules/VariableRestrictionsHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,102 @@
+package org.drools.xml.rules;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author mproctor
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class VariableRestrictionsHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public VariableRestrictionsHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( FieldConstraintDescr.class );
+            this.validParents.add( RestrictionConnectiveDescr.class );
+
+            this.validPeers = new HashSet();
+            this.validPeers.add( null );
+            this.validPeers.add( LiteralRestrictionDescr.class );
+            this.validPeers.add( ReturnValueRestrictionDescr.class );
+            this.validPeers.add( VariableRestrictionDescr.class );
+            this.validPeers.add( RestrictionConnectiveDescr.class );
+            this.allowNesting = false;
+        }
+    }
+
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser parser) throws SAXException {
+        parser.startConfiguration( localName,
+                                                  attrs );
+
+        final String evaluator = attrs.getValue( "evaluator" );
+        final String identifier = attrs.getValue( "identifier" );
+        
+        emptyAttributeCheck( localName, "evaluator", evaluator, parser );
+        emptyAttributeCheck( localName, identifier, "identifier", parser );
+
+        final VariableRestrictionDescr variableDescr = new VariableRestrictionDescr( evaluator,
+                                                                                     identifier );
+
+        return variableDescr;
+    }
+
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser parser) throws SAXException {
+        final Configuration config = parser.endConfiguration();
+
+        final VariableRestrictionDescr variableDescr = (VariableRestrictionDescr) parser.getCurrent();
+
+        final Object parent = parser.getParent();
+
+        if ( parent instanceof FieldConstraintDescr ) {
+            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
+            fieldConstraintDescr.addRestriction( variableDescr );
+        } else if ( parent instanceof RestrictionConnectiveDescr ) {
+            final RestrictionConnectiveDescr restrictionConDescr = (RestrictionConnectiveDescr) parent;
+            restrictionConDescr.addRestriction( variableDescr );
+        }
+
+        return variableDescr;
+    }
+
+    public Class generateNodeFor() {
+        return VariableRestrictionDescr.class;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools-4.0.xsd
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools-4.0.xsd	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools-4.0.xsd	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:drools="http://drools.org/drools-4.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://drools.org/drools-4.0">
+  <xs:element name="package">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element ref="drools:import"/>
+        <xs:element ref="drools:importfunction"/>
+        <xs:element ref="drools:global"/>
+        <xs:element ref="drools:function"/>
+        <xs:element ref="drools:rule"/>
+        <xs:element ref="drools:query"/>
+      </xs:choice>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="rule">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" minOccurs="0" ref="drools:rule-attribute"/>
+        <xs:element ref="drools:lhs"/>
+        <xs:element ref="drools:rhs"/>
+      </xs:sequence>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+    </xs:complexType>
+<!-- All rules must have unique names -->
+    <xs:key name="ruleName">
+      <xs:selector xpath="drools:rule"/>
+      <xs:field xpath="@name"/>
+    </xs:key>
+  </xs:element>
+  <xs:element name="query">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="drools:lhs"/>
+      </xs:sequence>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+    </xs:complexType>
+<!-- All rules must have unique names -->
+    <xs:key name="queryName">
+      <xs:selector xpath="drools:query"/>
+      <xs:field xpath="@name"/>
+    </xs:key>
+  </xs:element>
+  <xs:element name="rule-attribute">
+    <xs:complexType>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+      <xs:attribute name="value" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="import">
+    <xs:complexType>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+    <xs:element name="importfunction">
+      <xs:complexType>
+        <xs:attribute name="name" type="xs:string" use="required"/>
+      </xs:complexType>
+    </xs:element>
+  <xs:element name="global">
+    <xs:complexType>
+      <xs:attribute name="type" type="xs:string" use="required"/>
+      <xs:attribute name="identifier" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="function">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" minOccurs="0" ref="drools:parameter"/>
+        <xs:element name="body" type="xs:string"/>
+      </xs:sequence>
+      <xs:attribute name="name" type="xs:string" use="required"/>
+      <xs:attribute name="return-type" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="parameter">
+    <xs:complexType>
+      <xs:attribute name="type" type="xs:string" use="required"/>
+      <xs:attribute name="identifier" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="rhs" type="xs:string"/>
+  <xs:element name="lhs">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element ref="drools:abstractConditionalElement"/>
+        <xs:element ref="drools:not"/>
+        <xs:element ref="drools:exists"/>
+        <xs:element ref="drools:pattern"/>
+        <xs:element ref="drools:eval"/>
+        <xs:element ref="drools:forall"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+<!-- Restriction Conective  -->
+  <xs:element name="abstractRestrictionConnective" type="drools:restrictionElementType" abstract="true"/>
+  <xs:element name="abstractConditionalElement" type="drools:conditionalElementType" abstract="true"/>
+  <xs:element name="abstractConstraintConective" type="drools:constraintConnectiveElementType" abstract="true"/>
+  <xs:complexType name="restrictionElementType">
+    <xs:choice maxOccurs="unbounded" minOccurs="0">
+      <xs:element ref="drools:literal-restriction"/>
+      <xs:element ref="drools:variable-restriction"/>
+      <xs:element ref="drools:return-value-restriction"/>
+      <xs:element ref="drools:qualified-identifier-restriction"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:complexType name="conditionalElementType">
+    <xs:choice maxOccurs="unbounded" minOccurs="0">
+      <xs:element ref="drools:not"/>
+      <xs:element ref="drools:exists"/>
+      <xs:element ref="drools:eval"/>
+      <xs:element ref="drools:pattern"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:complexType name="constraintConnectiveElementType">
+    <xs:choice maxOccurs="unbounded" minOccurs="0">
+      <xs:element ref="drools:field-constraint"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:element name="and-restriction-connective" substitutionGroup="drools:abstractRestrictionConnective">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:restrictionElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:or-restriction-connective"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="or-restriction-connective" substitutionGroup="drools:abstractRestrictionConnective">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:restrictionElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:and-restriction-connective"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+<!-- Conditional Element -->
+  <xs:element name="and-conditional-element" substitutionGroup="drools:abstractConditionalElement">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:conditionalElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:or-conditional-element"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="or-conditional-element" substitutionGroup="drools:abstractConditionalElement">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:conditionalElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:and-conditional-element"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+<!-- Logical Connectives -->
+  <xs:element name="and-constraint-connective" substitutionGroup="drools:abstractConstraintConective">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:constraintConnectiveElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:or-constraint-connective"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="or-constraint-connective" substitutionGroup="drools:abstractConstraintConective">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:constraintConnectiveElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:and-constraint-connective"/>
+          </xs:choice>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="not">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="1">
+        <xs:element ref="drools:abstractConditionalElement"/>
+        <xs:element ref="drools:not"/>
+        <xs:element ref="drools:exists"/>
+        <xs:element ref="drools:pattern"/>
+        <xs:element ref="drools:accumulate"/>
+        <xs:element ref="drools:collect"/>
+        <xs:element ref="drools:forall"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="exists">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element ref="drools:pattern"/>
+        <xs:element ref="drools:abstractConditionalElement"/>
+        <xs:element ref="drools:accumulate"/>
+        <xs:element ref="drools:collect"/>
+        <xs:element ref="drools:forall"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="forall">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element ref="drools:pattern"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="collect">
+    <xs:complexType>
+      <xs:choice maxOccurs="1" minOccurs="1">
+        <xs:element ref="drools:pattern"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="expression" type="xs:string"/>
+  <xs:group name="accumulate">
+    <xs:sequence>
+      <xs:choice>
+        <xs:element ref="drools:pattern"/>
+        <xs:element ref="drools:abstractConditionalElement"/>
+      </xs:choice>
+      <xs:choice>
+        <xs:sequence>
+          <xs:element name="init" type="xs:string"/>
+          <xs:element name="action" type="xs:string"/>
+          <xs:element name="result" type="xs:string"/>
+        </xs:sequence>
+        <xs:element ref="drools:external-function"/>
+      </xs:choice>
+    </xs:sequence>
+  </xs:group>
+  <xs:element name="accumulate">
+    <xs:complexType>
+      <xs:choice maxOccurs="1" minOccurs="1">
+        <xs:group ref="drools:accumulate"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="from">
+    <xs:complexType>
+      <xs:choice maxOccurs="1">
+        <xs:element ref="drools:collect"/>
+        <xs:element ref="drools:expression"/>
+        <xs:element ref="drools:accumulate"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="eval" type="xs:string"/>
+  <xs:element name="pattern">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element ref="drools:field-binding"/>
+        <xs:element ref="drools:field-constraint"/>
+        <xs:element ref="drools:from"/>
+        <xs:element ref="drools:predicate"/>
+        <xs:element ref="drools:abstractConstraintConective"/>
+      </xs:choice>
+      <xs:attribute name="field-name" type="xs:string" use="optional"/>
+      <xs:attribute name="identifier" type="xs:string" use="optional"/>
+      <xs:attribute name="object-type" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="field-constraint">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="drools:restrictionElementType">
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="drools:abstractRestrictionConnective"/>
+          </xs:choice>
+          <xs:attribute name="field-name" type="xs:string" use="required"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="field-binding">
+    <xs:complexType>
+      <xs:attribute name="field-name" type="xs:string" use="required"/>
+      <xs:attribute name="identifier" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="literal-restriction">
+    <xs:complexType>
+      <xs:attribute name="evaluator" type="xs:string" use="required"/>
+      <xs:attribute name="value" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="external-function">
+    <xs:complexType>
+      <xs:attribute name="evaluator" type="xs:string" use="required"/>
+      <xs:attribute name="expression" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="variable-restriction">
+    <xs:complexType>
+      <xs:attribute name="evaluator" type="xs:string" use="required"/>
+      <xs:attribute name="identifier" type="xs:string" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="return-value-restriction">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string">
+          <xs:attribute name="evaluator" type="xs:string" use="required"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="qualified-identifier-restriction">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string">
+          <xs:attribute name="evaluator" type="xs:string" use="required"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="predicate">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string">
+          <xs:attribute name="field-name" type="xs:string" use="optional"/>
+          <xs:attribute name="identifier" type="xs:string" use="optional"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools.default.packagebuilder.conf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools.default.packagebuilder.conf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/META-INF/drools.default.packagebuilder.conf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+drools.dialect.default = java
+drools.dialect.java = org.drools.rule.builder.dialect.java.JavaDialectConfiguration
+drools.dialect.java.compiler = ECLIPSE
+
+drools.dialect.mvel = org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
+drools.dialect.mvel.strict = true
+
+drools.accumulate.function.average = org.drools.base.accumulators.AverageAccumulateFunction
+drools.accumulate.function.max = org.drools.base.accumulators.MaxAccumulateFunction
+drools.accumulate.function.min = org.drools.base.accumulators.MinAccumulateFunction
+drools.accumulate.function.count = org.drools.base.accumulators.CountAccumulateFunction
+drools.accumulate.function.sum = org.drools.base.accumulators.SumAccumulateFunction
+
+drools.evaluator.coincides = org.drools.base.evaluators.CoincidesEvaluatorDefinition
+drools.evaluator.before = org.drools.base.evaluators.BeforeEvaluatorDefinition
+drools.evaluator.after = org.drools.base.evaluators.AfterEvaluatorDefinition
+drools.evaluator.meets = org.drools.base.evaluators.MeetsEvaluatorDefinition
+drools.evaluator.metby = org.drools.base.evaluators.MetByEvaluatorDefinition
+drools.evaluator.overlaps = org.drools.base.evaluators.OverlapsEvaluatorDefinition
+drools.evaluator.overlappedby = org.drools.base.evaluators.OverlappedByEvaluatorDefinition
+drools.evaluator.during = org.drools.base.evaluators.DuringEvaluatorDefinition
+drools.evaluator.includes = org.drools.base.evaluators.IncludesEvaluatorDefinition
+drools.evaluator.starts = org.drools.base.evaluators.StartsEvaluatorDefinition
+drools.evaluator.startedby = org.drools.base.evaluators.StartedByEvaluatorDefinition
+drools.evaluator.finishes = org.drools.base.evaluators.FinishesEvaluatorDefinition
+drools.evaluator.finishedby = org.drools.base.evaluators.FinishedByEvaluatorDefinition
+drools.evaluator.equality = org.drools.base.evaluators.EqualityEvaluatorsDefinition
+drools.evaluator.comparable = org.drools.base.evaluators.ComparableEvaluatorsDefinition
+drools.evaluator.set = org.drools.base.evaluators.SetEvaluatorsDefinition
+drools.evaluator.matches = org.drools.base.evaluators.MatchesEvaluatorsDefinition
+drools.evaluator.soundslike = org.drools.base.evaluators.SoundslikeEvaluatorsDefinition
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/compiler/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/compiler/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/compiler/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+<body>
+	This is the main package to load rules. Use PackageBuilder and RuleBaseLoader classes.
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRL.g
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRL.g	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRL.g	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,2051 @@
+grammar DRL; 
+
+ at parser::header {
+	package org.drools.lang;
+	import java.util.List;
+	import java.util.ArrayList;
+	import java.util.Iterator;
+	import java.util.HashMap;	
+	import java.util.StringTokenizer;
+	import org.drools.lang.descr.*;
+}
+
+ at parser::members {
+	private PackageDescr packageDescr;
+	private List errors = new ArrayList();
+	private String source = "unknown";
+	private int lineOffset = 0;
+	private DescrFactory factory = new DescrFactory();
+	private boolean parserDebug = false;
+	private Location location = new Location( Location.LOCATION_UNKNOWN );
+	
+	// THE FOLLOWING LINES ARE DUMMY ATTRIBUTES TO WORK AROUND AN ANTLR BUG
+	private BaseDescr from = null;
+	private FieldConstraintDescr fc = null;
+	private RestrictionConnectiveDescr and = null;
+	private RestrictionConnectiveDescr or = null;
+	private ConditionalElementDescr base = null;
+	
+	public void setParserDebug(boolean parserDebug) {
+		this.parserDebug = parserDebug;
+	}
+	
+	public void debug(String message) {
+		if ( parserDebug ) 
+			System.err.println( "drl parser: " + message );
+	}
+	
+	public void setSource(String source) {
+		this.source = source;
+	}
+	public DescrFactory getFactory() {
+		return factory;
+	}	
+
+	public String getSource() {
+		return this.source;
+	}
+	
+	public PackageDescr getPackageDescr() {
+		return packageDescr;
+	}
+	
+	private int offset(int line) {
+		return line + lineOffset;
+	}
+	
+	/**
+	 * This will set the offset to record when reparsing. Normally is zero of course 
+	 */
+	public void setLineOffset(int i) {
+	 	this.lineOffset = i;
+	}
+	
+	private String getString(String token) {
+		return safeSubstring( token, 1, token.length() -1 );
+	}
+	
+	private String cleanupSpaces( String input ) {
+                return input.replaceAll( "\\s", "" );
+        }
+	
+	
+	public void reportError(RecognitionException ex) {
+	        // if we've already reported an error and have not matched a token
+                // yet successfully, don't report any errors.
+                if ( errorRecovery ) {
+                        return;
+                }
+                errorRecovery = true;
+
+		ex.line = offset(ex.line); //add the offset if there is one
+		errors.add( ex ); 
+	}
+     	
+     	/** return the raw RecognitionException errors */
+     	public List getErrors() {
+     		return errors;
+     	}
+     	
+     	/** Return a list of pretty strings summarising the errors */
+     	public List getErrorMessages() {
+     		List messages = new ArrayList();
+ 		for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+     	     		messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+     	     	}
+     	     	return messages;
+     	}
+     	
+     	/** return true if any parser errors were accumulated */
+     	public boolean hasErrors() {
+  		return ! errors.isEmpty();
+     	}
+     	
+     	/** This will take a RecognitionException, and create a sensible error message out of it */
+     	public String createErrorMessage(RecognitionException e)
+        {
+		StringBuffer message = new StringBuffer();		
+                message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+                if ( e instanceof MismatchedTokenException ) {
+                        MismatchedTokenException mte = (MismatchedTokenException)e;
+                        if( mte.expecting >=0 && mte.expecting < tokenNames.length ) {
+	                        message.append("mismatched token: "+
+                                                           e.token+
+                                                           "; expecting type "+
+                                                           tokenNames[mte.expecting]);
+                        } else {
+	                        message.append("mismatched token: "+
+                                                           e.token+
+                                                           ";");
+                        }
+                }
+                else if ( e instanceof MismatchedTreeNodeException ) {
+                        MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+                        if( mtne.expecting >=0 && mtne.expecting < tokenNames.length ) {
+	                        message.append("mismatched tree node: "+
+                                                           mtne.toString() +
+                                                           "; expecting type "+
+                                                           tokenNames[mtne.expecting]);
+                        } else {
+	                        message.append("mismatched tree node: "+
+                                                           mtne.toString() +
+                                                           ";");
+                        }
+                }
+                else if ( e instanceof NoViableAltException ) {
+                        NoViableAltException nvae = (NoViableAltException)e;
+			message.append( "Unexpected token '" + e.token.getText() + "'" );
+                        /*
+                        message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+                                                           " state "+nvae.stateNumber+
+                                                           " (decision="+nvae.decisionNumber+
+                                                           ") no viable alt; token="+
+                                                           e.token);
+                                                           */
+                }
+                else if ( e instanceof EarlyExitException ) {
+                        EarlyExitException eee = (EarlyExitException)e;
+                        message.append("required (...)+ loop (decision="+
+                                                           eee.decisionNumber+
+                                                           ") did not match anything; token="+
+                                                           e.token);
+                }
+                else if ( e instanceof MismatchedSetException ) {
+                        MismatchedSetException mse = (MismatchedSetException)e;
+                        message.append("mismatched token '"+
+                                                           e.token+
+                                                           "' expecting set "+mse.expecting);
+                }
+                else if ( e instanceof MismatchedNotSetException ) {
+                        MismatchedNotSetException mse = (MismatchedNotSetException)e;
+                        message.append("mismatched token '"+
+                                                           e.token+
+                                                           "' expecting set "+mse.expecting);
+                }
+                else if ( e instanceof FailedPredicateException ) {
+                        FailedPredicateException fpe = (FailedPredicateException)e;
+                        message.append("rule "+fpe.ruleName+" failed predicate: {"+
+                                                           fpe.predicateText+"}?");
+                } else if (e instanceof GeneralParseException) {
+			message.append(" " + e.getMessage());
+		}
+               	return message.toString();
+        }   
+        
+        void checkTrailingSemicolon(String text, int line) {
+        	if (text.trim().endsWith( ";" ) ) {
+        		this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
+        	}
+        }
+        
+        public Location getLocation() {
+                return this.location;
+        }
+        
+        private String safeSubstring( String text, int start, int end ) {
+            	return text.substring( Math.min( start, text.length() ), Math.min( Math.max( start, end ), text.length() ) );
+        }
+      
+}
+
+ at lexer::header {
+	package org.drools.lang;
+}
+
+opt_semicolon
+	: ';'?
+	;
+
+compilation_unit
+	@init {
+		// reset Location information
+		this.location = new Location( Location.LOCATION_UNKNOWN );
+	}
+	:	prolog 
+		statement*
+		EOF
+	;
+	catch [ RecognitionException e ] {
+		reportError( e );
+	}
+	
+prolog
+	@init {
+		String packageName = "";
+	}
+	:	( pkgstmt=package_statement { packageName = $pkgstmt.packageName; } )?
+		{ 
+			this.packageDescr = factory.createPackage( packageName ); 
+		}	
+	;
+	
+
+statement
+	:	a=rule_attribute { this.packageDescr.addAttribute( a ); }
+	|	function_import_statement 
+	|	import_statement 
+	|	global 
+	|	function 
+	|       t=template { this.packageDescr.addFactTemplate( $t.template ); }
+	|	r=rule { this.packageDescr.addRule( $r.rule ); }			
+	|	q=query	{ this.packageDescr.addRule( $q.query ); }
+	|       d=type_declaration { this.packageDescr.addTypeDeclaration( $d.declaration ); }
+	;
+	
+package_statement returns [String packageName]
+	@init{
+		$packageName = null;
+	}
+	:	
+		PACKAGE n=dotted_name opt_semicolon
+		{
+			$packageName = $n.text;
+		}
+	;
+
+	
+
+import_statement
+        @init {
+        	ImportDescr importDecl = null;
+        }
+	:	IMPORT 
+	        {
+	            importDecl = factory.createImport( );
+	            importDecl.setStartCharacter( ((CommonToken)$IMPORT).getStartIndex() );
+		    if (packageDescr != null) {
+			packageDescr.addImport( importDecl );
+		    }
+	        }
+	        import_name[importDecl] opt_semicolon
+	;
+
+function_import_statement
+        @init {
+        	FunctionImportDescr importDecl = null;
+        }
+	:	IMPORT FUNCTION 
+	        {
+	            importDecl = factory.createFunctionImport();
+	            importDecl.setStartCharacter( ((CommonToken)$IMPORT).getStartIndex() );
+		    if (packageDescr != null) {
+			packageDescr.addFunctionImport( importDecl );
+		    }
+	        }
+	        import_name[importDecl] opt_semicolon
+	;
+
+import_name[ImportDescr importDecl] returns [String name]
+	@init {
+		$name = null;
+	}
+	:	
+		ID 
+		{ 
+		    $name=$ID.text; 
+		    $importDecl.setTarget( name );
+		    $importDecl.setEndCharacter( ((CommonToken)$ID).getStopIndex() );
+		} 
+		( DOT id=identifier 
+		    { 
+		        $name = $name + $DOT.text + $id.text; 
+			$importDecl.setTarget( $name );
+		        $importDecl.setEndCharacter( ((CommonToken)$id.start).getStopIndex() );
+		    } 
+		)* 
+		( star='.*' 
+		    { 
+		        $name = $name + $star.text; 
+			$importDecl.setTarget( $name );
+		        $importDecl.setEndCharacter( ((CommonToken)$star).getStopIndex() );
+		    }
+		)?
+	;
+
+
+global
+	@init {
+	    GlobalDescr global = null;
+	}
+	:
+		GLOBAL 
+		{
+		    global = factory.createGlobal();
+	            global.setStartCharacter( ((CommonToken)$GLOBAL).getStartIndex() );
+		    packageDescr.addGlobal( global );
+		}
+		type=dotted_name 
+		{
+		    global.setType( $type.text );
+		}
+		id=identifier opt_semicolon
+		{
+		    global.setIdentifier( $id.text );
+		    global.setEndCharacter( ((CommonToken)$id.start).getStopIndex() );
+		}
+	;
+	
+
+function
+	@init {
+		FunctionDescr f = null;
+		String type = null;
+	}
+	:
+		FUNCTION retType=dotted_name? id=identifier
+		{
+			//System.err.println( "function :: " + n.getText() );
+			type = retType != null ? $retType.text : null;
+			f = factory.createFunction( $id.text, type );
+			f.setLocation(offset($FUNCTION.line), $FUNCTION.pos);
+	        	f.setStartCharacter( ((CommonToken)$FUNCTION).getStartIndex() );
+			packageDescr.addFunction( f );
+		} 
+		LEFT_PAREN
+			(	paramType=dotted_name? paramName=argument
+				{
+					type = paramType != null ? $paramType.text : null;
+					f.addParameter( type, $paramName.name );
+				}
+				(	COMMA paramType=dotted_name? paramName=argument
+					{
+						type = paramType != null ? $paramType.text : null;
+						f.addParameter( type, $paramName.name );
+					}
+				)*
+			)?
+		RIGHT_PAREN
+		body=curly_chunk
+		{
+			//strip out '{','}'
+			f.setText( safeSubstring( $body.text, 1, $body.text.length()-1 ) );
+			f.setEndCharacter( ((CommonToken)$body.stop).getStopIndex() );
+			f.setEndLocation(offset($body.stop.getLine()), $body.stop.getCharPositionInLine());
+		}
+	;
+
+argument returns [String name]
+	@init {
+		$name = null;
+	}
+	:	id=identifier { $name=$id.text; } ( '[' ']' { $name += "[]";})*
+	;
+	
+type_declaration returns [TypeDeclarationDescr declaration]
+        @init {
+                $declaration = factory.createTypeDeclaration();
+        }
+        :	DECLARE id=identifier 
+                        {
+                            $declaration.setTypeName( $id.text );
+                        }
+                LEFT_CURLY
+                        type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )*
+                RIGHT_CURLY
+        ;
+        
+type_decl_attribute[TypeDeclarationDescr declaration]
+        :	att=identifier 
+                ( val=STRING 
+                {
+                    $declaration.addAttribute( $att.text, getString( $val.text ) );
+                }
+                | cl=dotted_name
+                {
+                    $declaration.addAttribute( $att.text, $cl.text );
+                }
+                )
+        ;       
+
+query returns [QueryDescr query]
+	@init {
+		$query = null;
+		AndDescr lhs = null;
+		List params = null;
+		List types = null;		
+ 
+	}
+	:
+		QUERY queryName=name
+		{ 
+			$query = factory.createQuery( $queryName.name ); 
+			$query.setLocation( offset($QUERY.line), $QUERY.pos );
+			$query.setStartCharacter( ((CommonToken)$QUERY).getStartIndex() );
+			lhs = new AndDescr(); $query.setLhs( lhs ); 
+			lhs.setLocation( offset($QUERY.line), $QUERY.pos );
+                        location.setType( Location.LOCATION_RULE_HEADER );
+		}
+		( LEFT_PAREN
+		        ( { params = new ArrayList(); types = new ArrayList();}
+ 
+		            (paramType=qualified_id? paramName=ID { params.add( $paramName.text ); String type = (paramType != null) ? $paramType.text : "Object"; types.add( type ); } )
+		            (COMMA paramType=qualified_id? paramName=ID { params.add( $paramName.text );  String type = (paramType != null) ? $paramType.text : "Object"; types.add( type );  } )*
+ 
+		            {	$query.setParameters( (String[]) params.toArray( new String[params.size()] ) ); 
+		            	$query.setParameterTypes( (String[]) types.toArray( new String[types.size()] ) ); 
+		            }
+		         )?
+	          RIGHT_PAREN
+	        )?		
+	        {
+                        location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+	        }
+		normal_lhs_block[lhs]
+		END opt_semicolon
+		{
+			$query.setEndCharacter( ((CommonToken)$END).getStopIndex() );
+		}
+	;
+	
+template returns [FactTemplateDescr template]
+	@init {
+		$template = null;		
+	}
+	:
+		TEMPLATE templateName=name opt_semicolon
+		{
+			$template = new FactTemplateDescr($templateName.name);
+			$template.setLocation( offset($TEMPLATE.line), $TEMPLATE.pos );			
+			$template.setStartCharacter( ((CommonToken)$TEMPLATE).getStartIndex() );
+		}
+		(
+			slot=template_slot 
+			{
+				template.addFieldTemplate( $slot.field );
+			}
+		)+
+		END opt_semicolon 
+		{
+			template.setEndCharacter( ((CommonToken)$END).getStopIndex() );
+		}		
+	;
+	
+template_slot returns [FieldTemplateDescr field]
+	@init {
+		$field = null;
+	}
+	:
+	         {
+			$field = factory.createFieldTemplate();
+	         }
+		 fieldType=qualified_id
+		 {
+		        $field.setClassType( $fieldType.text );
+			$field.setStartCharacter( ((CommonToken)$fieldType.start).getStartIndex() );
+			$field.setEndCharacter( ((CommonToken)$fieldType.stop).getStopIndex() );
+		 }
+		 
+		 id=identifier opt_semicolon
+		 {
+		        $field.setName( $id.text );
+			$field.setLocation( offset($id.start.getLine()), $id.start.getCharPositionInLine() );
+			$field.setEndCharacter( ((CommonToken)$id.start).getStopIndex() );
+		 } 
+	;	
+	
+rule returns [RuleDescr rule]
+	@init {
+		$rule = null;
+		AndDescr lhs = null;
+	}
+	:
+		RULE ruleName=name 
+		{ 
+			location.setType( Location.LOCATION_RULE_HEADER );
+			debug( "start rule: " + $ruleName.name );
+			$rule = new RuleDescr( $ruleName.name, null ); 
+			$rule.setLocation( offset($RULE.line), $RULE.pos );
+			$rule.setStartCharacter( ((CommonToken)$RULE).getStartIndex() );
+			lhs = new AndDescr(); 
+			$rule.setLhs( lhs ); 
+		}
+		rule_attributes[$rule]?
+		(	
+			WHEN ':'?
+			{ 
+				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+				lhs.setLocation( offset($WHEN.line), $WHEN.pos );
+				lhs.setStartCharacter( ((CommonToken)$WHEN).getStartIndex() );
+			}
+			normal_lhs_block[lhs]
+		)?
+		rhs_chunk[$rule]
+	;
+	
+
+
+rule_attributes[RuleDescr rule]
+	: 
+	( ATTRIBUTES ':' )?
+	attr=rule_attribute { $rule.addAttribute( $attr.attr ); }
+	( ','? attr=rule_attribute { $rule.addAttribute( $attr.attr ); } )*
+	;
+
+
+	
+rule_attribute returns [AttributeDescr attr]
+	@init {
+		$attr = null;
+	}
+	@after {
+		$attr = $a.descr;
+	}
+	:	a=salience 
+	|	a=no_loop  
+	|	a=agenda_group  
+	|	a=duration  
+	|	a=activation_group 
+	|	a=auto_focus 
+	|	a=date_effective 
+	|	a=date_expires 
+	|	a=enabled 
+	|	a=ruleflow_group 
+	|	a=lock_on_active
+	|	a=dialect 
+	;
+	
+date_effective returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}	
+	:
+		DATE_EFFECTIVE STRING  
+		{
+			$descr = new AttributeDescr( "date-effective", getString( $STRING.text ) );
+			$descr.setLocation( offset( $DATE_EFFECTIVE.line ), $DATE_EFFECTIVE.pos );
+			$descr.setStartCharacter( ((CommonToken)$DATE_EFFECTIVE).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+
+	;
+
+date_expires returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}	
+	:	DATE_EXPIRES STRING  
+		{
+			$descr = new AttributeDescr( "date-expires", getString( $STRING.text ) );
+			$descr.setLocation( offset($DATE_EXPIRES.line), $DATE_EXPIRES.pos );
+			$descr.setStartCharacter( ((CommonToken)$DATE_EXPIRES).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+	;
+	
+enabled returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:		ENABLED BOOL   
+			{
+				$descr = new AttributeDescr( "enabled", $BOOL.text );
+				$descr.setLocation( offset($ENABLED.line), $ENABLED.pos );
+				$descr.setStartCharacter( ((CommonToken)$ENABLED).getStartIndex() );
+				$descr.setEndCharacter( ((CommonToken)$BOOL).getStopIndex() );
+			}
+	;	
+
+salience returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	
+		SALIENCE 
+		{
+			$descr = new AttributeDescr( "salience" );
+			$descr.setLocation( offset($SALIENCE.line), $SALIENCE.pos );
+			$descr.setStartCharacter( ((CommonToken)$SALIENCE).getStartIndex() );
+		}
+		( INT   
+		{
+			$descr.setValue( $INT.text );
+			$descr.setEndCharacter( ((CommonToken)$INT).getStopIndex() );
+		}
+		| txt=paren_chunk
+		{
+			$descr.setValue( $txt.text );
+			$descr.setEndCharacter( ((CommonToken)$txt.stop).getStopIndex() );
+		}
+		)
+	;
+	
+no_loop returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	NO_LOOP   
+		{
+			$descr = new AttributeDescr( "no-loop", "true" );
+			$descr.setLocation( offset($NO_LOOP.line), $NO_LOOP.pos );
+			$descr.setStartCharacter( ((CommonToken)$NO_LOOP).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$NO_LOOP).getStopIndex() );
+		}
+		( BOOL   
+			{
+				$descr.setValue( $BOOL.text );
+				$descr.setEndCharacter( ((CommonToken)$BOOL).getStopIndex() );
+			}
+		)?
+	;
+	
+auto_focus returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	AUTO_FOCUS   
+		{
+			$descr = new AttributeDescr( "auto-focus", "true" );
+			$descr.setLocation( offset($AUTO_FOCUS.line), $AUTO_FOCUS.pos );
+			$descr.setStartCharacter( ((CommonToken)$AUTO_FOCUS).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$AUTO_FOCUS).getStopIndex() );
+		}
+		( BOOL   
+			{
+				$descr.setValue( $BOOL.text );
+				$descr.setEndCharacter( ((CommonToken)$BOOL).getStopIndex() );
+			}
+		)?
+	;	
+	
+activation_group returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	ACTIVATION_GROUP STRING   
+		{
+			$descr = new AttributeDescr( "activation-group", getString( $STRING.text ) );
+			$descr.setLocation( offset($ACTIVATION_GROUP.line), $ACTIVATION_GROUP.pos );
+			$descr.setStartCharacter( ((CommonToken)$ACTIVATION_GROUP).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+	;
+
+ruleflow_group returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	RULEFLOW_GROUP STRING   
+		{
+			$descr = new AttributeDescr( "ruleflow-group", getString( $STRING.text ) );
+			$descr.setLocation( offset($RULEFLOW_GROUP.line), $RULEFLOW_GROUP.pos );
+			$descr.setStartCharacter( ((CommonToken)$RULEFLOW_GROUP).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+	;
+
+agenda_group returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	AGENDA_GROUP STRING   
+		{
+			$descr = new AttributeDescr( "agenda-group", getString( $STRING.text ) );
+			$descr.setLocation( offset($AGENDA_GROUP.line), $AGENDA_GROUP.pos );
+			$descr.setStartCharacter( ((CommonToken)$AGENDA_GROUP).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+	;
+
+duration returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	DURATION INT 
+		{
+			$descr = new AttributeDescr( "duration", $INT.text );
+			$descr.setLocation( offset($DURATION.line), $DURATION.pos );
+			$descr.setStartCharacter( ((CommonToken)$DURATION).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$INT).getStopIndex() );
+		}
+	;	
+	
+dialect returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	DIALECT STRING   
+		{
+			$descr = new AttributeDescr( "dialect", getString( $STRING.text ) );
+			$descr.setLocation( offset($DIALECT.line), $DIALECT.pos );
+			$descr.setStartCharacter( ((CommonToken)$DIALECT).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$STRING).getStopIndex() );
+		}
+	;			
+	
+lock_on_active returns [AttributeDescr descr]
+	@init {
+		$descr = null;
+	}
+	:	LOCK_ON_ACTIVE   
+		{
+			$descr = new AttributeDescr( "lock-on-active", "true" );
+			$descr.setLocation( offset($LOCK_ON_ACTIVE.line), $LOCK_ON_ACTIVE.pos );
+			$descr.setStartCharacter( ((CommonToken)$LOCK_ON_ACTIVE).getStartIndex() );
+			$descr.setEndCharacter( ((CommonToken)$LOCK_ON_ACTIVE).getStopIndex() );
+		}
+		( BOOL   
+			{
+				$descr.setValue( $BOOL.text );
+				$descr.setEndCharacter( ((CommonToken)$BOOL).getStopIndex() );
+			}
+		)?
+	;		
+
+normal_lhs_block[AndDescr descr]
+	@init {
+		location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+	}
+	:
+		(	d=lhs[$descr]
+			{ if( $d.d != null) $descr.addDescr( $d.d ); }
+		)*
+	;
+
+	
+lhs[ConditionalElementDescr ce] returns [BaseDescr d]
+	@init {
+		$d=null;
+	}
+	:	l=lhs_or { $d = $l.d; } 
+	;
+
+	
+lhs_or returns [BaseDescr d]
+	@init{
+		$d = null;
+		OrDescr or = null;
+	}
+	:	LEFT_PAREN OR 
+		{
+			or = new OrDescr();
+			$d = or;
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+		}
+		( lhsand=lhs_and 
+		{
+			or.addDescr( $lhsand.d );
+		})+
+		RIGHT_PAREN // PREFIX
+	|	
+	        left=lhs_and { $d = $left.d; }
+		( (OR|DOUBLE_PIPE)
+			{
+				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+			}
+			right=lhs_and
+			{
+				if ( or == null ) {
+					or = new OrDescr();
+					or.addDescr( $left.d );
+					$d = or;
+				}
+				
+				or.addDescr( $right.d );
+			}
+		)*
+	;
+	
+lhs_and returns [BaseDescr d]
+	@init{
+		$d = null;
+		AndDescr and = null;
+	}
+	:	LEFT_PAREN AND 
+		{
+			and = new AndDescr();
+			$d = and;
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+		}
+		(lhsunary=lhs_unary
+		{
+			and.addDescr( $lhsunary.d );
+		})+
+		RIGHT_PAREN 
+	|	
+	        left=lhs_unary { $d = $left.d; }
+		( (AND|DOUBLE_AMPER)
+			{
+				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+			}
+			right=lhs_unary
+			{
+				if ( and == null ) {
+					and = new AndDescr();
+					and.addDescr( $left.d );
+					$d = and;
+				}
+				
+				and.addDescr( $right.d );
+			}
+		)* 
+	;
+	
+lhs_unary returns [BaseDescr d]
+	@init {
+		$d = null;
+	}
+	:	(	( EXISTS ) => u=lhs_exist { $d = $u.d; }
+		|	( NOT ) => u=lhs_not  { $d = $u.d; }
+		|	( EVAL ) => u=lhs_eval  { $d = $u.d; }
+		|	( FORALL ) => u=lhs_forall  { $d = $u.d; }
+		|	( LEFT_PAREN ) => LEFT_PAREN u=lhs_or RIGHT_PAREN  { $d = $u.d; }
+		|	ps=pattern_source  { $d = (BaseDescr) $ps.d; }
+		) 
+		opt_semicolon
+	;
+	
+pattern_source returns [BaseDescr d]
+	@init {
+		$d = null;
+	}
+	:	
+		u=lhs_pattern { $d = $u.d; } 
+		(
+		        // THIS IS SIMPLY DUMB IMO, but it was the only way I could make it work... :( not sure if it is an 
+		        // ANTLR bug or if I'm doing something wrong.
+		        ( (FROM ENTRY_POINT) => FROM ep=entrypoint_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $ep.d); })
+		        |
+			FROM 
+		        {
+				location.setType(Location.LOCATION_LHS_FROM);
+				location.setProperty(Location.LOCATION_FROM_CONTENT, "");
+		        }
+		        ( options { k=1; backtrack=true;} :
+		          ( ac=accumulate_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $ac.d); })
+		          | ( tw=timewindow_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $tw.d); }) 
+		          | ( cs=collect_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $cs.d); }) 
+		          //| ( ep=entrypoint_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $ep.d); })
+		          | ( fm=from_statement { if( $d != null ) ((PatternDescr)$d).setSource((PatternSourceDescr) $fm.d); })
+		        )
+		)?
+	;
+	
+lhs_exist returns [BaseDescr d]
+	@init {
+		$d = null;
+	}
+	:	EXISTS 
+		{
+			$d = new ExistsDescr( ); 
+			$d.setLocation( offset($EXISTS.line), $EXISTS.pos );
+			$d.setStartCharacter( ((CommonToken)$EXISTS).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS );
+		}
+	        ( ( LEFT_PAREN or=lhs_or 
+	           	{ if ( $or.d != null ) ((ExistsDescr)$d).addDescr( $or.d ); }
+	           RIGHT_PAREN 
+	                { $d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() ); }
+	        )    
+	        | pattern=lhs_pattern
+	                {
+	                	if ( $pattern.d != null ) {
+	                		((ExistsDescr)$d).addDescr( $pattern.d );
+	                		$d.setEndCharacter( $pattern.d.getEndCharacter() );
+	                	}
+	                }
+	        )
+	;
+	
+lhs_not	returns [NotDescr d]
+	@init {
+		$d = null;
+	}
+	:	NOT 
+		{
+			$d = new NotDescr( ); 
+			$d.setLocation( offset($NOT.line), $NOT.pos );
+			$d.setStartCharacter( ((CommonToken)$NOT).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT );
+		}
+		( ( LEFT_PAREN or=lhs_or  
+	           	{ if ( $or.d != null ) $d.addDescr( $or.d ); }
+	           RIGHT_PAREN 
+	                { $d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() ); }
+		  )
+		| 
+		pattern=lhs_pattern
+	                {
+	                	if ( $pattern.d != null ) {
+	                		$d.addDescr( $pattern.d );
+	                		$d.setEndCharacter( $pattern.d.getEndCharacter() );
+	                	}
+	                }
+		)
+	;
+
+lhs_eval returns [BaseDescr d]
+	@init {
+		$d = new EvalDescr( );
+	}
+	:
+		EVAL 
+		{
+			location.setType( Location.LOCATION_LHS_INSIDE_EVAL );
+		}
+		c=paren_chunk
+		{ 
+			$d.setStartCharacter( ((CommonToken)$EVAL).getStartIndex() );
+		        if( $c.text != null ) {
+	  		    this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+		            String body = safeSubstring( $c.text, 1, $c.text.length()-1 );
+			    checkTrailingSemicolon( body, offset($EVAL.line) );
+			    ((EvalDescr) $d).setContent( body );
+			    location.setProperty(Location.LOCATION_EVAL_CONTENT, body);
+			}
+			if( $c.stop != null ) {
+			    $d.setEndCharacter( ((CommonToken)$c.stop).getStopIndex() );
+			}
+		}
+	;
+	
+lhs_forall returns [ForallDescr d]
+	@init {
+		$d = factory.createForall();
+	}
+	:	FORALL LEFT_PAREN base=lhs_pattern   
+		{
+			$d.setStartCharacter( ((CommonToken)$FORALL).getStartIndex() );
+		        // adding the base pattern
+		        $d.addDescr( $base.d );
+			$d.setLocation( offset($FORALL.line), $FORALL.pos );
+		}
+		( pattern=lhs_pattern
+		   {
+		        // adding additional patterns
+			$d.addDescr( $pattern.d );
+		   }
+		)*
+		RIGHT_PAREN
+		{
+		        $d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() );
+		}
+	;
+
+lhs_pattern returns [BaseDescr d]
+	@init {
+		$d=null;
+	}
+	@after {
+		$d=$f.d;
+	}
+	:	f=fact_binding	
+	|	f=fact[null]		
+	;
+
+from_statement returns [FromDescr d]
+	@init {
+		$d=factory.createFrom();
+	}
+	:
+	ds=from_source[$d]
+	{
+		$d.setDataSource( $ds.ds );
+	}
+	;
+	
+
+accumulate_statement returns [AccumulateDescr d]
+	@init {
+		$d = factory.createAccumulate();
+	} 
+	:
+	        ACCUMULATE 
+		{ 
+			$d.setLocation( offset($ACCUMULATE.line), $ACCUMULATE.pos );
+			$d.setStartCharacter( ((CommonToken)$ACCUMULATE).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE );
+		}	
+		LEFT_PAREN inputCE=lhs_or COMMA? 
+		{
+		        $d.setInput( $inputCE.d );
+		}
+		( ( 
+			INIT 
+			{
+				location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_INIT );
+			}
+			text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setInitCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_INIT_CONTENT, $d.getInitCode());
+					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_ACTION );
+				}
+			}
+			ACTION text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setActionCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_ACTION_CONTENT, $d.getActionCode());
+					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_REVERSE );
+				}
+			}
+			( REVERSE text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setReverseCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_REVERSE_CONTENT, $d.getReverseCode());
+					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_RESULT );
+				}
+			}
+			)?
+			RESULT text=paren_chunk 
+			{
+				if( $text.text != null ) {
+				        $d.setResultCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_RESULT_CONTENT, $d.getResultCode());
+				}
+			}
+		) 
+		|
+		(
+			id=ID text=paren_chunk
+			{
+				if( $id.text != null ) {
+				        $d.setExternalFunction( true );
+					$d.setFunctionIdentifier( $id.text );
+				}
+				if( $text.text != null ) {
+				        $d.setExpression( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_EXPRESSION_CONTENT, $d.getExpression());
+				}
+			}
+		)
+		)
+		RIGHT_PAREN
+		{
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+			d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() );
+		} 
+	; 
+	
+timewindow_statement returns [TimeWindowDescr d]
+	@init {
+		$d = factory.createTimeWindow();
+	} 
+	:
+	        TIMEWINDOW 
+		{ 
+			$d.setLocation( offset($TIMEWINDOW.line), $TIMEWINDOW.pos );
+			$d.setStartCharacter( ((CommonToken)$TIMEWINDOW).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW );
+		}	
+		LEFT_PAREN inputCE=lhs_or COMMA? 
+		{
+		        $d.setInput( $inputCE.d );
+		}
+		INT COMMA?
+		{
+			$d.setWindowSize( $INT.text );
+			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_WINDOWSIZE );
+		}
+		( (
+			INIT 
+			{
+				location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_INIT );
+			}
+			text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setInitCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_INIT_CONTENT, $d.getInitCode());
+					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_ACTION );
+				}
+			}
+			ACTION text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setActionCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_ACTION_CONTENT, $d.getActionCode());
+					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_REVERSE );
+				}
+			}
+			( REVERSE text=paren_chunk COMMA?
+			{
+				if( $text.text != null ) {
+				        $d.setReverseCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_REVERSE_CONTENT, $d.getReverseCode());
+					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_RESULT );
+				}
+			}
+			)?
+			RESULT text=paren_chunk 
+			{
+				if( $text.text != null ) {
+				        $d.setResultCode( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_RESULT_CONTENT, $d.getResultCode());
+				}
+			}
+		)
+		|
+		(
+			id=ID text=paren_chunk
+			{
+				if( $id.text != null ) {
+				        $d.setExternalFunction( true );
+					$d.setFunctionIdentifier( $id.text );
+				}
+				if( $text.text != null ) {
+				        $d.setExpression( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_EXPRESSION_CONTENT, $d.getExpression());
+				}
+			}
+		)
+		)
+		RIGHT_PAREN
+		{
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+			d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() );
+		} 
+	; 
+
+from_source[FromDescr from] returns [DeclarativeInvokerDescr ds]
+	@init {
+		$ds = null;
+		AccessorDescr ad = null;
+		FunctionCallDescr fc = null;
+	}
+	:	ident=identifier
+		{
+			ad = new AccessorDescr(ident.start.getText());	
+			ad.setLocation( offset(ident.start.getLine()), ident.start.getCharPositionInLine() );
+			ad.setStartCharacter( ((CommonToken)ident.start).getStartIndex() );
+			ad.setEndCharacter( ((CommonToken)ident.start).getStopIndex() );
+			$ds = ad;
+			location.setProperty(Location.LOCATION_FROM_CONTENT, ident.start.getText());
+		}
+		(	/* WARNING: $o : O() from x(y) could be also $o : O() from x followed
+			   by (y).  Resolve by always forcing (...) to be paren_chunk if
+			   after a from.  Setting k=1 will force this to happen.  No backtracking
+			   but you'll get a warning from ANTLR.  ANTLR resolves by choosing first
+			   alternative to win, which is the paren_chunk case not the loop exit.
+			*/
+			options {k=1;}
+		:	args=paren_chunk
+		{
+			if( $args.text != null ) {
+				ad.setVariableName( null );
+				fc = new FunctionCallDescr($ident.start.getText());
+				fc.setLocation( offset($ident.start.getLine()), $ident.start.getCharPositionInLine() );			
+				fc.setArguments($args.text);
+				fc.setStartCharacter( ((CommonToken)$ident.start).getStartIndex() );
+				fc.setEndCharacter( ((CommonToken)$ident.start).getStopIndex() );
+				location.setProperty(Location.LOCATION_FROM_CONTENT, $args.text);
+				$from.setEndCharacter( ((CommonToken)$args.stop).getStopIndex() );
+			}
+		}
+		)?
+		expression_chain[$from, ad]?
+	;	
+	finally {
+		if( ad != null ) {
+			if( fc != null ) {
+				ad.addFirstInvoker( fc );
+			}
+			location.setProperty(Location.LOCATION_FROM_CONTENT, ad.toString() );
+		}
+	}
+	
+expression_chain[FromDescr from, AccessorDescr as] 
+	@init {
+  		FieldAccessDescr fa = null;
+	    	MethodAccessDescr ma = null;	
+	}
+	:
+	( DOT field=identifier  
+	    {
+	        fa = new FieldAccessDescr($field.start.getText());	
+		fa.setLocation( offset($field.start.getLine()), $field.start.getCharPositionInLine() );
+		fa.setStartCharacter( ((CommonToken)$field.start).getStartIndex() );
+		fa.setEndCharacter( ((CommonToken)$field.start).getStopIndex() );
+	    }
+	  (
+	    ( LEFT_SQUARE ) => sqarg=square_chunk
+	      {
+	          fa.setArgument( $sqarg.text );	
+		  $from.setEndCharacter( ((CommonToken)$sqarg.stop).getStopIndex() );
+	      }
+	    |
+	    ( LEFT_PAREN ) => paarg=paren_chunk
+		{
+	    	  ma = new MethodAccessDescr( $field.start.getText(), $paarg.text );	
+		  ma.setLocation( offset($field.start.getLine()), $field.start.getCharPositionInLine() );
+		  ma.setStartCharacter( ((CommonToken)$field.start).getStartIndex() );
+		  $from.setEndCharacter( ((CommonToken)$paarg.stop).getStopIndex() );
+		}
+	  )?
+	  expression_chain[from, as]?
+	)  
+	;	
+	finally {
+		// must be added to the start, since it is a recursive rule
+		if( ma != null ) {
+			$as.addFirstInvoker( ma );
+		} else {
+			$as.addFirstInvoker( fa );
+		}
+	}
+	
+		
+ 		
+collect_statement returns [CollectDescr d]
+	@init {
+		$d = factory.createCollect();
+	}
+	:
+	        COLLECT 
+		{ 
+			$d.setLocation( offset($COLLECT.line), $COLLECT.pos );
+			$d.setStartCharacter( ((CommonToken)$COLLECT).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_FROM_COLLECT );
+		}	
+		LEFT_PAREN pattern=pattern_source RIGHT_PAREN
+		{
+		        $d.setInputPattern( (PatternDescr) $pattern.d );
+			$d.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() );
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+		}
+	; 		
+
+entrypoint_statement returns [EntryPointDescr d]
+	@init {
+		$d = factory.createEntryPoint();
+	}
+	:
+	        ENTRY_POINT 
+		{ 
+			$d.setLocation( offset($ENTRY_POINT.line), $ENTRY_POINT.pos );
+			$d.setStartCharacter( ((CommonToken)$ENTRY_POINT).getStartIndex() );
+			location.setType( Location.LOCATION_LHS_FROM_ENTRY_POINT );
+		}	
+		id=name
+		{
+		        $d.setEntryId( $id.name );
+			$d.setEndCharacter( ((CommonToken)$id.stop).getStopIndex() );
+			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+		}
+	; 		
+
+fact_binding returns [BaseDescr d]
+	@init {
+		$d=null;
+		OrDescr or = null;
+	}
+ 	:
+ 		ID ':' 
+ 		{
+ 		        // handling incomplete parsing
+ 		        $d = new PatternDescr( );
+ 		        ((PatternDescr) $d).setIdentifier( $ID.text );
+ 		}
+		( fe=fact[$ID.text]
+ 		{
+ 		        // override previously instantiated pattern
+ 			$d=$fe.d;
+ 			if( $d != null ) {
+   			    $d.setStartCharacter( ((CommonToken)$ID).getStartIndex() );
+   			}
+ 		}
+ 		|
+ 		LEFT_PAREN left=fact[$ID.text]
+ 		{
+ 		        // override previously instantiated pattern
+ 			$d=$left.d;
+ 			if( $d != null ) {
+   			    $d.setStartCharacter( ((CommonToken)$ID).getStartIndex() );
+   			}
+ 		}
+ 		( (OR|DOUBLE_PIPE)
+ 			right=fact[$ID.text]
+ 			{
+				if ( or == null ) {
+					or = new OrDescr();
+					or.addDescr( $left.d );
+					$d = or;
+				}
+				or.addDescr( $right.d );
+ 			}
+ 		)*
+ 		RIGHT_PAREN
+ 		)
+	;
+ 
+fact[String ident] returns [BaseDescr d] 
+	@init {
+		$d=null;
+		PatternDescr pattern = null;
+	}
+ 	:	
+ 	        {
+ 			pattern = new PatternDescr( );
+ 			if( $ident != null ) {
+ 				pattern.setIdentifier( $ident );
+ 			}
+ 			$d = pattern; 
+ 	        }
+ 	        id=qualified_id
+ 		{ 
+ 			if( id != null ) {
+	 		        pattern.setObjectType( $id.text );
+ 			        pattern.setEndCharacter( -1 );
+				pattern.setStartCharacter( ((CommonToken)$id.start).getStartIndex() );
+ 			}
+ 		}
+ 		LEFT_PAREN 
+ 		{
+		        location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START );
+            		location.setProperty( Location.LOCATION_PROPERTY_CLASS_NAME, $id.text );
+ 				
+ 			pattern.setLocation( offset($LEFT_PAREN.line), $LEFT_PAREN.pos );
+ 			pattern.setLeftParentCharacter( ((CommonToken)$LEFT_PAREN).getStartIndex() );
+ 		} 
+ 		constraints[pattern]?
+ 		RIGHT_PAREN
+		{
+		        if( ")".equals( $RIGHT_PAREN.text ) ) {
+				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+				pattern.setEndLocation( offset($RIGHT_PAREN.line), $RIGHT_PAREN.pos );	
+				pattern.setEndCharacter( ((CommonToken)$RIGHT_PAREN).getStopIndex() );
+		        	pattern.setRightParentCharacter( ((CommonToken)$RIGHT_PAREN).getStartIndex() );
+		        }
+ 		}
+ 		EOF? // this is needed for partial parsing
+ 	;
+	
+	
+constraints[PatternDescr pattern]
+	:	constraint[$pattern]
+		( COMMA { location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START ); } 
+		  constraint[$pattern] 
+		)* 
+	;
+	
+constraint[PatternDescr pattern]
+	@init {
+		ConditionalElementDescr top = null;
+		location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+		location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, input.LT(1).getText() );
+	}
+	:
+		{
+			top = $pattern.getConstraint();
+		}
+		or_constr[top]
+	;	
+	
+or_constr[ConditionalElementDescr base]
+	@init {
+		OrDescr or = new OrDescr();
+	}
+	:
+		and_constr[or] 
+		( DOUBLE_PIPE 
+		{
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+		}
+		and_constr[or] 
+		)*
+		{
+		        if( or.getDescrs().size() == 1 ) {
+		                $base.addOrMerge( (BaseDescr) or.getDescrs().get(0) );
+		        } else if ( or.getDescrs().size() > 1 ) {
+		        	$base.addDescr( or );
+		        }
+		}
+	;
+	
+and_constr[ConditionalElementDescr base]
+	@init {
+		AndDescr and = new AndDescr();
+	}
+	:
+		unary_constr[and] 
+		( DOUBLE_AMPER 
+		{
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+		}
+		unary_constr[and] 
+		)*
+		{
+		        if( and.getDescrs().size() == 1) {
+		                $base.addOrMerge( (BaseDescr) and.getDescrs().get(0) );
+		        } else if( and.getDescrs().size() > 1) {
+		        	$base.addDescr( and );
+		        }
+		}
+	;
+	
+unary_constr[ConditionalElementDescr base]
+	:
+		( field_constraint[$base] 
+		| LEFT_PAREN or_constr[$base] RIGHT_PAREN
+		| EVAL predicate[$base]
+		)
+	;	
+		
+field_constraint[ConditionalElementDescr base]
+	@init {
+		FieldBindingDescr fbd = null;
+		FieldConstraintDescr fc = null;
+		RestrictionConnectiveDescr top = null;
+	}
+	:
+	        (
+		ID ':' 
+		    { 
+			fbd = new FieldBindingDescr();
+			fbd.setIdentifier( $ID.text );
+			fbd.setLocation( offset($ID.line), $ID.pos );
+			fbd.setStartCharacter( ((CommonToken)$ID).getStartIndex() );
+			$base.addDescr( fbd );
+
+		    }
+		 
+		f=accessor_path	
+		{
+		    // use $f.start to get token matched in identifier
+		    // or use $f.text to get text.
+		    if( $f.text != null ) {
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, $f.text);
+		    
+			if ( fbd != null ) {
+			    fbd.setFieldName( $f.text );
+			    // may have been overwritten
+			    fbd.setStartCharacter( ((CommonToken)$ID).getStartIndex() );
+			} 
+			fc = new FieldConstraintDescr($f.text);
+			fc.setLocation( offset($f.start.getLine()), $f.start.getCharPositionInLine() );
+			fc.setStartCharacter( ((CommonToken)$f.start).getStartIndex() );
+			top = fc.getRestriction();
+			
+			// it must be a field constraint, as it is not a binding
+			if( $ID == null ) {
+			    $base.addDescr( fc );
+			}
+		    }
+		}
+		(
+			or_restr_connective[top]
+			{
+				// we must add now as we didn't before
+				if( $ID != null) {
+				    $base.addDescr( fc );
+				}
+			}
+		|
+			'->' predicate[$base] 
+		)?
+		) 
+		|
+		(
+		f=accessor_path	
+		{
+		    // use $f.start to get token matched in identifier
+		    // or use $f.text to get text.
+		    if( $f.text != null ) {
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, $f.text);
+		    
+			fc = new FieldConstraintDescr($f.text);
+			fc.setLocation( offset($f.start.getLine()), $f.start.getCharPositionInLine() );
+			fc.setStartCharacter( ((CommonToken)$f.start).getStartIndex() );
+			top = fc.getRestriction();
+			
+			$base.addDescr( fc );
+		    }
+		}
+		or_restr_connective[top]
+		)
+	;
+	catch[ NoViableAltException nvae ] {
+	    if( input.LT(1) != null ) {
+	                // in case of incomplete parsing, build as much as possible of the AST
+	                // so that IDE requirements can be met
+			fc = new FieldConstraintDescr( input.LT(1).getText() );
+			fc.setLocation( offset(input.LT(1).getLine()), input.LT(1).getCharPositionInLine() );
+			fc.setStartCharacter( ((CommonToken)input.LT(1)).getStartIndex() );
+			$base.addDescr( fc );
+	    }
+	    throw nvae;
+	}
+	
+
+or_restr_connective[ RestrictionConnectiveDescr base ]
+	options { 
+		backtrack=true;
+	}
+	@init {
+		RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+	}
+	:
+		and_restr_connective[or]
+		( 
+			options {backtrack=true;} : 
+			DOUBLE_PIPE 
+			{
+				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+			}
+			and_restr_connective[or] 
+		)*
+	;
+	finally {
+	        if( or.getRestrictions().size() == 1 ) {
+	                $base.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
+	        } else if ( or.getRestrictions().size() > 1 ) {
+	        	$base.addRestriction( or );
+	        }
+	}
+
+and_restr_connective[ RestrictionConnectiveDescr base ]
+	@init {
+		RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+	}
+	:
+		constraint_expression[and]
+		(	options {backtrack=true;}
+		:	t=DOUBLE_AMPER 
+			{
+				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+			}
+			constraint_expression[and] 
+		)*
+	;
+	finally {
+	        if( and.getRestrictions().size() == 1) {
+	                $base.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
+	        } else if ( and.getRestrictions().size() > 1 ) {
+	        	$base.addRestriction( and );
+	        }
+	}
+	
+constraint_expression[RestrictionConnectiveDescr base]
+        :	
+		( compound_operator[$base]
+		| simple_operator[$base] 
+		| LEFT_PAREN 
+		{
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+		}
+		or_restr_connective[$base]
+		RIGHT_PAREN
+ 		)
+	;	
+	
+simple_operator[RestrictionConnectiveDescr base]
+	@init {
+		String op = null;
+		String paramText = null;
+		boolean isNegated = false;
+	}
+	:
+		(	t='=='
+		|	t='>'
+		|	t='>='
+		|	t='<'
+		|	t='<='
+		|	t='!='
+                |       t=CONTAINS
+                |       n=NOT t=CONTAINS
+                |       t=EXCLUDES
+                |       t=MATCHES
+                |       t=SOUNDSLIKE
+                |       n=NOT t=MATCHES
+                |       t=MEMBEROF
+                |       n=NOT t=MEMBEROF
+		|	TILDE t=ID param=square_chunk?
+		|	n=NOT TILDE t=ID param=square_chunk?
+		)
+		{
+  		    location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                    location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, $t.text);
+ 	            op = $t.text;
+ 	            isNegated = $n != null;
+ 	            if( param != null ) {
+                        paramText = safeSubstring( $param.text, 1, $param.text.length()-1 );
+ 	            } 
+		}
+		rd=expression_value[$base, op, isNegated, paramText]
+	;	
+	finally {
+		if ( $rd.rd == null && op != null ) {
+		        $base.addRestriction( new LiteralRestrictionDescr(op, false, null) );
+		}
+	}
+	
+compound_operator[RestrictionConnectiveDescr base]
+	@init {
+		String op = null;
+		RestrictionConnectiveDescr group = null;
+	}
+	:
+		( IN 
+			{
+			  op = "==";
+			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+			  $base.addRestriction( group );
+  		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                    	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+			}
+		| NOT IN 
+			{
+			  op = "!=";
+			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+			  $base.addRestriction( group );
+  		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                    	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+			}	
+		)
+		LEFT_PAREN rd=expression_value[group, op, false, null]
+		( COMMA rd=expression_value[group, op, false, null]	)* 
+		RIGHT_PAREN 
+		{
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+		}
+	;
+	
+expression_value[RestrictionConnectiveDescr base, String op, boolean isNegated, String paramText] returns [RestrictionDescr rd]
+	@init {
+		$rd = null;
+	}
+	:
+		(	ap=accessor_path 
+			{ 
+			        if( $ap.text.indexOf( '.' ) > -1 || $ap.text.indexOf( '[' ) > -1) {
+					$rd = new QualifiedIdentifierRestrictionDescr($op, $isNegated, $paramText, $ap.text);
+				} else {
+					$rd = new VariableRestrictionDescr($op, $isNegated, $paramText, $ap.text);
+				}
+			}						
+		|	lc=literal_constraint 
+			{ 
+				$rd  = new LiteralRestrictionDescr($op, $isNegated, $paramText, $lc.text, $lc.type );
+			}
+		|	rvc=paren_chunk 
+			{ 
+				$rd = new ReturnValueRestrictionDescr($op, $isNegated, $paramText, safeSubstring( $rvc.text, 1, $rvc.text.length()-1) );							
+			} 
+		)	
+		{
+			if( $rd != null ) {
+				$base.addRestriction( $rd );
+			}
+			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+		}
+	;	
+	
+literal_constraint returns [String text, int type]
+	@init {
+		$text = null;
+	}
+	:	(	t=STRING { $text = getString( $t.text ); $type = LiteralRestrictionDescr.TYPE_STRING; } 
+		|	t=INT    { $text = $t.text; $type = LiteralRestrictionDescr.TYPE_NUMBER; }
+		|	t=FLOAT	 { $text = $t.text; $type = LiteralRestrictionDescr.TYPE_NUMBER; }
+		|	t=BOOL 	 { $text = $t.text; $type = LiteralRestrictionDescr.TYPE_BOOLEAN; }
+		|	t=NULL   { $text = null; $type = LiteralRestrictionDescr.TYPE_NULL; }
+		)
+	;
+	
+predicate[ConditionalElementDescr base]
+        @init {
+		PredicateDescr d = null;
+        }
+	:
+		text=paren_chunk
+		{
+		        if( $text.text != null ) {
+				d = new PredicateDescr( );
+			        d.setContent( safeSubstring( $text.text, 1, $text.text.length()-1 ) );
+				d.setEndCharacter( ((CommonToken)$text.stop).getStopIndex() );
+				$base.addDescr( d );
+		        }
+		}
+	;
+
+
+curly_chunk
+	:
+		LEFT_CURLY ( ~(LEFT_CURLY|RIGHT_CURLY) | curly_chunk )* RIGHT_CURLY
+	;
+	
+paren_chunk
+	:
+		LEFT_PAREN ( ~(LEFT_PAREN|RIGHT_PAREN) | paren_chunk )* RIGHT_PAREN
+	;
+
+square_chunk
+	:
+		LEFT_SQUARE ( ~(LEFT_SQUARE|RIGHT_SQUARE) | square_chunk )* RIGHT_SQUARE
+	;
+	
+qualified_id returns [ String text ]
+	@init {
+	        StringBuffer buf = new StringBuffer();
+	}
+	@after {
+	        $text = buf != null ? buf.toString() : "";
+	}
+	: 	ID {buf.append($ID.text);} ( DOT identifier {buf.append("."+$identifier.text);} )* ( LEFT_SQUARE RIGHT_SQUARE {buf.append("[]");})*
+	;
+	
+dotted_name returns [ String text ]
+	@init {
+	        StringBuffer buf = new StringBuffer();
+	}
+	@after {
+	        $text = buf != null ? buf.toString() : "";
+	}
+	:	i=identifier {buf.append($i.text);} ( DOT i=identifier {buf.append("."+$i.text);} )* ( LEFT_SQUARE RIGHT_SQUARE {buf.append("[]");})*
+	;
+	
+accessor_path returns [ String text ]
+	@init {
+	        StringBuffer buf = new StringBuffer();
+	}
+	@after {
+	        $text = buf != null ? buf.toString() : "";
+	}
+	:	a=accessor_element {buf.append($a.text);} ( DOT a=accessor_element {buf.append("."+$a.text);} )* 
+	;
+	
+accessor_element returns [ String text ]
+	@init {
+	        StringBuffer buf = new StringBuffer();
+	}
+	@after {
+	        $text = buf != null ? buf.toString() : "";
+	}
+	:
+		i=identifier {buf.append($i.text);} (s=square_chunk {buf.append($s.text);} )*
+	;	
+	
+rhs_chunk[RuleDescr rule]
+	:
+		THEN { location.setType( Location.LOCATION_RHS ); }
+		( ~END )*
+                loc=END opt_semicolon
+                {
+                    // ignoring first line in the consequence
+                    String buf = input.toString( $THEN, $loc );
+                    // removing final END keyword
+                    int idx=4;
+                    while( idx < buf.length()-3 && (buf.charAt(idx) == ' ' || buf.charAt(idx) == '\t') ) {
+                        idx++;
+                    }
+                    if( idx < buf.length()-3 && buf.charAt(idx) == '\r' ) idx++;
+                    if( idx < buf.length()-3 && buf.charAt(idx) == '\n' ) idx++;
+                    buf = safeSubstring( buf, idx, buf.length()-3 );
+		    $rule.setConsequence( buf );
+     		    $rule.setConsequenceLocation(offset($THEN.line), $THEN.pos);
+ 		    $rule.setEndCharacter( ((CommonToken)$loc).getStopIndex() );
+ 		    location.setProperty( Location.LOCATION_RHS_CONTENT, $rule.getConsequence() );
+                }
+	;
+
+name returns [String name]
+	: 	ID { $name = $ID.text; }
+	| 	STRING { $name = getString( $STRING.text ); }
+	;
+	
+identifier
+	:       ID      
+	|	PACKAGE
+	|	FUNCTION
+	|	GLOBAL
+	|	IMPORT  
+	|	EVENT
+	|	RULE
+	|	QUERY 
+        |       TEMPLATE        
+        |       ATTRIBUTES      
+        |       ENABLED         
+        |       SALIENCE 	
+        |       DURATION 
+        |	DIALECT	
+        |       FROM	        
+        |       INIT	        
+        |       ACTION	        
+        |       REVERSE	        
+        |       RESULT	        
+        |       CONTAINS 
+        |       EXCLUDES 
+        |       MEMBEROF
+        |       MATCHES 
+        |       SOUNDSLIKE        
+        |       WHEN            
+        |       THEN	        
+        |       END     
+        |	IN        
+	;
+	
+WS      :       (	' '
+                |	'\t'
+                |	'\f'
+                |	EOL
+                )+
+                { $channel=HIDDEN; }
+        ;
+
+fragment
+EOL 	:	     
+   		(       ( '\r\n' )=> '\r\n'  // Evil DOS
+                |       '\r'    // Macintosh
+                |       '\n'    // Unix (the right way)
+                )
+        ;  
+        
+INT	
+	:	('-')?('0'..'9')+
+		;
+
+FLOAT
+	:	('-')?('0'..'9')+ '.' ('0'..'9')+
+	;
+
+STRING
+    :  ('"' ( EscapeSequence | ~('\\'|'"') )* '"')
+     | ('\'' ( EscapeSequence | ~('\\'|'\'') )* '\'')
+    ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+EscapeSequence
+    :   '\\' ('b'|'B'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\'|'.'|'o'|
+              'x'|'a'|'e'|'c'|'d'|'D'|'s'|'S'|'w'|'W'|'p'|'A'|
+              'G'|'Z'|'z'|'Q'|'E'|'*'|'['|']'|'('|')'|'$'|'^'|
+              '{'|'}'|'?'|'+'|'-'|'&'|'|')
+    |   UnicodeEscape
+    |   OctalEscape
+    ;
+
+fragment
+OctalEscape
+    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7')
+    ;
+
+fragment
+UnicodeEscape
+    :   '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+    ;
+
+BOOL
+	:	('true'|'false') 
+	;	
+
+PACKAGE	:	'package';
+
+IMPORT	:	'import';
+
+FUNCTION :	'function';
+
+EVENT :		'event';
+
+GLOBAL	:	'global';
+	
+DECLARE	:	'declare';
+
+RULE    :	'rule';
+
+QUERY	:	'query';
+
+TEMPLATE :	'template';
+
+ATTRIBUTES :	'attributes';
+	
+DATE_EFFECTIVE 
+	:	'date-effective';
+
+DATE_EXPIRES 
+	:	'date-expires';	
+	
+ENABLED :	'enabled';
+
+SALIENCE 
+	:	'salience';
+	
+NO_LOOP :	'no-loop';
+
+AUTO_FOCUS 
+	:	'auto-focus';
+	
+ACTIVATION_GROUP 
+	:	'activation-group';
+	
+AGENDA_GROUP 
+	:	'agenda-group';
+	
+DIALECT 
+	:	'dialect';	
+	
+RULEFLOW_GROUP 
+	:	'ruleflow-group';
+	
+DURATION 
+	:	'duration';
+	
+LOCK_ON_ACTIVE
+	:	'lock-on-active';	
+	
+FROM	:	'from';
+
+ACCUMULATE 
+	:	'accumulate';
+TIMEWINDOW 
+	:	'timewindow';
+	
+INIT	:	'init';
+
+ACTION	:	'action';
+
+REVERSE	:	'reverse';
+
+RESULT	:	'result';
+
+COLLECT :	'collect';
+
+ENTRY_POINT :	'entry-point';
+
+OR	:	'or';
+
+AND	:	'and';
+
+CONTAINS 
+       :       'contains';
+
+EXCLUDES 
+       :       'excludes';
+
+MEMBEROF
+       :       'memberOf';
+
+MATCHES :      'matches';
+
+SOUNDSLIKE :   'soundslike';
+
+IN	:	'in';
+
+NULL	:	'null';
+
+EXISTS	:	'exists';
+
+NOT	:	'not';
+
+EVAL	:	'eval';
+
+FORALL	:	'forall';							
+
+WHEN    :	'when'; 
+
+THEN	:    	'then';
+
+END     :	'end';
+
+ID	
+	:	('a'..'z'|'A'..'Z'|'_'|'$'|'\u00c0'..'\u00ff')('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\u00c0'..'\u00ff')* 
+	;
+		
+LEFT_PAREN
+        :	'('
+        ;
+
+RIGHT_PAREN
+        :	')'
+        ;
+        
+LEFT_SQUARE
+        :	'['
+        ;
+
+RIGHT_SQUARE
+        :	']'
+        ;        
+
+LEFT_CURLY
+        :	'{'
+        ;
+
+RIGHT_CURLY
+        :	'}'
+        ;
+        
+COMMA	:	','
+	;
+	
+DOT	:	'.'
+	;	
+	
+DOUBLE_AMPER
+	:	'&&'
+	;
+	
+DOUBLE_PIPE
+	:	'||'
+	;				
+	
+TILDE	:	'~';	
+	
+SH_STYLE_SINGLE_LINE_COMMENT	
+	:	'#' ( options{greedy=false;} : .)* EOL /* ('\r')? '\n'  */
+                { $channel=HIDDEN; setText("//"+getText().substring(1));}
+	;
+        
+        
+C_STYLE_SINGLE_LINE_COMMENT	
+	:	'//' ( options{greedy=false;} : .)* EOL // ('\r')? '\n' 
+                { $channel=HIDDEN; }
+	;
+
+MULTI_LINE_COMMENT
+	:	'/*' (options{greedy=false;} : .)* '*/'
+                { $channel=HIDDEN; }
+	;
+
+MISC 	:
+		'!' | '@' | '$' | '%' | '^' | '*' | '_' | '-' | '+'  | '?' | '=' | '/' | '\'' | '\\' | '|' | '&'
+	;
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLLexer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLLexer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLLexer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3549 @@
+// $ANTLR 3.0.1 C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g 2008-03-12 13:23:57
+
+	package org.drools.lang;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+public class DRLLexer extends Lexer {
+    public static final int ACCUMULATE=46;
+    public static final int PACKAGE=4;
+    public static final int FUNCTION=6;
+    public static final int RIGHT_SQUARE=64;
+    public static final int T79=79;
+    public static final int ACTIVATION_GROUP=31;
+    public static final int T77=77;
+    public static final int ATTRIBUTES=22;
+    public static final int RIGHT_CURLY=15;
+    public static final int T78=78;
+    public static final int DIALECT=35;
+    public static final int CONTAINS=54;
+    public static final int NO_LOOP=29;
+    public static final int LOCK_ON_ACTIVE=36;
+    public static final int MEMBEROF=58;
+    public static final int AGENDA_GROUP=33;
+    public static final int FLOAT=61;
+    public static final int NOT=43;
+    public static final int SH_STYLE_SINGLE_LINE_COMMENT=73;
+    public static final int ID=7;
+    public static final int AND=39;
+    public static final int EOF=-1;
+    public static final int HexDigit=70;
+    public static final int DATE_EFFECTIVE=23;
+    public static final int ACTION=48;
+    public static final int DOUBLE_PIPE=38;
+    public static final int RIGHT_PAREN=12;
+    public static final int IMPORT=5;
+    public static final int EOL=67;
+    public static final int DOUBLE_AMPER=40;
+    public static final int THEN=65;
+    public static final int IN=60;
+    public static final int MATCHES=56;
+    public static final int COMMA=11;
+    public static final int TILDE=59;
+    public static final int ENABLED=25;
+    public static final int EXISTS=42;
+    public static final int DOT=8;
+    public static final int RULE=20;
+    public static final int TIMEWINDOW=51;
+    public static final int EXCLUDES=55;
+    public static final int AUTO_FOCUS=30;
+    public static final int NULL=62;
+    public static final int SOUNDSLIKE=57;
+    public static final int BOOL=26;
+    public static final int FORALL=45;
+    public static final int RULEFLOW_GROUP=32;
+    public static final int SALIENCE=27;
+    public static final int RESULT=50;
+    public static final int INT=28;
+    public static final int EVENT=66;
+    public static final int Tokens=87;
+    public static final int MULTI_LINE_COMMENT=75;
+    public static final int DURATION=34;
+    public static final int T84=84;
+    public static final int WS=68;
+    public static final int T85=85;
+    public static final int T86=86;
+    public static final int TEMPLATE=19;
+    public static final int EVAL=44;
+    public static final int WHEN=21;
+    public static final int ENTRY_POINT=53;
+    public static final int UnicodeEscape=71;
+    public static final int LEFT_CURLY=14;
+    public static final int OR=37;
+    public static final int LEFT_PAREN=10;
+    public static final int DECLARE=13;
+    public static final int QUERY=17;
+    public static final int T81=81;
+    public static final int FROM=41;
+    public static final int GLOBAL=9;
+    public static final int END=18;
+    public static final int REVERSE=49;
+    public static final int MISC=76;
+    public static final int T80=80;
+    public static final int COLLECT=52;
+    public static final int T83=83;
+    public static final int INIT=47;
+    public static final int LEFT_SQUARE=63;
+    public static final int T82=82;
+    public static final int EscapeSequence=69;
+    public static final int OctalEscape=72;
+    public static final int C_STYLE_SINGLE_LINE_COMMENT=74;
+    public static final int DATE_EXPIRES=24;
+    public static final int STRING=16;
+    public DRLLexer() {;} 
+    public DRLLexer(CharStream input) {
+        super(input);
+        ruleMemo = new HashMap[85+1];
+     }
+    public String getGrammarFileName() { return "C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g"; }
+
+    // $ANTLR start T77
+    public final void mT77() throws RecognitionException {
+        try {
+            int _type = T77;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:6:5: ( ';' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:6:7: ';'
+            {
+            match(';'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T77
+
+    // $ANTLR start T78
+    public final void mT78() throws RecognitionException {
+        try {
+            int _type = T78;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:7:5: ( '.*' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:7:7: '.*'
+            {
+            match(".*"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T78
+
+    // $ANTLR start T79
+    public final void mT79() throws RecognitionException {
+        try {
+            int _type = T79;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:8:5: ( ':' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:8:7: ':'
+            {
+            match(':'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T79
+
+    // $ANTLR start T80
+    public final void mT80() throws RecognitionException {
+        try {
+            int _type = T80;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:9:5: ( '->' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:9:7: '->'
+            {
+            match("->"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T80
+
+    // $ANTLR start T81
+    public final void mT81() throws RecognitionException {
+        try {
+            int _type = T81;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:10:5: ( '==' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:10:7: '=='
+            {
+            match("=="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T81
+
+    // $ANTLR start T82
+    public final void mT82() throws RecognitionException {
+        try {
+            int _type = T82;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:11:5: ( '>' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:11:7: '>'
+            {
+            match('>'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T82
+
+    // $ANTLR start T83
+    public final void mT83() throws RecognitionException {
+        try {
+            int _type = T83;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:12:5: ( '>=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:12:7: '>='
+            {
+            match(">="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T83
+
+    // $ANTLR start T84
+    public final void mT84() throws RecognitionException {
+        try {
+            int _type = T84;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:13:5: ( '<' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:13:7: '<'
+            {
+            match('<'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T84
+
+    // $ANTLR start T85
+    public final void mT85() throws RecognitionException {
+        try {
+            int _type = T85;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:14:5: ( '<=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:14:7: '<='
+            {
+            match("<="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T85
+
+    // $ANTLR start T86
+    public final void mT86() throws RecognitionException {
+        try {
+            int _type = T86;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:15:5: ( '!=' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:15:7: '!='
+            {
+            match("!="); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end T86
+
+    // $ANTLR start WS
+    public final void mWS() throws RecognitionException {
+        try {
+            int _type = WS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:9: ( ( ' ' | '\\t' | '\\f' | EOL )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:17: ( ' ' | '\\t' | '\\f' | EOL )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:17: ( ' ' | '\\t' | '\\f' | EOL )+
+            int cnt1=0;
+            loop1:
+            do {
+                int alt1=5;
+                switch ( input.LA(1) ) {
+                case ' ':
+                    {
+                    alt1=1;
+                    }
+                    break;
+                case '\t':
+                    {
+                    alt1=2;
+                    }
+                    break;
+                case '\f':
+                    {
+                    alt1=3;
+                    }
+                    break;
+                case '\n':
+                case '\r':
+                    {
+                    alt1=4;
+                    }
+                    break;
+
+                }
+
+                switch (alt1) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1821:19: ' '
+            	    {
+            	    match(' '); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1822:19: '\\t'
+            	    {
+            	    match('\t'); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 3 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1823:19: '\\f'
+            	    {
+            	    match('\f'); if (failed) return ;
+
+            	    }
+            	    break;
+            	case 4 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1824:19: EOL
+            	    {
+            	    mEOL(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt1 >= 1 ) break loop1;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(1, input);
+                        throw eee;
+                }
+                cnt1++;
+            } while (true);
+
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end WS
+
+    // $ANTLR start EOL
+    public final void mEOL() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1830:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            int alt2=3;
+            int LA2_0 = input.LA(1);
+
+            if ( (LA2_0=='\r') ) {
+                int LA2_1 = input.LA(2);
+
+                if ( (LA2_1=='\n') && (synpred1())) {
+                    alt2=1;
+                }
+                else {
+                    alt2=2;}
+            }
+            else if ( (LA2_0=='\n') ) {
+                alt2=3;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1831:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+
+                throw nvae;
+            }
+            switch (alt2) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:14: ( '\\r\\n' )=> '\\r\\n'
+                    {
+                    match("\r\n"); if (failed) return ;
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1832:25: '\\r'
+                    {
+                    match('\r'); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1833:25: '\\n'
+                    {
+                    match('\n'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EOL
+
+    // $ANTLR start INT
+    public final void mINT() throws RecognitionException {
+        try {
+            int _type = INT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:2: ( ( '-' )? ( '0' .. '9' )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:4: ( '-' )? ( '0' .. '9' )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:4: ( '-' )?
+            int alt3=2;
+            int LA3_0 = input.LA(1);
+
+            if ( (LA3_0=='-') ) {
+                alt3=1;
+            }
+            switch (alt3) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:5: '-'
+                    {
+                    match('-'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:10: ( '0' .. '9' )+
+            int cnt4=0;
+            loop4:
+            do {
+                int alt4=2;
+                int LA4_0 = input.LA(1);
+
+                if ( ((LA4_0>='0' && LA4_0<='9')) ) {
+                    alt4=1;
+                }
+
+
+                switch (alt4) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1838:11: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt4 >= 1 ) break loop4;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(4, input);
+                        throw eee;
+                }
+                cnt4++;
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end INT
+
+    // $ANTLR start FLOAT
+    public final void mFLOAT() throws RecognitionException {
+        try {
+            int _type = FLOAT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:4: ( '-' )?
+            int alt5=2;
+            int LA5_0 = input.LA(1);
+
+            if ( (LA5_0=='-') ) {
+                alt5=1;
+            }
+            switch (alt5) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:5: '-'
+                    {
+                    match('-'); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:10: ( '0' .. '9' )+
+            int cnt6=0;
+            loop6:
+            do {
+                int alt6=2;
+                int LA6_0 = input.LA(1);
+
+                if ( ((LA6_0>='0' && LA6_0<='9')) ) {
+                    alt6=1;
+                }
+
+
+                switch (alt6) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:11: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt6 >= 1 ) break loop6;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(6, input);
+                        throw eee;
+                }
+                cnt6++;
+            } while (true);
+
+            match('.'); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:26: ( '0' .. '9' )+
+            int cnt7=0;
+            loop7:
+            do {
+                int alt7=2;
+                int LA7_0 = input.LA(1);
+
+                if ( ((LA7_0>='0' && LA7_0<='9')) ) {
+                    alt7=1;
+                }
+
+
+                switch (alt7) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1842:27: '0' .. '9'
+            	    {
+            	    matchRange('0','9'); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt7 >= 1 ) break loop7;
+            	    if (backtracking>0) {failed=true; return ;}
+                        EarlyExitException eee =
+                            new EarlyExitException(7, input);
+                        throw eee;
+                }
+                cnt7++;
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FLOAT
+
+    // $ANTLR start STRING
+    public final void mSTRING() throws RecognitionException {
+        try {
+            int _type = STRING;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
+            int alt10=2;
+            int LA10_0 = input.LA(1);
+
+            if ( (LA10_0=='\"') ) {
+                alt10=1;
+            }
+            else if ( (LA10_0=='\'') ) {
+                alt10=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1845:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
+
+                throw nvae;
+            }
+            switch (alt10) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+                    {
+                    match('\"'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+                    loop8:
+                    do {
+                        int alt8=3;
+                        int LA8_0 = input.LA(1);
+
+                        if ( (LA8_0=='\\') ) {
+                            alt8=1;
+                        }
+                        else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFE')) ) {
+                            alt8=2;
+                        }
+
+
+                        switch (alt8) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:15: EscapeSequence
+                    	    {
+                    	    mEscapeSequence(); if (failed) return ;
+
+                    	    }
+                    	    break;
+                    	case 2 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1846:32: ~ ( '\\\\' | '\"' )
+                    	    {
+                    	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+                    	        input.consume();
+                    	    failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return ;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recover(mse);    throw mse;
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop8;
+                        }
+                    } while (true);
+
+                    match('\"'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
+                    {
+                    match('\''); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
+                    loop9:
+                    do {
+                        int alt9=3;
+                        int LA9_0 = input.LA(1);
+
+                        if ( (LA9_0=='\\') ) {
+                            alt9=1;
+                        }
+                        else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFE')) ) {
+                            alt9=2;
+                        }
+
+
+                        switch (alt9) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:16: EscapeSequence
+                    	    {
+                    	    mEscapeSequence(); if (failed) return ;
+
+                    	    }
+                    	    break;
+                    	case 2 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1847:33: ~ ( '\\\\' | '\\'' )
+                    	    {
+                    	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+                    	        input.consume();
+                    	    failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return ;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recover(mse);    throw mse;
+                    	    }
+
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop9;
+                        }
+                    } while (true);
+
+                    match('\''); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end STRING
+
+    // $ANTLR start HexDigit
+    public final void mHexDigit() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1851:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1851:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+            {
+            if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end HexDigit
+
+    // $ANTLR start EscapeSequence
+    public final void mEscapeSequence() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1855:5: ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape )
+            int alt11=3;
+            int LA11_0 = input.LA(1);
+
+            if ( (LA11_0=='\\') ) {
+                switch ( input.LA(2) ) {
+                case '\"':
+                case '$':
+                case '&':
+                case '\'':
+                case '(':
+                case ')':
+                case '*':
+                case '+':
+                case '-':
+                case '.':
+                case '?':
+                case 'A':
+                case 'B':
+                case 'D':
+                case 'E':
+                case 'G':
+                case 'Q':
+                case 'S':
+                case 'W':
+                case 'Z':
+                case '[':
+                case '\\':
+                case ']':
+                case '^':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                case 'n':
+                case 'o':
+                case 'p':
+                case 'r':
+                case 's':
+                case 't':
+                case 'w':
+                case 'x':
+                case 'z':
+                case '{':
+                case '|':
+                case '}':
+                    {
+                    alt11=1;
+                    }
+                    break;
+                case 'u':
+                    {
+                    alt11=2;
+                    }
+                    break;
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                    {
+                    alt11=3;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1853:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
+
+                    throw nvae;
+                }
+
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1853:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
+
+                throw nvae;
+            }
+            switch (alt11) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1855:9: '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' )
+                    {
+                    match('\\'); if (failed) return ;
+                    if ( input.LA(1)=='\"'||input.LA(1)=='$'||(input.LA(1)>='&' && input.LA(1)<='+')||(input.LA(1)>='-' && input.LA(1)<='.')||input.LA(1)=='?'||(input.LA(1)>='A' && input.LA(1)<='B')||(input.LA(1)>='D' && input.LA(1)<='E')||input.LA(1)=='G'||input.LA(1)=='Q'||input.LA(1)=='S'||input.LA(1)=='W'||(input.LA(1)>='Z' && input.LA(1)<='^')||(input.LA(1)>='a' && input.LA(1)<='f')||(input.LA(1)>='n' && input.LA(1)<='p')||(input.LA(1)>='r' && input.LA(1)<='t')||(input.LA(1)>='w' && input.LA(1)<='x')||(input.LA(1)>='z' && input.LA(1)<='}') ) {
+                        input.consume();
+                    failed=false;
+                    }
+                    else {
+                        if (backtracking>0) {failed=true; return ;}
+                        MismatchedSetException mse =
+                            new MismatchedSetException(null,input);
+                        recover(mse);    throw mse;
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1859:9: UnicodeEscape
+                    {
+                    mUnicodeEscape(); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1860:9: OctalEscape
+                    {
+                    mOctalEscape(); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EscapeSequence
+
+    // $ANTLR start OctalEscape
+    public final void mOctalEscape() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+            int alt12=3;
+            int LA12_0 = input.LA(1);
+
+            if ( (LA12_0=='\\') ) {
+                int LA12_1 = input.LA(2);
+
+                if ( ((LA12_1>='0' && LA12_1<='3')) ) {
+                    int LA12_2 = input.LA(3);
+
+                    if ( ((LA12_2>='0' && LA12_2<='7')) ) {
+                        int LA12_5 = input.LA(4);
+
+                        if ( ((LA12_5>='0' && LA12_5<='7')) ) {
+                            alt12=1;
+                        }
+                        else {
+                            alt12=2;}
+                    }
+                    else {
+                        alt12=3;}
+                }
+                else if ( ((LA12_1>='4' && LA12_1<='7')) ) {
+                    int LA12_3 = input.LA(3);
+
+                    if ( ((LA12_3>='0' && LA12_3<='7')) ) {
+                        alt12=2;
+                    }
+                    else {
+                        alt12=3;}
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1863:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1863:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
+
+                throw nvae;
+            }
+            switch (alt12) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:14: ( '0' .. '3' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:15: '0' .. '3'
+                    {
+                    matchRange('0','3'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:25: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:36: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1865:37: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:14: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:25: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1866:26: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:9: '\\\\' ( '0' .. '7' )
+                    {
+                    match('\\'); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:14: ( '0' .. '7' )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1867:15: '0' .. '7'
+                    {
+                    matchRange('0','7'); if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OctalEscape
+
+    // $ANTLR start UnicodeEscape
+    public final void mUnicodeEscape() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1872:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1872:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+            {
+            match('\\'); if (failed) return ;
+            match('u'); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+            mHexDigit(); if (failed) return ;
+
+            }
+
+        }
+        finally {
+        }
+    }
+    // $ANTLR end UnicodeEscape
+
+    // $ANTLR start BOOL
+    public final void mBOOL() throws RecognitionException {
+        try {
+            int _type = BOOL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:2: ( ( 'true' | 'false' ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:4: ( 'true' | 'false' )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:4: ( 'true' | 'false' )
+            int alt13=2;
+            int LA13_0 = input.LA(1);
+
+            if ( (LA13_0=='t') ) {
+                alt13=1;
+            }
+            else if ( (LA13_0=='f') ) {
+                alt13=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1876:4: ( 'true' | 'false' )", 13, 0, input);
+
+                throw nvae;
+            }
+            switch (alt13) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:5: 'true'
+                    {
+                    match("true"); if (failed) return ;
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1876:12: 'false'
+                    {
+                    match("false"); if (failed) return ;
+
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end BOOL
+
+    // $ANTLR start PACKAGE
+    public final void mPACKAGE() throws RecognitionException {
+        try {
+            int _type = PACKAGE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1879:9: ( 'package' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1879:11: 'package'
+            {
+            match("package"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end PACKAGE
+
+    // $ANTLR start IMPORT
+    public final void mIMPORT() throws RecognitionException {
+        try {
+            int _type = IMPORT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1881:8: ( 'import' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1881:10: 'import'
+            {
+            match("import"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end IMPORT
+
+    // $ANTLR start FUNCTION
+    public final void mFUNCTION() throws RecognitionException {
+        try {
+            int _type = FUNCTION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1883:10: ( 'function' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1883:12: 'function'
+            {
+            match("function"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FUNCTION
+
+    // $ANTLR start EVENT
+    public final void mEVENT() throws RecognitionException {
+        try {
+            int _type = EVENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1885:7: ( 'event' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1885:10: 'event'
+            {
+            match("event"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EVENT
+
+    // $ANTLR start GLOBAL
+    public final void mGLOBAL() throws RecognitionException {
+        try {
+            int _type = GLOBAL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1887:8: ( 'global' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1887:10: 'global'
+            {
+            match("global"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end GLOBAL
+
+    // $ANTLR start DECLARE
+    public final void mDECLARE() throws RecognitionException {
+        try {
+            int _type = DECLARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1889:9: ( 'declare' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1889:11: 'declare'
+            {
+            match("declare"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DECLARE
+
+    // $ANTLR start RULE
+    public final void mRULE() throws RecognitionException {
+        try {
+            int _type = RULE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1891:9: ( 'rule' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1891:11: 'rule'
+            {
+            match("rule"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RULE
+
+    // $ANTLR start QUERY
+    public final void mQUERY() throws RecognitionException {
+        try {
+            int _type = QUERY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1893:7: ( 'query' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1893:9: 'query'
+            {
+            match("query"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end QUERY
+
+    // $ANTLR start TEMPLATE
+    public final void mTEMPLATE() throws RecognitionException {
+        try {
+            int _type = TEMPLATE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1895:10: ( 'template' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1895:12: 'template'
+            {
+            match("template"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TEMPLATE
+
+    // $ANTLR start ATTRIBUTES
+    public final void mATTRIBUTES() throws RecognitionException {
+        try {
+            int _type = ATTRIBUTES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1897:12: ( 'attributes' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1897:14: 'attributes'
+            {
+            match("attributes"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ATTRIBUTES
+
+    // $ANTLR start DATE_EFFECTIVE
+    public final void mDATE_EFFECTIVE() throws RecognitionException {
+        try {
+            int _type = DATE_EFFECTIVE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1900:2: ( 'date-effective' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1900:4: 'date-effective'
+            {
+            match("date-effective"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DATE_EFFECTIVE
+
+    // $ANTLR start DATE_EXPIRES
+    public final void mDATE_EXPIRES() throws RecognitionException {
+        try {
+            int _type = DATE_EXPIRES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1903:2: ( 'date-expires' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1903:4: 'date-expires'
+            {
+            match("date-expires"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DATE_EXPIRES
+
+    // $ANTLR start ENABLED
+    public final void mENABLED() throws RecognitionException {
+        try {
+            int _type = ENABLED;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1905:9: ( 'enabled' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1905:11: 'enabled'
+            {
+            match("enabled"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ENABLED
+
+    // $ANTLR start SALIENCE
+    public final void mSALIENCE() throws RecognitionException {
+        try {
+            int _type = SALIENCE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1908:2: ( 'salience' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1908:4: 'salience'
+            {
+            match("salience"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SALIENCE
+
+    // $ANTLR start NO_LOOP
+    public final void mNO_LOOP() throws RecognitionException {
+        try {
+            int _type = NO_LOOP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1910:9: ( 'no-loop' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1910:11: 'no-loop'
+            {
+            match("no-loop"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NO_LOOP
+
+    // $ANTLR start AUTO_FOCUS
+    public final void mAUTO_FOCUS() throws RecognitionException {
+        try {
+            int _type = AUTO_FOCUS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1913:2: ( 'auto-focus' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1913:4: 'auto-focus'
+            {
+            match("auto-focus"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AUTO_FOCUS
+
+    // $ANTLR start ACTIVATION_GROUP
+    public final void mACTIVATION_GROUP() throws RecognitionException {
+        try {
+            int _type = ACTIVATION_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1916:2: ( 'activation-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1916:4: 'activation-group'
+            {
+            match("activation-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACTIVATION_GROUP
+
+    // $ANTLR start AGENDA_GROUP
+    public final void mAGENDA_GROUP() throws RecognitionException {
+        try {
+            int _type = AGENDA_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1919:2: ( 'agenda-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1919:4: 'agenda-group'
+            {
+            match("agenda-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AGENDA_GROUP
+
+    // $ANTLR start DIALECT
+    public final void mDIALECT() throws RecognitionException {
+        try {
+            int _type = DIALECT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1922:2: ( 'dialect' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1922:4: 'dialect'
+            {
+            match("dialect"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DIALECT
+
+    // $ANTLR start RULEFLOW_GROUP
+    public final void mRULEFLOW_GROUP() throws RecognitionException {
+        try {
+            int _type = RULEFLOW_GROUP;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1925:2: ( 'ruleflow-group' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1925:4: 'ruleflow-group'
+            {
+            match("ruleflow-group"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RULEFLOW_GROUP
+
+    // $ANTLR start DURATION
+    public final void mDURATION() throws RecognitionException {
+        try {
+            int _type = DURATION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1928:2: ( 'duration' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1928:4: 'duration'
+            {
+            match("duration"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DURATION
+
+    // $ANTLR start LOCK_ON_ACTIVE
+    public final void mLOCK_ON_ACTIVE() throws RecognitionException {
+        try {
+            int _type = LOCK_ON_ACTIVE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1931:2: ( 'lock-on-active' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1931:4: 'lock-on-active'
+            {
+            match("lock-on-active"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LOCK_ON_ACTIVE
+
+    // $ANTLR start FROM
+    public final void mFROM() throws RecognitionException {
+        try {
+            int _type = FROM;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1933:6: ( 'from' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1933:8: 'from'
+            {
+            match("from"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FROM
+
+    // $ANTLR start ACCUMULATE
+    public final void mACCUMULATE() throws RecognitionException {
+        try {
+            int _type = ACCUMULATE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1936:2: ( 'accumulate' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1936:4: 'accumulate'
+            {
+            match("accumulate"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACCUMULATE
+
+    // $ANTLR start TIMEWINDOW
+    public final void mTIMEWINDOW() throws RecognitionException {
+        try {
+            int _type = TIMEWINDOW;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1938:2: ( 'timewindow' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1938:4: 'timewindow'
+            {
+            match("timewindow"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TIMEWINDOW
+
+    // $ANTLR start INIT
+    public final void mINIT() throws RecognitionException {
+        try {
+            int _type = INIT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1940:6: ( 'init' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1940:8: 'init'
+            {
+            match("init"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end INIT
+
+    // $ANTLR start ACTION
+    public final void mACTION() throws RecognitionException {
+        try {
+            int _type = ACTION;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1942:8: ( 'action' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1942:10: 'action'
+            {
+            match("action"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ACTION
+
+    // $ANTLR start REVERSE
+    public final void mREVERSE() throws RecognitionException {
+        try {
+            int _type = REVERSE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1944:9: ( 'reverse' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1944:11: 'reverse'
+            {
+            match("reverse"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end REVERSE
+
+    // $ANTLR start RESULT
+    public final void mRESULT() throws RecognitionException {
+        try {
+            int _type = RESULT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1946:8: ( 'result' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1946:10: 'result'
+            {
+            match("result"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RESULT
+
+    // $ANTLR start COLLECT
+    public final void mCOLLECT() throws RecognitionException {
+        try {
+            int _type = COLLECT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1948:9: ( 'collect' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1948:11: 'collect'
+            {
+            match("collect"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end COLLECT
+
+    // $ANTLR start ENTRY_POINT
+    public final void mENTRY_POINT() throws RecognitionException {
+        try {
+            int _type = ENTRY_POINT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1950:13: ( 'entry-point' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1950:15: 'entry-point'
+            {
+            match("entry-point"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ENTRY_POINT
+
+    // $ANTLR start OR
+    public final void mOR() throws RecognitionException {
+        try {
+            int _type = OR;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1952:4: ( 'or' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1952:6: 'or'
+            {
+            match("or"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end OR
+
+    // $ANTLR start AND
+    public final void mAND() throws RecognitionException {
+        try {
+            int _type = AND;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1954:5: ( 'and' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1954:7: 'and'
+            {
+            match("and"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end AND
+
+    // $ANTLR start CONTAINS
+    public final void mCONTAINS() throws RecognitionException {
+        try {
+            int _type = CONTAINS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1957:8: ( 'contains' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1957:16: 'contains'
+            {
+            match("contains"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end CONTAINS
+
+    // $ANTLR start EXCLUDES
+    public final void mEXCLUDES() throws RecognitionException {
+        try {
+            int _type = EXCLUDES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1960:8: ( 'excludes' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1960:16: 'excludes'
+            {
+            match("excludes"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EXCLUDES
+
+    // $ANTLR start MEMBEROF
+    public final void mMEMBEROF() throws RecognitionException {
+        try {
+            int _type = MEMBEROF;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1963:8: ( 'memberOf' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1963:16: 'memberOf'
+            {
+            match("memberOf"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MEMBEROF
+
+    // $ANTLR start MATCHES
+    public final void mMATCHES() throws RecognitionException {
+        try {
+            int _type = MATCHES;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1965:9: ( 'matches' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1965:16: 'matches'
+            {
+            match("matches"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MATCHES
+
+    // $ANTLR start SOUNDSLIKE
+    public final void mSOUNDSLIKE() throws RecognitionException {
+        try {
+            int _type = SOUNDSLIKE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1967:12: ( 'soundslike' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1967:16: 'soundslike'
+            {
+            match("soundslike"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SOUNDSLIKE
+
+    // $ANTLR start IN
+    public final void mIN() throws RecognitionException {
+        try {
+            int _type = IN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1969:4: ( 'in' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1969:6: 'in'
+            {
+            match("in"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end IN
+
+    // $ANTLR start NULL
+    public final void mNULL() throws RecognitionException {
+        try {
+            int _type = NULL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1971:6: ( 'null' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1971:8: 'null'
+            {
+            match("null"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NULL
+
+    // $ANTLR start EXISTS
+    public final void mEXISTS() throws RecognitionException {
+        try {
+            int _type = EXISTS;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1973:8: ( 'exists' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1973:10: 'exists'
+            {
+            match("exists"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EXISTS
+
+    // $ANTLR start NOT
+    public final void mNOT() throws RecognitionException {
+        try {
+            int _type = NOT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1975:5: ( 'not' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1975:7: 'not'
+            {
+            match("not"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end NOT
+
+    // $ANTLR start EVAL
+    public final void mEVAL() throws RecognitionException {
+        try {
+            int _type = EVAL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1977:6: ( 'eval' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1977:8: 'eval'
+            {
+            match("eval"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end EVAL
+
+    // $ANTLR start FORALL
+    public final void mFORALL() throws RecognitionException {
+        try {
+            int _type = FORALL;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1979:8: ( 'forall' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1979:10: 'forall'
+            {
+            match("forall"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end FORALL
+
+    // $ANTLR start WHEN
+    public final void mWHEN() throws RecognitionException {
+        try {
+            int _type = WHEN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1981:9: ( 'when' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1981:11: 'when'
+            {
+            match("when"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end WHEN
+
+    // $ANTLR start THEN
+    public final void mTHEN() throws RecognitionException {
+        try {
+            int _type = THEN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1983:6: ( 'then' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1983:12: 'then'
+            {
+            match("then"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end THEN
+
+    // $ANTLR start END
+    public final void mEND() throws RecognitionException {
+        try {
+            int _type = END;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1985:9: ( 'end' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1985:11: 'end'
+            {
+            match("end"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end END
+
+    // $ANTLR start ID
+    public final void mID() throws RecognitionException {
+        try {
+            int _type = ID;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '$' | '\\u00c0' .. '\\u00ff' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '$' | '\\u00c0' .. '\\u00ff' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )*
+            {
+            if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1988:50: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' )*
+            loop14:
+            do {
+                int alt14=2;
+                int LA14_0 = input.LA(1);
+
+                if ( ((LA14_0>='0' && LA14_0<='9')||(LA14_0>='A' && LA14_0<='Z')||LA14_0=='_'||(LA14_0>='a' && LA14_0<='z')||(LA14_0>='\u00C0' && LA14_0<='\u00FF')) ) {
+                    alt14=1;
+                }
+
+
+                switch (alt14) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            	    {
+            	    if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
+            	        input.consume();
+            	    failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recover(mse);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop14;
+                }
+            } while (true);
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end ID
+
+    // $ANTLR start LEFT_PAREN
+    public final void mLEFT_PAREN() throws RecognitionException {
+        try {
+            int _type = LEFT_PAREN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1992:9: ( '(' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1992:11: '('
+            {
+            match('('); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_PAREN
+
+    // $ANTLR start RIGHT_PAREN
+    public final void mRIGHT_PAREN() throws RecognitionException {
+        try {
+            int _type = RIGHT_PAREN;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1996:9: ( ')' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1996:11: ')'
+            {
+            match(')'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_PAREN
+
+    // $ANTLR start LEFT_SQUARE
+    public final void mLEFT_SQUARE() throws RecognitionException {
+        try {
+            int _type = LEFT_SQUARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2000:9: ( '[' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2000:11: '['
+            {
+            match('['); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_SQUARE
+
+    // $ANTLR start RIGHT_SQUARE
+    public final void mRIGHT_SQUARE() throws RecognitionException {
+        try {
+            int _type = RIGHT_SQUARE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2004:9: ( ']' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2004:11: ']'
+            {
+            match(']'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_SQUARE
+
+    // $ANTLR start LEFT_CURLY
+    public final void mLEFT_CURLY() throws RecognitionException {
+        try {
+            int _type = LEFT_CURLY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2008:9: ( '{' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2008:11: '{'
+            {
+            match('{'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end LEFT_CURLY
+
+    // $ANTLR start RIGHT_CURLY
+    public final void mRIGHT_CURLY() throws RecognitionException {
+        try {
+            int _type = RIGHT_CURLY;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2012:9: ( '}' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2012:11: '}'
+            {
+            match('}'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end RIGHT_CURLY
+
+    // $ANTLR start COMMA
+    public final void mCOMMA() throws RecognitionException {
+        try {
+            int _type = COMMA;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2015:7: ( ',' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2015:9: ','
+            {
+            match(','); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end COMMA
+
+    // $ANTLR start DOT
+    public final void mDOT() throws RecognitionException {
+        try {
+            int _type = DOT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2018:5: ( '.' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2018:7: '.'
+            {
+            match('.'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOT
+
+    // $ANTLR start DOUBLE_AMPER
+    public final void mDOUBLE_AMPER() throws RecognitionException {
+        try {
+            int _type = DOUBLE_AMPER;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2022:2: ( '&&' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2022:4: '&&'
+            {
+            match("&&"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOUBLE_AMPER
+
+    // $ANTLR start DOUBLE_PIPE
+    public final void mDOUBLE_PIPE() throws RecognitionException {
+        try {
+            int _type = DOUBLE_PIPE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2026:2: ( '||' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2026:4: '||'
+            {
+            match("||"); if (failed) return ;
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end DOUBLE_PIPE
+
+    // $ANTLR start TILDE
+    public final void mTILDE() throws RecognitionException {
+        try {
+            int _type = TILDE;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2029:7: ( '~' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2029:9: '~'
+            {
+            match('~'); if (failed) return ;
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end TILDE
+
+    // $ANTLR start SH_STYLE_SINGLE_LINE_COMMENT
+    public final void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = SH_STYLE_SINGLE_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:2: ( '#' ( options {greedy=false; } : . )* EOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:4: '#' ( options {greedy=false; } : . )* EOL
+            {
+            match('#'); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:8: ( options {greedy=false; } : . )*
+            loop15:
+            do {
+                int alt15=2;
+                int LA15_0 = input.LA(1);
+
+                if ( (LA15_0=='\r') ) {
+                    alt15=2;
+                }
+                else if ( (LA15_0=='\n') ) {
+                    alt15=2;
+                }
+                else if ( ((LA15_0>='\u0000' && LA15_0<='\t')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\uFFFE')) ) {
+                    alt15=1;
+                }
+
+
+                switch (alt15) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2032:35: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop15;
+                }
+            } while (true);
+
+            mEOL(); if (failed) return ;
+            if ( backtracking==0 ) {
+               channel=HIDDEN; setText("//"+getText().substring(1));
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end SH_STYLE_SINGLE_LINE_COMMENT
+
+    // $ANTLR start C_STYLE_SINGLE_LINE_COMMENT
+    public final void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = C_STYLE_SINGLE_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:2: ( '//' ( options {greedy=false; } : . )* EOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:4: '//' ( options {greedy=false; } : . )* EOL
+            {
+            match("//"); if (failed) return ;
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:9: ( options {greedy=false; } : . )*
+            loop16:
+            do {
+                int alt16=2;
+                int LA16_0 = input.LA(1);
+
+                if ( (LA16_0=='\r') ) {
+                    alt16=2;
+                }
+                else if ( (LA16_0=='\n') ) {
+                    alt16=2;
+                }
+                else if ( ((LA16_0>='\u0000' && LA16_0<='\t')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\uFFFE')) ) {
+                    alt16=1;
+                }
+
+
+                switch (alt16) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2038:36: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop16;
+                }
+            } while (true);
+
+            mEOL(); if (failed) return ;
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end C_STYLE_SINGLE_LINE_COMMENT
+
+    // $ANTLR start MULTI_LINE_COMMENT
+    public final void mMULTI_LINE_COMMENT() throws RecognitionException {
+        try {
+            int _type = MULTI_LINE_COMMENT;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:4: '/*' ( options {greedy=false; } : . )* '*/'
+            {
+            match("/*"); if (failed) return ;
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:9: ( options {greedy=false; } : . )*
+            loop17:
+            do {
+                int alt17=2;
+                int LA17_0 = input.LA(1);
+
+                if ( (LA17_0=='*') ) {
+                    int LA17_1 = input.LA(2);
+
+                    if ( (LA17_1=='/') ) {
+                        alt17=2;
+                    }
+                    else if ( ((LA17_1>='\u0000' && LA17_1<='.')||(LA17_1>='0' && LA17_1<='\uFFFE')) ) {
+                        alt17=1;
+                    }
+
+
+                }
+                else if ( ((LA17_0>='\u0000' && LA17_0<=')')||(LA17_0>='+' && LA17_0<='\uFFFE')) ) {
+                    alt17=1;
+                }
+
+
+                switch (alt17) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2043:35: .
+            	    {
+            	    matchAny(); if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop17;
+                }
+            } while (true);
+
+            match("*/"); if (failed) return ;
+
+            if ( backtracking==0 ) {
+               channel=HIDDEN; 
+            }
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MULTI_LINE_COMMENT
+
+    // $ANTLR start MISC
+    public final void mMISC() throws RecognitionException {
+        try {
+            int _type = MISC;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:2047:7: ( '!' | '@' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '?' | '=' | '/' | '\\'' | '\\\\' | '|' | '&' )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            {
+            if ( input.LA(1)=='!'||(input.LA(1)>='$' && input.LA(1)<='\'')||(input.LA(1)>='*' && input.LA(1)<='+')||input.LA(1)=='-'||input.LA(1)=='/'||input.LA(1)=='='||(input.LA(1)>='?' && input.LA(1)<='@')||input.LA(1)=='\\'||(input.LA(1)>='^' && input.LA(1)<='_')||input.LA(1)=='|' ) {
+                input.consume();
+            failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recover(mse);    throw mse;
+            }
+
+
+            }
+
+            this.type = _type;
+        }
+        finally {
+        }
+    }
+    // $ANTLR end MISC
+
+    public void mTokens() throws RecognitionException {
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:8: ( T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | WS | INT | FLOAT | STRING | BOOL | PACKAGE | IMPORT | FUNCTION | EVENT | GLOBAL | DECLARE | RULE | QUERY | TEMPLATE | ATTRIBUTES | DATE_EFFECTIVE | DATE_EXPIRES | ENABLED | SALIENCE | NO_LOOP | AUTO_FOCUS | ACTIVATION_GROUP | AGENDA_GROUP | DIALECT | RULEFLOW_GROUP | DURATION | LOCK_ON_ACTIVE | FROM | ACCUMULATE | TIMEWINDOW | INIT | ACTION | REVERSE | RESULT | COLLECT | ENTRY_POINT | OR | AND | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | IN | NULL | EXISTS | NOT | EVAL | FORALL | WHEN | THEN | END | ID | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | COMMA | DOT | DOUBLE_AMPER | DOUBLE_PIPE | TILDE | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT | MISC )
+        int alt18=78;
+        alt18 = dfa18.predict(input);
+        switch (alt18) {
+            case 1 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:10: T77
+                {
+                mT77(); if (failed) return ;
+
+                }
+                break;
+            case 2 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:14: T78
+                {
+                mT78(); if (failed) return ;
+
+                }
+                break;
+            case 3 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:18: T79
+                {
+                mT79(); if (failed) return ;
+
+                }
+                break;
+            case 4 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:22: T80
+                {
+                mT80(); if (failed) return ;
+
+                }
+                break;
+            case 5 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:26: T81
+                {
+                mT81(); if (failed) return ;
+
+                }
+                break;
+            case 6 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:30: T82
+                {
+                mT82(); if (failed) return ;
+
+                }
+                break;
+            case 7 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:34: T83
+                {
+                mT83(); if (failed) return ;
+
+                }
+                break;
+            case 8 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:38: T84
+                {
+                mT84(); if (failed) return ;
+
+                }
+                break;
+            case 9 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:42: T85
+                {
+                mT85(); if (failed) return ;
+
+                }
+                break;
+            case 10 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:46: T86
+                {
+                mT86(); if (failed) return ;
+
+                }
+                break;
+            case 11 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:50: WS
+                {
+                mWS(); if (failed) return ;
+
+                }
+                break;
+            case 12 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:53: INT
+                {
+                mINT(); if (failed) return ;
+
+                }
+                break;
+            case 13 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:57: FLOAT
+                {
+                mFLOAT(); if (failed) return ;
+
+                }
+                break;
+            case 14 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:63: STRING
+                {
+                mSTRING(); if (failed) return ;
+
+                }
+                break;
+            case 15 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:70: BOOL
+                {
+                mBOOL(); if (failed) return ;
+
+                }
+                break;
+            case 16 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:75: PACKAGE
+                {
+                mPACKAGE(); if (failed) return ;
+
+                }
+                break;
+            case 17 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:83: IMPORT
+                {
+                mIMPORT(); if (failed) return ;
+
+                }
+                break;
+            case 18 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:90: FUNCTION
+                {
+                mFUNCTION(); if (failed) return ;
+
+                }
+                break;
+            case 19 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:99: EVENT
+                {
+                mEVENT(); if (failed) return ;
+
+                }
+                break;
+            case 20 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:105: GLOBAL
+                {
+                mGLOBAL(); if (failed) return ;
+
+                }
+                break;
+            case 21 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:112: DECLARE
+                {
+                mDECLARE(); if (failed) return ;
+
+                }
+                break;
+            case 22 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:120: RULE
+                {
+                mRULE(); if (failed) return ;
+
+                }
+                break;
+            case 23 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:125: QUERY
+                {
+                mQUERY(); if (failed) return ;
+
+                }
+                break;
+            case 24 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:131: TEMPLATE
+                {
+                mTEMPLATE(); if (failed) return ;
+
+                }
+                break;
+            case 25 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:140: ATTRIBUTES
+                {
+                mATTRIBUTES(); if (failed) return ;
+
+                }
+                break;
+            case 26 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:151: DATE_EFFECTIVE
+                {
+                mDATE_EFFECTIVE(); if (failed) return ;
+
+                }
+                break;
+            case 27 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:166: DATE_EXPIRES
+                {
+                mDATE_EXPIRES(); if (failed) return ;
+
+                }
+                break;
+            case 28 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:179: ENABLED
+                {
+                mENABLED(); if (failed) return ;
+
+                }
+                break;
+            case 29 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:187: SALIENCE
+                {
+                mSALIENCE(); if (failed) return ;
+
+                }
+                break;
+            case 30 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:196: NO_LOOP
+                {
+                mNO_LOOP(); if (failed) return ;
+
+                }
+                break;
+            case 31 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:204: AUTO_FOCUS
+                {
+                mAUTO_FOCUS(); if (failed) return ;
+
+                }
+                break;
+            case 32 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:215: ACTIVATION_GROUP
+                {
+                mACTIVATION_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 33 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:232: AGENDA_GROUP
+                {
+                mAGENDA_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 34 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:245: DIALECT
+                {
+                mDIALECT(); if (failed) return ;
+
+                }
+                break;
+            case 35 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:253: RULEFLOW_GROUP
+                {
+                mRULEFLOW_GROUP(); if (failed) return ;
+
+                }
+                break;
+            case 36 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:268: DURATION
+                {
+                mDURATION(); if (failed) return ;
+
+                }
+                break;
+            case 37 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:277: LOCK_ON_ACTIVE
+                {
+                mLOCK_ON_ACTIVE(); if (failed) return ;
+
+                }
+                break;
+            case 38 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:292: FROM
+                {
+                mFROM(); if (failed) return ;
+
+                }
+                break;
+            case 39 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:297: ACCUMULATE
+                {
+                mACCUMULATE(); if (failed) return ;
+
+                }
+                break;
+            case 40 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:308: TIMEWINDOW
+                {
+                mTIMEWINDOW(); if (failed) return ;
+
+                }
+                break;
+            case 41 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:319: INIT
+                {
+                mINIT(); if (failed) return ;
+
+                }
+                break;
+            case 42 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:324: ACTION
+                {
+                mACTION(); if (failed) return ;
+
+                }
+                break;
+            case 43 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:331: REVERSE
+                {
+                mREVERSE(); if (failed) return ;
+
+                }
+                break;
+            case 44 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:339: RESULT
+                {
+                mRESULT(); if (failed) return ;
+
+                }
+                break;
+            case 45 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:346: COLLECT
+                {
+                mCOLLECT(); if (failed) return ;
+
+                }
+                break;
+            case 46 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:354: ENTRY_POINT
+                {
+                mENTRY_POINT(); if (failed) return ;
+
+                }
+                break;
+            case 47 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:366: OR
+                {
+                mOR(); if (failed) return ;
+
+                }
+                break;
+            case 48 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:369: AND
+                {
+                mAND(); if (failed) return ;
+
+                }
+                break;
+            case 49 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:373: CONTAINS
+                {
+                mCONTAINS(); if (failed) return ;
+
+                }
+                break;
+            case 50 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:382: EXCLUDES
+                {
+                mEXCLUDES(); if (failed) return ;
+
+                }
+                break;
+            case 51 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:391: MEMBEROF
+                {
+                mMEMBEROF(); if (failed) return ;
+
+                }
+                break;
+            case 52 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:400: MATCHES
+                {
+                mMATCHES(); if (failed) return ;
+
+                }
+                break;
+            case 53 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:408: SOUNDSLIKE
+                {
+                mSOUNDSLIKE(); if (failed) return ;
+
+                }
+                break;
+            case 54 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:419: IN
+                {
+                mIN(); if (failed) return ;
+
+                }
+                break;
+            case 55 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:422: NULL
+                {
+                mNULL(); if (failed) return ;
+
+                }
+                break;
+            case 56 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:427: EXISTS
+                {
+                mEXISTS(); if (failed) return ;
+
+                }
+                break;
+            case 57 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:434: NOT
+                {
+                mNOT(); if (failed) return ;
+
+                }
+                break;
+            case 58 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:438: EVAL
+                {
+                mEVAL(); if (failed) return ;
+
+                }
+                break;
+            case 59 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:443: FORALL
+                {
+                mFORALL(); if (failed) return ;
+
+                }
+                break;
+            case 60 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:450: WHEN
+                {
+                mWHEN(); if (failed) return ;
+
+                }
+                break;
+            case 61 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:455: THEN
+                {
+                mTHEN(); if (failed) return ;
+
+                }
+                break;
+            case 62 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:460: END
+                {
+                mEND(); if (failed) return ;
+
+                }
+                break;
+            case 63 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:464: ID
+                {
+                mID(); if (failed) return ;
+
+                }
+                break;
+            case 64 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:467: LEFT_PAREN
+                {
+                mLEFT_PAREN(); if (failed) return ;
+
+                }
+                break;
+            case 65 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:478: RIGHT_PAREN
+                {
+                mRIGHT_PAREN(); if (failed) return ;
+
+                }
+                break;
+            case 66 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:490: LEFT_SQUARE
+                {
+                mLEFT_SQUARE(); if (failed) return ;
+
+                }
+                break;
+            case 67 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:502: RIGHT_SQUARE
+                {
+                mRIGHT_SQUARE(); if (failed) return ;
+
+                }
+                break;
+            case 68 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:515: LEFT_CURLY
+                {
+                mLEFT_CURLY(); if (failed) return ;
+
+                }
+                break;
+            case 69 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:526: RIGHT_CURLY
+                {
+                mRIGHT_CURLY(); if (failed) return ;
+
+                }
+                break;
+            case 70 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:538: COMMA
+                {
+                mCOMMA(); if (failed) return ;
+
+                }
+                break;
+            case 71 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:544: DOT
+                {
+                mDOT(); if (failed) return ;
+
+                }
+                break;
+            case 72 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:548: DOUBLE_AMPER
+                {
+                mDOUBLE_AMPER(); if (failed) return ;
+
+                }
+                break;
+            case 73 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:561: DOUBLE_PIPE
+                {
+                mDOUBLE_PIPE(); if (failed) return ;
+
+                }
+                break;
+            case 74 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:573: TILDE
+                {
+                mTILDE(); if (failed) return ;
+
+                }
+                break;
+            case 75 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:579: SH_STYLE_SINGLE_LINE_COMMENT
+                {
+                mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 76 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:608: C_STYLE_SINGLE_LINE_COMMENT
+                {
+                mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 77 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:636: MULTI_LINE_COMMENT
+                {
+                mMULTI_LINE_COMMENT(); if (failed) return ;
+
+                }
+                break;
+            case 78 :
+                // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1:655: MISC
+                {
+                mMISC(); if (failed) return ;
+
+                }
+                break;
+
+        }
+
+    }
+
+    // $ANTLR start synpred1
+    public final void synpred1_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:14: ( '\\r\\n' )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1831:16: '\\r\\n'
+        {
+        match("\r\n"); if (failed) return ;
+
+
+        }
+    }
+    // $ANTLR end synpred1
+
+    public final boolean synpred1() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred1_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+
+
+    protected DFA18 dfa18 = new DFA18(this);
+    static final String DFA18_eotS =
+        "\2\uffff\1\56\1\uffff\2\54\1\62\1\64\1\54\1\uffff\1\66\1\uffff\1"+
+        "\54\21\53\10\uffff\2\54\2\uffff\1\54\15\uffff\11\53\1\153\27\53"+
+        "\1\u008b\3\53\4\uffff\12\53\1\uffff\3\53\1\u009c\20\53\1\u00ad\4"+
+        "\53\1\uffff\1\u00b2\4\53\1\uffff\5\53\1\u00bc\1\u00bd\1\u00be\4"+
+        "\53\1\u00c3\3\53\1\uffff\2\53\1\u00c9\6\53\1\u00d1\6\53\1\uffff"+
+        "\4\53\1\uffff\1\u00dd\5\53\1\u00e3\2\53\3\uffff\1\53\1\u00bd\2\53"+
+        "\1\uffff\5\53\1\uffff\1\u00ee\4\53\1\uffff\1\53\1\uffff\2\53\1\u00f7"+
+        "\4\53\1\uffff\3\53\2\uffff\4\53\1\uffff\2\53\1\u0105\2\53\1\u0108"+
+        "\1\53\1\u010a\1\uffff\1\53\1\uffff\1\u010c\3\53\1\uffff\2\53\1\u0114"+
+        "\1\uffff\1\u0115\14\53\1\uffff\1\53\1\u0123\1\uffff\1\53\1\uffff"+
+        "\1\u0125\1\uffff\1\53\1\u0127\1\u0128\2\uffff\1\53\1\u012a\2\uffff"+
+        "\2\53\1\uffff\3\53\1\u0130\2\53\1\u0133\1\53\1\u0135\1\u0136\1\uffff"+
+        "\1\u0137\1\uffff\1\u0138\2\uffff\1\53\1\uffff\4\53\1\u013e\1\uffff"+
+        "\1\u013f\1\u0140\1\uffff\1\53\5\uffff\4\53\3\uffff\1\u0146\1\53"+
+        "\1\u0148\1\u0149\1\u014a\5\uffff";
+    static final String DFA18_eofS =
+        "\u014b\uffff";
+    static final String DFA18_minS =
+        "\1\11\1\uffff\1\52\1\uffff\1\60\4\75\1\uffff\1\56\1\uffff\1\0\1"+
+        "\145\2\141\1\155\1\156\1\154\1\141\1\145\1\165\1\143\1\141\3\157"+
+        "\1\162\1\141\1\150\10\uffff\1\46\1\174\2\uffff\1\52\15\uffff\2\155"+
+        "\1\145\1\165\1\157\1\162\1\154\1\156\1\143\1\60\1\160\1\143\2\141"+
+        "\1\157\1\162\1\141\1\143\1\164\1\154\1\163\1\145\1\143\1\145\1\144"+
+        "\2\164\1\165\1\154\1\55\1\154\1\143\1\154\1\60\1\155\1\164\1\145"+
+        "\4\uffff\1\145\1\160\1\156\1\145\1\155\1\141\1\163\1\143\1\153\1"+
+        "\164\1\uffff\1\157\1\154\1\163\1\60\1\162\1\142\1\154\1\156\1\142"+
+        "\1\141\2\154\3\145\1\165\1\162\1\151\1\165\1\156\1\60\1\157\1\162"+
+        "\1\156\1\151\1\uffff\1\60\1\154\1\153\1\154\1\164\1\uffff\1\142"+
+        "\1\143\1\156\1\167\1\154\3\60\1\154\1\145\1\164\1\141\1\60\1\162"+
+        "\1\165\1\164\1\uffff\1\171\1\154\1\60\1\164\1\141\1\164\1\145\1"+
+        "\141\1\55\1\60\1\162\1\154\1\171\1\157\1\155\1\144\1\uffff\1\55"+
+        "\1\151\1\144\1\145\1\uffff\1\60\1\55\1\145\1\141\1\145\1\150\1\60"+
+        "\1\151\1\141\3\uffff\1\154\1\60\1\151\1\147\1\uffff\1\164\1\144"+
+        "\1\163\1\55\1\145\1\uffff\1\60\1\154\1\151\1\143\1\162\1\145\1\154"+
+        "\1\uffff\1\163\1\164\1\60\1\156\1\141\1\165\1\141\1\uffff\1\142"+
+        "\1\163\1\156\2\uffff\1\143\1\151\1\162\1\145\1\uffff\1\156\1\164"+
+        "\1\60\1\157\1\145\1\60\1\145\1\60\1\uffff\1\144\1\uffff\1\60\1\157"+
+        "\1\164\1\145\1\146\1\157\1\145\1\60\1\uffff\1\60\1\164\1\154\1\55"+
+        "\1\165\1\154\1\143\1\164\1\156\1\117\1\163\1\144\1\145\1\uffff\1"+
+        "\156\1\60\1\uffff\1\163\1\uffff\1\60\1\uffff\1\156\2\60\2\uffff"+
+        "\1\167\1\60\2\uffff\1\151\1\141\1\uffff\1\164\1\151\1\145\1\60\1"+
+        "\163\1\146\1\60\1\157\2\60\1\uffff\1\60\1\uffff\1\60\2\uffff\1\55"+
+        "\1\uffff\1\157\1\164\1\145\1\153\1\60\1\uffff\2\60\1\uffff\1\167"+
+        "\5\uffff\1\156\1\145\1\163\1\145\3\uffff\1\60\1\55\3\60\5\uffff";
+    static final String DFA18_maxS =
+        "\1\u00ff\1\uffff\1\52\1\uffff\1\76\4\75\1\uffff\1\71\1\uffff\1\ufffe"+
+        "\1\162\1\165\1\141\1\156\1\170\1\154\4\165\1\157\1\165\2\157\1\162"+
+        "\1\145\1\150\10\uffff\1\46\1\174\2\uffff\1\57\15\uffff\2\155\1\145"+
+        "\1\165\1\157\1\162\1\154\1\156\1\143\1\u00ff\1\160\1\151\1\164\1"+
+        "\145\1\157\1\162\1\141\1\143\1\164\1\154\1\166\1\145\1\164\1\145"+
+        "\1\144\2\164\1\165\1\154\1\164\1\154\1\143\1\156\1\u00ff\1\155\1"+
+        "\164\1\145\4\uffff\1\145\1\160\1\156\1\145\1\155\1\141\1\163\1\143"+
+        "\1\153\1\164\1\uffff\1\157\1\154\1\163\1\u00ff\1\162\1\142\1\154"+
+        "\1\156\1\142\1\141\2\154\3\145\1\165\1\162\1\151\1\165\1\156\1\u00ff"+
+        "\1\157\1\162\1\156\1\151\1\uffff\1\u00ff\1\154\1\153\1\154\1\164"+
+        "\1\uffff\1\142\1\143\1\156\1\167\1\154\3\u00ff\1\154\1\145\1\164"+
+        "\1\141\1\u00ff\1\162\1\165\1\164\1\uffff\1\171\1\154\1\u00ff\1\164"+
+        "\1\141\1\164\1\145\1\141\1\55\1\u00ff\1\162\1\154\1\171\1\166\1"+
+        "\155\1\144\1\uffff\1\55\1\151\1\144\1\145\1\uffff\1\u00ff\1\55\1"+
+        "\145\1\141\1\145\1\150\1\u00ff\1\151\1\141\3\uffff\1\154\1\u00ff"+
+        "\1\151\1\147\1\uffff\1\164\1\144\1\163\1\55\1\145\1\uffff\1\u00ff"+
+        "\1\154\1\151\1\143\1\162\1\145\1\154\1\uffff\1\163\1\164\1\u00ff"+
+        "\1\156\1\141\1\165\1\141\1\uffff\1\142\1\163\1\156\2\uffff\1\143"+
+        "\1\151\1\162\1\145\1\uffff\1\156\1\164\1\u00ff\1\157\1\145\1\u00ff"+
+        "\1\145\1\u00ff\1\uffff\1\144\1\uffff\1\u00ff\1\157\1\164\1\145\1"+
+        "\170\1\157\1\145\1\u00ff\1\uffff\1\u00ff\1\164\1\154\1\55\1\165"+
+        "\1\154\1\143\1\164\1\156\1\117\1\163\1\144\1\145\1\uffff\1\156\1"+
+        "\u00ff\1\uffff\1\163\1\uffff\1\u00ff\1\uffff\1\156\2\u00ff\2\uffff"+
+        "\1\167\1\u00ff\2\uffff\1\151\1\141\1\uffff\1\164\1\151\1\145\1\u00ff"+
+        "\1\163\1\146\1\u00ff\1\157\2\u00ff\1\uffff\1\u00ff\1\uffff\1\u00ff"+
+        "\2\uffff\1\55\1\uffff\1\157\1\164\1\145\1\153\1\u00ff\1\uffff\2"+
+        "\u00ff\1\uffff\1\167\5\uffff\1\156\1\145\1\163\1\145\3\uffff\1\u00ff"+
+        "\1\55\3\u00ff\5\uffff";
+    static final String DFA18_acceptS =
+        "\1\uffff\1\1\1\uffff\1\3\5\uffff\1\13\1\uffff\1\16\22\uffff\1\77"+
+        "\1\100\1\101\1\102\1\103\1\104\1\105\1\106\2\uffff\1\112\1\113\1"+
+        "\uffff\1\77\1\116\1\2\1\107\1\4\1\5\1\7\1\6\1\11\1\10\1\12\1\14"+
+        "\1\15\45\uffff\1\110\1\111\1\115\1\114\12\uffff\1\66\31\uffff\1"+
+        "\36\5\uffff\1\57\20\uffff\1\76\20\uffff\1\60\4\uffff\1\71\11\uffff"+
+        "\1\75\1\17\1\46\4\uffff\1\51\5\uffff\1\72\7\uffff\1\26\7\uffff\1"+
+        "\37\3\uffff\1\67\1\45\4\uffff\1\74\10\uffff\1\56\1\uffff\1\23\10"+
+        "\uffff\1\27\15\uffff\1\73\2\uffff\1\21\1\uffff\1\70\1\uffff\1\24"+
+        "\3\uffff\1\33\1\32\2\uffff\1\54\1\52\2\uffff\1\41\12\uffff\1\20"+
+        "\1\uffff\1\34\1\uffff\1\42\1\25\1\uffff\1\53\5\uffff\1\55\2\uffff"+
+        "\1\64\1\uffff\1\30\1\22\1\62\1\44\1\43\4\uffff\1\35\1\61\1\63\5"+
+        "\uffff\1\50\1\40\1\47\1\31\1\65";
+    static final String DFA18_specialS =
+        "\u014b\uffff}>";
+    static final String[] DFA18_transitionS = {
+            "\2\11\1\uffff\2\11\22\uffff\1\11\1\10\1\13\1\51\1\36\1\54\1"+
+            "\46\1\14\1\37\1\40\2\54\1\45\1\4\1\2\1\52\12\12\1\3\1\1\1\7"+
+            "\1\5\1\6\2\54\32\53\1\41\1\54\1\42\1\54\1\36\1\uffff\1\26\1"+
+            "\53\1\32\1\23\1\21\1\16\1\22\1\53\1\20\2\53\1\31\1\34\1\30\1"+
+            "\33\1\17\1\25\1\24\1\27\1\15\2\53\1\35\3\53\1\43\1\47\1\44\1"+
+            "\50\101\uffff\100\53",
+            "",
+            "\1\55",
+            "",
+            "\12\12\4\uffff\1\57",
+            "\1\60",
+            "\1\61",
+            "\1\63",
+            "\1\65",
+            "",
+            "\1\67\1\uffff\12\12",
+            "",
+            "\uffff\13",
+            "\1\71\2\uffff\1\72\1\70\10\uffff\1\73",
+            "\1\76\15\uffff\1\75\2\uffff\1\74\2\uffff\1\77",
+            "\1\100",
+            "\1\102\1\101",
+            "\1\104\7\uffff\1\105\1\uffff\1\103",
+            "\1\106",
+            "\1\112\3\uffff\1\111\3\uffff\1\110\13\uffff\1\107",
+            "\1\114\17\uffff\1\113",
+            "\1\115",
+            "\1\116\3\uffff\1\117\6\uffff\1\120\5\uffff\1\122\1\121",
+            "\1\124\15\uffff\1\123",
+            "\1\125\5\uffff\1\126",
+            "\1\127",
+            "\1\130",
+            "\1\131",
+            "\1\133\3\uffff\1\132",
+            "\1\134",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\135",
+            "\1\136",
+            "",
+            "",
+            "\1\137\4\uffff\1\140",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\141",
+            "\1\142",
+            "\1\143",
+            "\1\144",
+            "\1\145",
+            "\1\146",
+            "\1\147",
+            "\1\150",
+            "\1\151",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\10\53\1\152\21\53"+
+            "\105\uffff\100\53",
+            "\1\154",
+            "\1\155\5\uffff\1\156",
+            "\1\161\2\uffff\1\157\17\uffff\1\160",
+            "\1\162\3\uffff\1\163",
+            "\1\164",
+            "\1\165",
+            "\1\166",
+            "\1\167",
+            "\1\170",
+            "\1\171",
+            "\1\173\2\uffff\1\172",
+            "\1\174",
+            "\1\176\20\uffff\1\175",
+            "\1\177",
+            "\1\u0080",
+            "\1\u0081",
+            "\1\u0082",
+            "\1\u0083",
+            "\1\u0084",
+            "\1\u0085\106\uffff\1\u0086",
+            "\1\u0087",
+            "\1\u0088",
+            "\1\u0089\1\uffff\1\u008a",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u008c",
+            "\1\u008d",
+            "\1\u008e",
+            "",
+            "",
+            "",
+            "",
+            "\1\u008f",
+            "\1\u0090",
+            "\1\u0091",
+            "\1\u0092",
+            "\1\u0093",
+            "\1\u0094",
+            "\1\u0095",
+            "\1\u0096",
+            "\1\u0097",
+            "\1\u0098",
+            "",
+            "\1\u0099",
+            "\1\u009a",
+            "\1\u009b",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u009d",
+            "\1\u009e",
+            "\1\u009f",
+            "\1\u00a0",
+            "\1\u00a1",
+            "\1\u00a2",
+            "\1\u00a3",
+            "\1\u00a4",
+            "\1\u00a5",
+            "\1\u00a6",
+            "\1\u00a7",
+            "\1\u00a8",
+            "\1\u00a9",
+            "\1\u00aa",
+            "\1\u00ab",
+            "\1\u00ac",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ae",
+            "\1\u00af",
+            "\1\u00b0",
+            "\1\u00b1",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00b3",
+            "\1\u00b4",
+            "\1\u00b5",
+            "\1\u00b6",
+            "",
+            "\1\u00b7",
+            "\1\u00b8",
+            "\1\u00b9",
+            "\1\u00ba",
+            "\1\u00bb",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00bf",
+            "\1\u00c0",
+            "\1\u00c1",
+            "\1\u00c2",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00c4",
+            "\1\u00c5",
+            "\1\u00c6",
+            "",
+            "\1\u00c7",
+            "\1\u00c8",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ca",
+            "\1\u00cb",
+            "\1\u00cc",
+            "\1\u00cd",
+            "\1\u00ce",
+            "\1\u00cf",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\5\53\1\u00d0\24\53"+
+            "\105\uffff\100\53",
+            "\1\u00d2",
+            "\1\u00d3",
+            "\1\u00d4",
+            "\1\u00d5\6\uffff\1\u00d6",
+            "\1\u00d7",
+            "\1\u00d8",
+            "",
+            "\1\u00d9",
+            "\1\u00da",
+            "\1\u00db",
+            "\1\u00dc",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00de",
+            "\1\u00df",
+            "\1\u00e0",
+            "\1\u00e1",
+            "\1\u00e2",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00e4",
+            "\1\u00e5",
+            "",
+            "",
+            "",
+            "\1\u00e6",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00e7",
+            "\1\u00e8",
+            "",
+            "\1\u00e9",
+            "\1\u00ea",
+            "\1\u00eb",
+            "\1\u00ec",
+            "\1\u00ed",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00ef",
+            "\1\u00f0",
+            "\1\u00f1",
+            "\1\u00f2",
+            "\1\u00f3",
+            "\1\u00f4",
+            "",
+            "\1\u00f5",
+            "\1\u00f6",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u00f8",
+            "\1\u00f9",
+            "\1\u00fa",
+            "\1\u00fb",
+            "",
+            "\1\u00fc",
+            "\1\u00fd",
+            "\1\u00fe",
+            "",
+            "",
+            "\1\u00ff",
+            "\1\u0100",
+            "\1\u0101",
+            "\1\u0102",
+            "",
+            "\1\u0103",
+            "\1\u0104",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0106",
+            "\1\u0107",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0109",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u010b",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u010d",
+            "\1\u010e",
+            "\1\u010f",
+            "\1\u0111\21\uffff\1\u0110",
+            "\1\u0112",
+            "\1\u0113",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0116",
+            "\1\u0117",
+            "\1\u0118",
+            "\1\u0119",
+            "\1\u011a",
+            "\1\u011b",
+            "\1\u011c",
+            "\1\u011d",
+            "\1\u011e",
+            "\1\u011f",
+            "\1\u0120",
+            "\1\u0121",
+            "",
+            "\1\u0122",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0124",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0126",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u0129",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u012b",
+            "\1\u012c",
+            "",
+            "\1\u012d",
+            "\1\u012e",
+            "\1\u012f",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0131",
+            "\1\u0132",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0134",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "\1\u0139",
+            "",
+            "\1\u013a",
+            "\1\u013b",
+            "\1\u013c",
+            "\1\u013d",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "\1\u0141",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\1\u0142",
+            "\1\u0143",
+            "\1\u0144",
+            "\1\u0145",
+            "",
+            "",
+            "",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\1\u0147",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "\12\53\7\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100"+
+            "\53",
+            "",
+            "",
+            "",
+            "",
+            ""
+    };
+
+    static final short[] DFA18_eot = DFA.unpackEncodedString(DFA18_eotS);
+    static final short[] DFA18_eof = DFA.unpackEncodedString(DFA18_eofS);
+    static final char[] DFA18_min = DFA.unpackEncodedStringToUnsignedChars(DFA18_minS);
+    static final char[] DFA18_max = DFA.unpackEncodedStringToUnsignedChars(DFA18_maxS);
+    static final short[] DFA18_accept = DFA.unpackEncodedString(DFA18_acceptS);
+    static final short[] DFA18_special = DFA.unpackEncodedString(DFA18_specialS);
+    static final short[][] DFA18_transition;
+
+    static {
+        int numStates = DFA18_transitionS.length;
+        DFA18_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA18_transition[i] = DFA.unpackEncodedString(DFA18_transitionS[i]);
+        }
+    }
+
+    class DFA18 extends DFA {
+
+        public DFA18(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 18;
+            this.eot = DFA18_eot;
+            this.eof = DFA18_eof;
+            this.min = DFA18_min;
+            this.max = DFA18_max;
+            this.accept = DFA18_accept;
+            this.special = DFA18_special;
+            this.transition = DFA18_transition;
+        }
+        public String getDescription() {
+            return "1:1: Tokens : ( T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | WS | INT | FLOAT | STRING | BOOL | PACKAGE | IMPORT | FUNCTION | EVENT | GLOBAL | DECLARE | RULE | QUERY | TEMPLATE | ATTRIBUTES | DATE_EFFECTIVE | DATE_EXPIRES | ENABLED | SALIENCE | NO_LOOP | AUTO_FOCUS | ACTIVATION_GROUP | AGENDA_GROUP | DIALECT | RULEFLOW_GROUP | DURATION | LOCK_ON_ACTIVE | FROM | ACCUMULATE | TIMEWINDOW | INIT | ACTION | REVERSE | RESULT | COLLECT | ENTRY_POINT | OR | AND | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | IN | NULL | EXISTS | NOT | EVAL | FORALL | WHEN | THEN | END | ID | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | COMMA | DOT | DOUBLE_AMPER | DOUBLE_PIPE | TILDE | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT | MISC );";
+        }
+    }
+ 
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLParser.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLParser.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/DRLParser.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10106 @@
+// $ANTLR 3.0.1 C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g 2008-03-12 13:23:56
+
+	package org.drools.lang;
+	import java.util.List;
+	import java.util.ArrayList;
+	import java.util.Iterator;
+	import java.util.HashMap;	
+	import java.util.StringTokenizer;
+	import org.drools.lang.descr.*;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+public class DRLParser extends Parser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PACKAGE", "IMPORT", "FUNCTION", "ID", "DOT", "GLOBAL", "LEFT_PAREN", "COMMA", "RIGHT_PAREN", "DECLARE", "LEFT_CURLY", "RIGHT_CURLY", "STRING", "QUERY", "END", "TEMPLATE", "RULE", "WHEN", "ATTRIBUTES", "DATE_EFFECTIVE", "DATE_EXPIRES", "ENABLED", "BOOL", "SALIENCE", "INT", "NO_LOOP", "AUTO_FOCUS", "ACTIVATION_GROUP", "RULEFLOW_GROUP", "AGENDA_GROUP", "DURATION", "DIALECT", "LOCK_ON_ACTIVE", "OR", "DOUBLE_PIPE", "AND", "DOUBLE_AMPER", "FROM", "EXISTS", "NOT", "EVAL", "FORALL", "ACCUMULATE", "INIT", "ACTION", "REVERSE", "RESULT", "TIMEWINDOW", "COLLECT", "ENTRY_POINT", "CONTAINS", "EXCLUDES", "MATCHES", "SOUNDSLIKE", "MEMBEROF", "TILDE", "IN", "FLOAT", "NULL", "LEFT_SQUARE", "RIGHT_SQUARE", "THEN", "EVENT", "EOL", "WS", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "MULTI_LINE_COMMENT", "MISC", "';'", "'.*'", "':'", "'->'", "'=='", "'>'", "'>='", "'<'!
 ", "'<='", "'!='"
+    };
+    public static final int ACCUMULATE=46;
+    public static final int PACKAGE=4;
+    public static final int FUNCTION=6;
+    public static final int RIGHT_SQUARE=64;
+    public static final int ACTIVATION_GROUP=31;
+    public static final int RIGHT_CURLY=15;
+    public static final int ATTRIBUTES=22;
+    public static final int DIALECT=35;
+    public static final int CONTAINS=54;
+    public static final int NO_LOOP=29;
+    public static final int MEMBEROF=58;
+    public static final int LOCK_ON_ACTIVE=36;
+    public static final int AGENDA_GROUP=33;
+    public static final int FLOAT=61;
+    public static final int SH_STYLE_SINGLE_LINE_COMMENT=73;
+    public static final int NOT=43;
+    public static final int ID=7;
+    public static final int AND=39;
+    public static final int EOF=-1;
+    public static final int HexDigit=70;
+    public static final int DATE_EFFECTIVE=23;
+    public static final int ACTION=48;
+    public static final int DOUBLE_PIPE=38;
+    public static final int RIGHT_PAREN=12;
+    public static final int IMPORT=5;
+    public static final int EOL=67;
+    public static final int DOUBLE_AMPER=40;
+    public static final int THEN=65;
+    public static final int IN=60;
+    public static final int MATCHES=56;
+    public static final int COMMA=11;
+    public static final int TILDE=59;
+    public static final int ENABLED=25;
+    public static final int EXISTS=42;
+    public static final int DOT=8;
+    public static final int RULE=20;
+    public static final int TIMEWINDOW=51;
+    public static final int EXCLUDES=55;
+    public static final int AUTO_FOCUS=30;
+    public static final int NULL=62;
+    public static final int SOUNDSLIKE=57;
+    public static final int BOOL=26;
+    public static final int FORALL=45;
+    public static final int SALIENCE=27;
+    public static final int RULEFLOW_GROUP=32;
+    public static final int RESULT=50;
+    public static final int INT=28;
+    public static final int EVENT=66;
+    public static final int MULTI_LINE_COMMENT=75;
+    public static final int DURATION=34;
+    public static final int WS=68;
+    public static final int EVAL=44;
+    public static final int TEMPLATE=19;
+    public static final int WHEN=21;
+    public static final int UnicodeEscape=71;
+    public static final int ENTRY_POINT=53;
+    public static final int LEFT_CURLY=14;
+    public static final int OR=37;
+    public static final int LEFT_PAREN=10;
+    public static final int QUERY=17;
+    public static final int DECLARE=13;
+    public static final int MISC=76;
+    public static final int REVERSE=49;
+    public static final int END=18;
+    public static final int GLOBAL=9;
+    public static final int FROM=41;
+    public static final int COLLECT=52;
+    public static final int LEFT_SQUARE=63;
+    public static final int INIT=47;
+    public static final int OctalEscape=72;
+    public static final int EscapeSequence=69;
+    public static final int C_STYLE_SINGLE_LINE_COMMENT=74;
+    public static final int STRING=16;
+    public static final int DATE_EXPIRES=24;
+
+        public DRLParser(TokenStream input) {
+            super(input);
+            ruleMemo = new HashMap[88+1];
+         }
+        
+
+    public String[] getTokenNames() { return tokenNames; }
+    public String getGrammarFileName() { return "C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g"; }
+
+    
+    	private PackageDescr packageDescr;
+    	private List errors = new ArrayList();
+    	private String source = "unknown";
+    	private int lineOffset = 0;
+    	private DescrFactory factory = new DescrFactory();
+    	private boolean parserDebug = false;
+    	private Location location = new Location( Location.LOCATION_UNKNOWN );
+    	
+    	// THE FOLLOWING LINES ARE DUMMY ATTRIBUTES TO WORK AROUND AN ANTLR BUG
+    	private BaseDescr from = null;
+    	private FieldConstraintDescr fc = null;
+    	private RestrictionConnectiveDescr and = null;
+    	private RestrictionConnectiveDescr or = null;
+    	private ConditionalElementDescr base = null;
+    	
+    	public void setParserDebug(boolean parserDebug) {
+    		this.parserDebug = parserDebug;
+    	}
+    	
+    	public void debug(String message) {
+    		if ( parserDebug ) 
+    			System.err.println( "drl parser: " + message );
+    	}
+    	
+    	public void setSource(String source) {
+    		this.source = source;
+    	}
+    	public DescrFactory getFactory() {
+    		return factory;
+    	}	
+    
+    	public String getSource() {
+    		return this.source;
+    	}
+    	
+    	public PackageDescr getPackageDescr() {
+    		return packageDescr;
+    	}
+    	
+    	private int offset(int line) {
+    		return line + lineOffset;
+    	}
+    	
+    	/**
+    	 * This will set the offset to record when reparsing. Normally is zero of course 
+    	 */
+    	public void setLineOffset(int i) {
+    	 	this.lineOffset = i;
+    	}
+    	
+    	private String getString(String token) {
+    		return safeSubstring( token, 1, token.length() -1 );
+    	}
+    	
+    	private String cleanupSpaces( String input ) {
+                    return input.replaceAll( "\\s", "" );
+            }
+    	
+    	
+    	public void reportError(RecognitionException ex) {
+    	        // if we've already reported an error and have not matched a token
+                    // yet successfully, don't report any errors.
+                    if ( errorRecovery ) {
+                            return;
+                    }
+                    errorRecovery = true;
+    
+    		ex.line = offset(ex.line); //add the offset if there is one
+    		errors.add( ex ); 
+    	}
+         	
+         	/** return the raw RecognitionException errors */
+         	public List getErrors() {
+         		return errors;
+         	}
+         	
+         	/** Return a list of pretty strings summarising the errors */
+         	public List getErrorMessages() {
+         		List messages = new ArrayList();
+     		for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+         	     		messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+         	     	}
+         	     	return messages;
+         	}
+         	
+         	/** return true if any parser errors were accumulated */
+         	public boolean hasErrors() {
+      		return ! errors.isEmpty();
+         	}
+         	
+         	/** This will take a RecognitionException, and create a sensible error message out of it */
+         	public String createErrorMessage(RecognitionException e)
+            {
+    		StringBuffer message = new StringBuffer();		
+                    message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+                    if ( e instanceof MismatchedTokenException ) {
+                            MismatchedTokenException mte = (MismatchedTokenException)e;
+                            if( mte.expecting >=0 && mte.expecting < tokenNames.length ) {
+    	                        message.append("mismatched token: "+
+                                                               e.token+
+                                                               "; expecting type "+
+                                                               tokenNames[mte.expecting]);
+                            } else {
+    	                        message.append("mismatched token: "+
+                                                               e.token+
+                                                               ";");
+                            }
+                    }
+                    else if ( e instanceof MismatchedTreeNodeException ) {
+                            MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+                            if( mtne.expecting >=0 && mtne.expecting < tokenNames.length ) {
+    	                        message.append("mismatched tree node: "+
+                                                               mtne.toString() +
+                                                               "; expecting type "+
+                                                               tokenNames[mtne.expecting]);
+                            } else {
+    	                        message.append("mismatched tree node: "+
+                                                               mtne.toString() +
+                                                               ";");
+                            }
+                    }
+                    else if ( e instanceof NoViableAltException ) {
+                            NoViableAltException nvae = (NoViableAltException)e;
+    			message.append( "Unexpected token '" + e.token.getText() + "'" );
+                            /*
+                            message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+                                                               " state "+nvae.stateNumber+
+                                                               " (decision="+nvae.decisionNumber+
+                                                               ") no viable alt; token="+
+                                                               e.token);
+                                                               */
+                    }
+                    else if ( e instanceof EarlyExitException ) {
+                            EarlyExitException eee = (EarlyExitException)e;
+                            message.append("required (...)+ loop (decision="+
+                                                               eee.decisionNumber+
+                                                               ") did not match anything; token="+
+                                                               e.token);
+                    }
+                    else if ( e instanceof MismatchedSetException ) {
+                            MismatchedSetException mse = (MismatchedSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof MismatchedNotSetException ) {
+                            MismatchedNotSetException mse = (MismatchedNotSetException)e;
+                            message.append("mismatched token '"+
+                                                               e.token+
+                                                               "' expecting set "+mse.expecting);
+                    }
+                    else if ( e instanceof FailedPredicateException ) {
+                            FailedPredicateException fpe = (FailedPredicateException)e;
+                            message.append("rule "+fpe.ruleName+" failed predicate: {"+
+                                                               fpe.predicateText+"}?");
+                    } else if (e instanceof GeneralParseException) {
+    			message.append(" " + e.getMessage());
+    		}
+                   	return message.toString();
+            }   
+            
+            void checkTrailingSemicolon(String text, int line) {
+            	if (text.trim().endsWith( ";" ) ) {
+            		this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
+            	}
+            }
+            
+            public Location getLocation() {
+                    return this.location;
+            }
+            
+            private String safeSubstring( String text, int start, int end ) {
+                	return text.substring( Math.min( start, text.length() ), Math.min( Math.max( start, end ), text.length() ) );
+            }
+          
+
+
+
+    // $ANTLR start opt_semicolon
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:195:1: opt_semicolon : ( ';' )? ;
+    public final void opt_semicolon() throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:2: ( ( ';' )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ( ';' )?
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ( ';' )?
+            int alt1=2;
+            int LA1_0 = input.LA(1);
+
+            if ( (LA1_0==77) ) {
+                alt1=1;
+            }
+            switch (alt1) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:196:4: ';'
+                    {
+                    match(input,77,FOLLOW_77_in_opt_semicolon39); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end opt_semicolon
+
+
+    // $ANTLR start compilation_unit
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:199:1: compilation_unit : prolog ( statement )* EOF ;
+    public final void compilation_unit() throws RecognitionException {
+        
+        		// reset Location information
+        		this.location = new Location( Location.LOCATION_UNKNOWN );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:204:2: ( prolog ( statement )* EOF )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:204:4: prolog ( statement )* EOF
+            {
+            pushFollow(FOLLOW_prolog_in_compilation_unit57);
+            prolog();
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:205:3: ( statement )*
+            loop2:
+            do {
+                int alt2=2;
+                int LA2_0 = input.LA(1);
+
+                if ( ((LA2_0>=IMPORT && LA2_0<=FUNCTION)||LA2_0==GLOBAL||LA2_0==DECLARE||LA2_0==QUERY||(LA2_0>=TEMPLATE && LA2_0<=RULE)||(LA2_0>=DATE_EFFECTIVE && LA2_0<=ENABLED)||LA2_0==SALIENCE||(LA2_0>=NO_LOOP && LA2_0<=LOCK_ON_ACTIVE)) ) {
+                    alt2=1;
+                }
+
+
+                switch (alt2) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:205:3: statement
+            	    {
+            	    pushFollow(FOLLOW_statement_in_compilation_unit62);
+            	    statement();
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop2;
+                }
+            } while (true);
+
+            match(input,EOF,FOLLOW_EOF_in_compilation_unit67); if (failed) return ;
+
+            }
+
+        }
+        catch ( RecognitionException e ) {
+            
+            		reportError( e );
+            	
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end compilation_unit
+
+
+    // $ANTLR start prolog
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:212:1: prolog : (pkgstmt= package_statement )? ;
+    public final void prolog() throws RecognitionException {
+        String pkgstmt = null;
+
+
+        
+        		String packageName = "";
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:2: ( (pkgstmt= package_statement )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:4: (pkgstmt= package_statement )?
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:4: (pkgstmt= package_statement )?
+            int alt3=2;
+            int LA3_0 = input.LA(1);
+
+            if ( (LA3_0==PACKAGE) ) {
+                alt3=1;
+            }
+            switch (alt3) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:216:6: pkgstmt= package_statement
+                    {
+                    pushFollow(FOLLOW_package_statement_in_prolog96);
+                    pkgstmt=package_statement();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       packageName = pkgstmt; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+               
+              			this.packageDescr = factory.createPackage( packageName ); 
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end prolog
+
+
+    // $ANTLR start statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );
+    public final void statement() throws RecognitionException {
+        AttributeDescr a = null;
+
+        FactTemplateDescr t = null;
+
+        RuleDescr r = null;
+
+        QueryDescr q = null;
+
+        TypeDeclarationDescr d = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:224:2: (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration )
+            int alt4=9;
+            switch ( input.LA(1) ) {
+            case DATE_EFFECTIVE:
+            case DATE_EXPIRES:
+            case ENABLED:
+            case SALIENCE:
+            case NO_LOOP:
+            case AUTO_FOCUS:
+            case ACTIVATION_GROUP:
+            case RULEFLOW_GROUP:
+            case AGENDA_GROUP:
+            case DURATION:
+            case DIALECT:
+            case LOCK_ON_ACTIVE:
+                {
+                alt4=1;
+                }
+                break;
+            case IMPORT:
+                {
+                int LA4_2 = input.LA(2);
+
+                if ( (LA4_2==FUNCTION) ) {
+                    alt4=2;
+                }
+                else if ( (LA4_2==ID) ) {
+                    alt4=3;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );", 4, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case GLOBAL:
+                {
+                alt4=4;
+                }
+                break;
+            case FUNCTION:
+                {
+                alt4=5;
+                }
+                break;
+            case TEMPLATE:
+                {
+                alt4=6;
+                }
+                break;
+            case RULE:
+                {
+                alt4=7;
+                }
+                break;
+            case QUERY:
+                {
+                alt4=8;
+                }
+                break;
+            case DECLARE:
+                {
+                alt4=9;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("223:1: statement : (a= rule_attribute | function_import_statement | import_statement | global | function | t= template | r= rule | q= query | d= type_declaration );", 4, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt4) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:224:4: a= rule_attribute
+                    {
+                    pushFollow(FOLLOW_rule_attribute_in_statement121);
+                    a=rule_attribute();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addAttribute( a ); 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:225:4: function_import_statement
+                    {
+                    pushFollow(FOLLOW_function_import_statement_in_statement128);
+                    function_import_statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:226:4: import_statement
+                    {
+                    pushFollow(FOLLOW_import_statement_in_statement134);
+                    import_statement();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:227:4: global
+                    {
+                    pushFollow(FOLLOW_global_in_statement140);
+                    global();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:228:4: function
+                    {
+                    pushFollow(FOLLOW_function_in_statement146);
+                    function();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:229:10: t= template
+                    {
+                    pushFollow(FOLLOW_template_in_statement160);
+                    t=template();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addFactTemplate( t ); 
+                    }
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:230:4: r= rule
+                    {
+                    pushFollow(FOLLOW_rule_in_statement169);
+                    r=rule();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addRule( r ); 
+                    }
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:231:4: q= query
+                    {
+                    pushFollow(FOLLOW_query_in_statement181);
+                    q=query();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addRule( q ); 
+                    }
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:232:10: d= type_declaration
+                    {
+                    pushFollow(FOLLOW_type_declaration_in_statement196);
+                    d=type_declaration();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                       this.packageDescr.addTypeDeclaration( d ); 
+                    }
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end statement
+
+
+    // $ANTLR start package_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:235:1: package_statement returns [String packageName] : PACKAGE n= dotted_name opt_semicolon ;
+    public final String package_statement() throws RecognitionException {
+        String packageName = null;
+
+        String n = null;
+
+
+        
+        		packageName = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:239:2: ( PACKAGE n= dotted_name opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:240:3: PACKAGE n= dotted_name opt_semicolon
+            {
+            match(input,PACKAGE,FOLLOW_PACKAGE_in_package_statement222); if (failed) return packageName;
+            pushFollow(FOLLOW_dotted_name_in_package_statement226);
+            n=dotted_name();
+            _fsp--;
+            if (failed) return packageName;
+            pushFollow(FOLLOW_opt_semicolon_in_package_statement228);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return packageName;
+            if ( backtracking==0 ) {
+              
+              			packageName = n;
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return packageName;
+    }
+    // $ANTLR end package_statement
+
+
+    // $ANTLR start import_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:248:1: import_statement : IMPORT import_name[importDecl] opt_semicolon ;
+    public final void import_statement() throws RecognitionException {
+        Token IMPORT1=null;
+
+        
+                	ImportDescr importDecl = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:252:2: ( IMPORT import_name[importDecl] opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:252:4: IMPORT import_name[importDecl] opt_semicolon
+            {
+            IMPORT1=(Token)input.LT(1);
+            match(input,IMPORT,FOLLOW_IMPORT_in_import_statement259); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	            importDecl = factory.createImport( );
+              	            importDecl.setStartCharacter( ((CommonToken)IMPORT1).getStartIndex() );
+              		    if (packageDescr != null) {
+              			packageDescr.addImport( importDecl );
+              		    }
+              	        
+            }
+            pushFollow(FOLLOW_import_name_in_import_statement282);
+            import_name(importDecl);
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_import_statement285);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end import_statement
+
+
+    // $ANTLR start function_import_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:263:1: function_import_statement : IMPORT FUNCTION import_name[importDecl] opt_semicolon ;
+    public final void function_import_statement() throws RecognitionException {
+        Token IMPORT2=null;
+
+        
+                	FunctionImportDescr importDecl = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:267:2: ( IMPORT FUNCTION import_name[importDecl] opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:267:4: IMPORT FUNCTION import_name[importDecl] opt_semicolon
+            {
+            IMPORT2=(Token)input.LT(1);
+            match(input,IMPORT,FOLLOW_IMPORT_in_function_import_statement309); if (failed) return ;
+            match(input,FUNCTION,FOLLOW_FUNCTION_in_function_import_statement311); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	            importDecl = factory.createFunctionImport();
+              	            importDecl.setStartCharacter( ((CommonToken)IMPORT2).getStartIndex() );
+              		    if (packageDescr != null) {
+              			packageDescr.addFunctionImport( importDecl );
+              		    }
+              	        
+            }
+            pushFollow(FOLLOW_import_name_in_function_import_statement334);
+            import_name(importDecl);
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_function_import_statement337);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end function_import_statement
+
+
+    // $ANTLR start import_name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:278:1: import_name[ImportDescr importDecl] returns [String name] : ID ( DOT id= identifier )* (star= '.*' )? ;
+    public final String import_name(ImportDescr importDecl) throws RecognitionException {
+        String name = null;
+
+        Token star=null;
+        Token ID3=null;
+        Token DOT4=null;
+        identifier_return id = null;
+
+
+        
+        		name = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:282:2: ( ID ( DOT id= identifier )* (star= '.*' )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:283:3: ID ( DOT id= identifier )* (star= '.*' )?
+            {
+            ID3=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_import_name362); if (failed) return name;
+            if ( backtracking==0 ) {
+               
+              		    name =ID3.getText(); 
+              		    importDecl.setTarget( name );
+              		    importDecl.setEndCharacter( ((CommonToken)ID3).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:289:3: ( DOT id= identifier )*
+            loop5:
+            do {
+                int alt5=2;
+                int LA5_0 = input.LA(1);
+
+                if ( (LA5_0==DOT) ) {
+                    alt5=1;
+                }
+
+
+                switch (alt5) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:289:5: DOT id= identifier
+            	    {
+            	    DOT4=(Token)input.LT(1);
+            	    match(input,DOT,FOLLOW_DOT_in_import_name374); if (failed) return name;
+            	    pushFollow(FOLLOW_identifier_in_import_name378);
+            	    id=identifier();
+            	    _fsp--;
+            	    if (failed) return name;
+            	    if ( backtracking==0 ) {
+            	       
+            	      		        name = name + DOT4.getText() + input.toString(id.start,id.stop); 
+            	      			importDecl.setTarget( name );
+            	      		        importDecl.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+            	      		    
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop5;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:296:3: (star= '.*' )?
+            int alt6=2;
+            int LA6_0 = input.LA(1);
+
+            if ( (LA6_0==78) ) {
+                alt6=1;
+            }
+            switch (alt6) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:296:5: star= '.*'
+                    {
+                    star=(Token)input.LT(1);
+                    match(input,78,FOLLOW_78_in_import_name402); if (failed) return name;
+                    if ( backtracking==0 ) {
+                       
+                      		        name = name + star.getText(); 
+                      			importDecl.setTarget( name );
+                      		        importDecl.setEndCharacter( ((CommonToken)star).getStopIndex() );
+                      		    
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return name;
+    }
+    // $ANTLR end import_name
+
+
+    // $ANTLR start global
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:306:1: global : GLOBAL type= dotted_name id= identifier opt_semicolon ;
+    public final void global() throws RecognitionException {
+        Token GLOBAL5=null;
+        String type = null;
+
+        identifier_return id = null;
+
+
+        
+        	    GlobalDescr global = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:310:2: ( GLOBAL type= dotted_name id= identifier opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:311:3: GLOBAL type= dotted_name id= identifier opt_semicolon
+            {
+            GLOBAL5=(Token)input.LT(1);
+            match(input,GLOBAL,FOLLOW_GLOBAL_in_global436); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global = factory.createGlobal();
+              	            global.setStartCharacter( ((CommonToken)GLOBAL5).getStartIndex() );
+              		    packageDescr.addGlobal( global );
+              		
+            }
+            pushFollow(FOLLOW_dotted_name_in_global447);
+            type=dotted_name();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global.setType( type );
+              		
+            }
+            pushFollow(FOLLOW_identifier_in_global458);
+            id=identifier();
+            _fsp--;
+            if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_global460);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		    global.setIdentifier( input.toString(id.start,id.stop) );
+              		    global.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end global
+
+
+    // $ANTLR start function
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:329:1: function : FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk ;
+    public final void function() throws RecognitionException {
+        Token FUNCTION6=null;
+        String retType = null;
+
+        identifier_return id = null;
+
+        String paramType = null;
+
+        String paramName = null;
+
+        curly_chunk_return body = null;
+
+
+        
+        		FunctionDescr f = null;
+        		String type = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:334:2: ( FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:3: FUNCTION (retType= dotted_name )? id= identifier LEFT_PAREN ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )? RIGHT_PAREN body= curly_chunk
+            {
+            FUNCTION6=(Token)input.LT(1);
+            match(input,FUNCTION,FOLLOW_FUNCTION_in_function485); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:19: (retType= dotted_name )?
+            int alt7=2;
+            int LA7_0 = input.LA(1);
+
+            if ( ((LA7_0>=PACKAGE && LA7_0<=ID)||LA7_0==GLOBAL||(LA7_0>=QUERY && LA7_0<=ATTRIBUTES)||LA7_0==ENABLED||LA7_0==SALIENCE||(LA7_0>=DURATION && LA7_0<=DIALECT)||LA7_0==FROM||(LA7_0>=INIT && LA7_0<=RESULT)||(LA7_0>=CONTAINS && LA7_0<=MEMBEROF)||LA7_0==IN||(LA7_0>=THEN && LA7_0<=EVENT)) ) {
+                int LA7_1 = input.LA(2);
+
+                if ( ((LA7_1>=PACKAGE && LA7_1<=GLOBAL)||(LA7_1>=QUERY && LA7_1<=ATTRIBUTES)||LA7_1==ENABLED||LA7_1==SALIENCE||(LA7_1>=DURATION && LA7_1<=DIALECT)||LA7_1==FROM||(LA7_1>=INIT && LA7_1<=RESULT)||(LA7_1>=CONTAINS && LA7_1<=MEMBEROF)||LA7_1==IN||LA7_1==LEFT_SQUARE||(LA7_1>=THEN && LA7_1<=EVENT)) ) {
+                    alt7=1;
+                }
+            }
+            switch (alt7) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:335:19: retType= dotted_name
+                    {
+                    pushFollow(FOLLOW_dotted_name_in_function489);
+                    retType=dotted_name();
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_identifier_in_function494);
+            id=identifier();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			//System.err.println( "function :: " + n.getText() );
+              			type = retType != null ? retType : null;
+              			f = factory.createFunction( input.toString(id.start,id.stop), type );
+              			f.setLocation(offset(FUNCTION6.getLine()), FUNCTION6.getCharPositionInLine());
+              	        	f.setStartCharacter( ((CommonToken)FUNCTION6).getStartIndex() );
+              			packageDescr.addFunction( f );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function503); if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:4: ( (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )* )?
+            int alt11=2;
+            int LA11_0 = input.LA(1);
+
+            if ( ((LA11_0>=PACKAGE && LA11_0<=ID)||LA11_0==GLOBAL||(LA11_0>=QUERY && LA11_0<=ATTRIBUTES)||LA11_0==ENABLED||LA11_0==SALIENCE||(LA11_0>=DURATION && LA11_0<=DIALECT)||LA11_0==FROM||(LA11_0>=INIT && LA11_0<=RESULT)||(LA11_0>=CONTAINS && LA11_0<=MEMBEROF)||LA11_0==IN||(LA11_0>=THEN && LA11_0<=EVENT)) ) {
+                alt11=1;
+            }
+            switch (alt11) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:6: (paramType= dotted_name )? paramName= argument ( COMMA (paramType= dotted_name )? paramName= argument )*
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:15: (paramType= dotted_name )?
+                    int alt8=2;
+                    alt8 = dfa8.predict(input);
+                    switch (alt8) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:345:15: paramType= dotted_name
+                            {
+                            pushFollow(FOLLOW_dotted_name_in_function512);
+                            paramType=dotted_name();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+                    pushFollow(FOLLOW_argument_in_function517);
+                    paramName=argument();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      					type = paramType != null ? paramType : null;
+                      					f.addParameter( type, paramName );
+                      				
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:5: ( COMMA (paramType= dotted_name )? paramName= argument )*
+                    loop10:
+                    do {
+                        int alt10=2;
+                        int LA10_0 = input.LA(1);
+
+                        if ( (LA10_0==COMMA) ) {
+                            alt10=1;
+                        }
+
+
+                        switch (alt10) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:7: COMMA (paramType= dotted_name )? paramName= argument
+                    	    {
+                    	    match(input,COMMA,FOLLOW_COMMA_in_function531); if (failed) return ;
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:22: (paramType= dotted_name )?
+                    	    int alt9=2;
+                    	    alt9 = dfa9.predict(input);
+                    	    switch (alt9) {
+                    	        case 1 :
+                    	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:350:22: paramType= dotted_name
+                    	            {
+                    	            pushFollow(FOLLOW_dotted_name_in_function535);
+                    	            paramType=dotted_name();
+                    	            _fsp--;
+                    	            if (failed) return ;
+
+                    	            }
+                    	            break;
+
+                    	    }
+
+                    	    pushFollow(FOLLOW_argument_in_function540);
+                    	    paramName=argument();
+                    	    _fsp--;
+                    	    if (failed) return ;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      						type = paramType != null ? paramType : null;
+                    	      						f.addParameter( type, paramName );
+                    	      					
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop10;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function564); if (failed) return ;
+            pushFollow(FOLLOW_curly_chunk_in_function570);
+            body=curly_chunk();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			//strip out '{','}'
+              			f.setText( safeSubstring( input.toString(body.start,body.stop), 1, input.toString(body.start,body.stop).length()-1 ) );
+              			f.setEndCharacter( ((CommonToken)((Token)body.stop)).getStopIndex() );
+              			f.setEndLocation(offset(((Token)body.stop).getLine()), ((Token)body.stop).getCharPositionInLine());
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end function
+
+
+    // $ANTLR start argument
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:367:1: argument returns [String name] : id= identifier ( '[' ']' )* ;
+    public final String argument() throws RecognitionException {
+        String name = null;
+
+        identifier_return id = null;
+
+
+        
+        		name = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:2: (id= identifier ( '[' ']' )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:4: id= identifier ( '[' ']' )*
+            {
+            pushFollow(FOLLOW_identifier_in_argument597);
+            id=identifier();
+            _fsp--;
+            if (failed) return name;
+            if ( backtracking==0 ) {
+               name =input.toString(id.start,id.stop); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:38: ( '[' ']' )*
+            loop12:
+            do {
+                int alt12=2;
+                int LA12_0 = input.LA(1);
+
+                if ( (LA12_0==LEFT_SQUARE) ) {
+                    alt12=1;
+                }
+
+
+                switch (alt12) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:371:40: '[' ']'
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_argument603); if (failed) return name;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_argument605); if (failed) return name;
+            	    if ( backtracking==0 ) {
+            	       name += "[]";
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop12;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return name;
+    }
+    // $ANTLR end argument
+
+
+    // $ANTLR start type_declaration
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:374:1: type_declaration returns [TypeDeclarationDescr declaration] : DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY ;
+    public final TypeDeclarationDescr type_declaration() throws RecognitionException {
+        TypeDeclarationDescr declaration = null;
+
+        identifier_return id = null;
+
+
+        
+                        declaration = factory.createTypeDeclaration();
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:378:9: ( DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:378:11: DECLARE id= identifier LEFT_CURLY type_decl_attribute[$declaration] ( COMMA type_decl_attribute[$declaration] )* RIGHT_CURLY
+            {
+            match(input,DECLARE,FOLLOW_DECLARE_in_type_declaration645); if (failed) return declaration;
+            pushFollow(FOLLOW_identifier_in_type_declaration649);
+            id=identifier();
+            _fsp--;
+            if (failed) return declaration;
+            if ( backtracking==0 ) {
+              
+                                          declaration.setTypeName( input.toString(id.start,id.stop) );
+                                      
+            }
+            match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_type_declaration694); if (failed) return declaration;
+            pushFollow(FOLLOW_type_decl_attribute_in_type_declaration720);
+            type_decl_attribute(declaration);
+            _fsp--;
+            if (failed) return declaration;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:383:59: ( COMMA type_decl_attribute[$declaration] )*
+            loop13:
+            do {
+                int alt13=2;
+                int LA13_0 = input.LA(1);
+
+                if ( (LA13_0==COMMA) ) {
+                    alt13=1;
+                }
+
+
+                switch (alt13) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:383:61: COMMA type_decl_attribute[$declaration]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_type_declaration725); if (failed) return declaration;
+            	    pushFollow(FOLLOW_type_decl_attribute_in_type_declaration727);
+            	    type_decl_attribute(declaration);
+            	    _fsp--;
+            	    if (failed) return declaration;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop13;
+                }
+            } while (true);
+
+            match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_type_declaration749); if (failed) return declaration;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return declaration;
+    }
+    // $ANTLR end type_declaration
+
+
+    // $ANTLR start type_decl_attribute
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:387:1: type_decl_attribute[TypeDeclarationDescr declaration] : att= identifier (val= STRING | cl= dotted_name ) ;
+    public final void type_decl_attribute(TypeDeclarationDescr declaration) throws RecognitionException {
+        Token val=null;
+        identifier_return att = null;
+
+        String cl = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:388:9: (att= identifier (val= STRING | cl= dotted_name ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:388:11: att= identifier (val= STRING | cl= dotted_name )
+            {
+            pushFollow(FOLLOW_identifier_in_type_decl_attribute785);
+            att=identifier();
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:389:17: (val= STRING | cl= dotted_name )
+            int alt14=2;
+            int LA14_0 = input.LA(1);
+
+            if ( (LA14_0==STRING) ) {
+                alt14=1;
+            }
+            else if ( ((LA14_0>=PACKAGE && LA14_0<=ID)||LA14_0==GLOBAL||(LA14_0>=QUERY && LA14_0<=ATTRIBUTES)||LA14_0==ENABLED||LA14_0==SALIENCE||(LA14_0>=DURATION && LA14_0<=DIALECT)||LA14_0==FROM||(LA14_0>=INIT && LA14_0<=RESULT)||(LA14_0>=CONTAINS && LA14_0<=MEMBEROF)||LA14_0==IN||(LA14_0>=THEN && LA14_0<=EVENT)) ) {
+                alt14=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("389:17: (val= STRING | cl= dotted_name )", 14, 0, input);
+
+                throw nvae;
+            }
+            switch (alt14) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:389:19: val= STRING
+                    {
+                    val=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_type_decl_attribute808); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                                          declaration.addAttribute( input.toString(att.start,att.stop), getString( val.getText() ) );
+                                      
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:393:19: cl= dotted_name
+                    {
+                    pushFollow(FOLLOW_dotted_name_in_type_decl_attribute849);
+                    cl=dotted_name();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                                          declaration.addAttribute( input.toString(att.start,att.stop), cl );
+                                      
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end type_decl_attribute
+
+
+    // $ANTLR start query
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:400:1: query returns [QueryDescr query] : QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon ;
+    public final QueryDescr query() throws RecognitionException {
+        QueryDescr query = null;
+
+        Token paramName=null;
+        Token QUERY7=null;
+        Token END8=null;
+        name_return queryName = null;
+
+        qualified_id_return paramType = null;
+
+
+        
+        		query = null;
+        		AndDescr lhs = null;
+        		List params = null;
+        		List types = null;		
+         
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:408:2: ( QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:409:3: QUERY queryName= name ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )? normal_lhs_block[lhs] END opt_semicolon
+            {
+            QUERY7=(Token)input.LT(1);
+            match(input,QUERY,FOLLOW_QUERY_in_query922); if (failed) return query;
+            pushFollow(FOLLOW_name_in_query926);
+            queryName=name();
+            _fsp--;
+            if (failed) return query;
+            if ( backtracking==0 ) {
+               
+              			query = factory.createQuery( queryName.name ); 
+              			query.setLocation( offset(QUERY7.getLine()), QUERY7.getCharPositionInLine() );
+              			query.setStartCharacter( ((CommonToken)QUERY7).getStartIndex() );
+              			lhs = new AndDescr(); query.setLhs( lhs ); 
+              			lhs.setLocation( offset(QUERY7.getLine()), QUERY7.getCharPositionInLine() );
+                                      location.setType( Location.LOCATION_RULE_HEADER );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:418:3: ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )?
+            int alt19=2;
+            alt19 = dfa19.predict(input);
+            switch (alt19) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:418:5: LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_query936); if (failed) return query;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:419:11: ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )?
+                    int alt18=2;
+                    int LA18_0 = input.LA(1);
+
+                    if ( (LA18_0==ID) ) {
+                        alt18=1;
+                    }
+                    switch (alt18) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:419:13: ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )*
+                            {
+                            if ( backtracking==0 ) {
+                               params = new ArrayList(); types = new ArrayList();
+                            }
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:15: ( (paramType= qualified_id )? paramName= ID )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:16: (paramType= qualified_id )? paramName= ID
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:25: (paramType= qualified_id )?
+                            int alt15=2;
+                            int LA15_0 = input.LA(1);
+
+                            if ( (LA15_0==ID) ) {
+                                int LA15_1 = input.LA(2);
+
+                                if ( ((LA15_1>=ID && LA15_1<=DOT)||LA15_1==LEFT_SQUARE) ) {
+                                    alt15=1;
+                                }
+                            }
+                            switch (alt15) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:421:25: paramType= qualified_id
+                                    {
+                                    pushFollow(FOLLOW_qualified_id_in_query971);
+                                    paramType=qualified_id();
+                                    _fsp--;
+                                    if (failed) return query;
+
+                                    }
+                                    break;
+
+                            }
+
+                            paramName=(Token)input.LT(1);
+                            match(input,ID,FOLLOW_ID_in_query976); if (failed) return query;
+                            if ( backtracking==0 ) {
+                               params.add( paramName.getText() ); String type = (paramType != null) ? paramType.text : "Object"; types.add( type ); 
+                            }
+
+                            }
+
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:15: ( COMMA (paramType= qualified_id )? paramName= ID )*
+                            loop17:
+                            do {
+                                int alt17=2;
+                                int LA17_0 = input.LA(1);
+
+                                if ( (LA17_0==COMMA) ) {
+                                    alt17=1;
+                                }
+
+
+                                switch (alt17) {
+                            	case 1 :
+                            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:16: COMMA (paramType= qualified_id )? paramName= ID
+                            	    {
+                            	    match(input,COMMA,FOLLOW_COMMA_in_query997); if (failed) return query;
+                            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:31: (paramType= qualified_id )?
+                            	    int alt16=2;
+                            	    int LA16_0 = input.LA(1);
+
+                            	    if ( (LA16_0==ID) ) {
+                            	        int LA16_1 = input.LA(2);
+
+                            	        if ( ((LA16_1>=ID && LA16_1<=DOT)||LA16_1==LEFT_SQUARE) ) {
+                            	            alt16=1;
+                            	        }
+                            	    }
+                            	    switch (alt16) {
+                            	        case 1 :
+                            	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:422:31: paramType= qualified_id
+                            	            {
+                            	            pushFollow(FOLLOW_qualified_id_in_query1001);
+                            	            paramType=qualified_id();
+                            	            _fsp--;
+                            	            if (failed) return query;
+
+                            	            }
+                            	            break;
+
+                            	    }
+
+                            	    paramName=(Token)input.LT(1);
+                            	    match(input,ID,FOLLOW_ID_in_query1006); if (failed) return query;
+                            	    if ( backtracking==0 ) {
+                            	       params.add( paramName.getText() );  String type = (paramType != null) ? paramType.text : "Object"; types.add( type );  
+                            	    }
+
+                            	    }
+                            	    break;
+
+                            	default :
+                            	    break loop17;
+                                }
+                            } while (true);
+
+                            if ( backtracking==0 ) {
+                              	query.setParameters( (String[]) params.toArray( new String[params.size()] ) ); 
+                              		            	query.setParameterTypes( (String[]) types.toArray( new String[types.size()] ) ); 
+                              		            
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_query1056); if (failed) return query;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+                                      location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              	        
+            }
+            pushFollow(FOLLOW_normal_lhs_block_in_query1085);
+            normal_lhs_block(lhs);
+            _fsp--;
+            if (failed) return query;
+            END8=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_query1090); if (failed) return query;
+            pushFollow(FOLLOW_opt_semicolon_in_query1092);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return query;
+            if ( backtracking==0 ) {
+              
+              			query.setEndCharacter( ((CommonToken)END8).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return query;
+    }
+    // $ANTLR end query
+
+
+    // $ANTLR start template
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:440:1: template returns [FactTemplateDescr template] : TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon ;
+    public final FactTemplateDescr template() throws RecognitionException {
+        FactTemplateDescr template = null;
+
+        Token TEMPLATE9=null;
+        Token END10=null;
+        name_return templateName = null;
+
+        FieldTemplateDescr slot = null;
+
+
+        
+        		template = null;		
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:444:2: ( TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:445:3: TEMPLATE templateName= name opt_semicolon (slot= template_slot )+ END opt_semicolon
+            {
+            TEMPLATE9=(Token)input.LT(1);
+            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_template1120); if (failed) return template;
+            pushFollow(FOLLOW_name_in_template1124);
+            templateName=name();
+            _fsp--;
+            if (failed) return template;
+            pushFollow(FOLLOW_opt_semicolon_in_template1126);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return template;
+            if ( backtracking==0 ) {
+              
+              			template = new FactTemplateDescr(templateName.name);
+              			template.setLocation( offset(TEMPLATE9.getLine()), TEMPLATE9.getCharPositionInLine() );			
+              			template.setStartCharacter( ((CommonToken)TEMPLATE9).getStartIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:451:3: (slot= template_slot )+
+            int cnt20=0;
+            loop20:
+            do {
+                int alt20=2;
+                int LA20_0 = input.LA(1);
+
+                if ( (LA20_0==ID) ) {
+                    alt20=1;
+                }
+
+
+                switch (alt20) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:452:4: slot= template_slot
+            	    {
+            	    pushFollow(FOLLOW_template_slot_in_template1141);
+            	    slot=template_slot();
+            	    _fsp--;
+            	    if (failed) return template;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				template.addFieldTemplate( slot );
+            	      			
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    if ( cnt20 >= 1 ) break loop20;
+            	    if (backtracking>0) {failed=true; return template;}
+                        EarlyExitException eee =
+                            new EarlyExitException(20, input);
+                        throw eee;
+                }
+                cnt20++;
+            } while (true);
+
+            END10=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_template1156); if (failed) return template;
+            pushFollow(FOLLOW_opt_semicolon_in_template1158);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return template;
+            if ( backtracking==0 ) {
+              
+              			template.setEndCharacter( ((CommonToken)END10).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return template;
+    }
+    // $ANTLR end template
+
+
+    // $ANTLR start template_slot
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:463:1: template_slot returns [FieldTemplateDescr field] : fieldType= qualified_id id= identifier opt_semicolon ;
+    public final FieldTemplateDescr template_slot() throws RecognitionException {
+        FieldTemplateDescr field = null;
+
+        qualified_id_return fieldType = null;
+
+        identifier_return id = null;
+
+
+        
+        		field = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:467:2: (fieldType= qualified_id id= identifier opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:468:11: fieldType= qualified_id id= identifier opt_semicolon
+            {
+            if ( backtracking==0 ) {
+              
+              			field = factory.createFieldTemplate();
+              	         
+            }
+            pushFollow(FOLLOW_qualified_id_in_template_slot1204);
+            fieldType=qualified_id();
+            _fsp--;
+            if (failed) return field;
+            if ( backtracking==0 ) {
+              
+              		        field.setClassType( fieldType.text );
+              			field.setStartCharacter( ((CommonToken)((Token)fieldType.start)).getStartIndex() );
+              			field.setEndCharacter( ((CommonToken)((Token)fieldType.stop)).getStopIndex() );
+              		 
+            }
+            pushFollow(FOLLOW_identifier_in_template_slot1220);
+            id=identifier();
+            _fsp--;
+            if (failed) return field;
+            pushFollow(FOLLOW_opt_semicolon_in_template_slot1222);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return field;
+            if ( backtracking==0 ) {
+              
+              		        field.setName( input.toString(id.start,id.stop) );
+              			field.setLocation( offset(((Token)id.start).getLine()), ((Token)id.start).getCharPositionInLine() );
+              			field.setEndCharacter( ((CommonToken)((Token)id.start)).getStopIndex() );
+              		 
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return field;
+    }
+    // $ANTLR end template_slot
+
+
+    // $ANTLR start rule
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:486:1: rule returns [RuleDescr rule] : RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule] ;
+    public final RuleDescr rule() throws RecognitionException {
+        RuleDescr rule = null;
+
+        Token RULE11=null;
+        Token WHEN12=null;
+        name_return ruleName = null;
+
+
+        
+        		rule = null;
+        		AndDescr lhs = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:491:2: ( RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:492:3: RULE ruleName= name ( rule_attributes[$rule] )? ( WHEN ( ':' )? normal_lhs_block[lhs] )? rhs_chunk[$rule]
+            {
+            RULE11=(Token)input.LT(1);
+            match(input,RULE,FOLLOW_RULE_in_rule1253); if (failed) return rule;
+            pushFollow(FOLLOW_name_in_rule1257);
+            ruleName=name();
+            _fsp--;
+            if (failed) return rule;
+            if ( backtracking==0 ) {
+               
+              			location.setType( Location.LOCATION_RULE_HEADER );
+              			debug( "start rule: " + ruleName.name );
+              			rule = new RuleDescr( ruleName.name, null ); 
+              			rule.setLocation( offset(RULE11.getLine()), RULE11.getCharPositionInLine() );
+              			rule.setStartCharacter( ((CommonToken)RULE11).getStartIndex() );
+              			lhs = new AndDescr(); 
+              			rule.setLhs( lhs ); 
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:502:3: ( rule_attributes[$rule] )?
+            int alt21=2;
+            int LA21_0 = input.LA(1);
+
+            if ( ((LA21_0>=ATTRIBUTES && LA21_0<=ENABLED)||LA21_0==SALIENCE||(LA21_0>=NO_LOOP && LA21_0<=LOCK_ON_ACTIVE)) ) {
+                alt21=1;
+            }
+            switch (alt21) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:502:3: rule_attributes[$rule]
+                    {
+                    pushFollow(FOLLOW_rule_attributes_in_rule1266);
+                    rule_attributes(rule);
+                    _fsp--;
+                    if (failed) return rule;
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:503:3: ( WHEN ( ':' )? normal_lhs_block[lhs] )?
+            int alt23=2;
+            int LA23_0 = input.LA(1);
+
+            if ( (LA23_0==WHEN) ) {
+                alt23=1;
+            }
+            switch (alt23) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:4: WHEN ( ':' )? normal_lhs_block[lhs]
+                    {
+                    WHEN12=(Token)input.LT(1);
+                    match(input,WHEN,FOLLOW_WHEN_in_rule1278); if (failed) return rule;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:9: ( ':' )?
+                    int alt22=2;
+                    int LA22_0 = input.LA(1);
+
+                    if ( (LA22_0==79) ) {
+                        alt22=1;
+                    }
+                    switch (alt22) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:504:9: ':'
+                            {
+                            match(input,79,FOLLOW_79_in_rule1280); if (failed) return rule;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                       
+                      				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+                      				lhs.setLocation( offset(WHEN12.getLine()), WHEN12.getCharPositionInLine() );
+                      				lhs.setStartCharacter( ((CommonToken)WHEN12).getStartIndex() );
+                      			
+                    }
+                    pushFollow(FOLLOW_normal_lhs_block_in_rule1291);
+                    normal_lhs_block(lhs);
+                    _fsp--;
+                    if (failed) return rule;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_rhs_chunk_in_rule1301);
+            rhs_chunk(rule);
+            _fsp--;
+            if (failed) return rule;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return rule;
+    }
+    // $ANTLR end rule
+
+
+    // $ANTLR start rule_attributes
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:517:1: rule_attributes[RuleDescr rule] : ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )* ;
+    public final void rule_attributes(RuleDescr rule) throws RecognitionException {
+        AttributeDescr attr = null;
+
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:518:2: ( ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:2: ( ATTRIBUTES ':' )? attr= rule_attribute ( ( ',' )? attr= rule_attribute )*
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:2: ( ATTRIBUTES ':' )?
+            int alt24=2;
+            int LA24_0 = input.LA(1);
+
+            if ( (LA24_0==ATTRIBUTES) ) {
+                alt24=1;
+            }
+            switch (alt24) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:519:4: ATTRIBUTES ':'
+                    {
+                    match(input,ATTRIBUTES,FOLLOW_ATTRIBUTES_in_rule_attributes1321); if (failed) return ;
+                    match(input,79,FOLLOW_79_in_rule_attributes1323); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_rule_attribute_in_rule_attributes1331);
+            attr=rule_attribute();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+               rule.addAttribute( attr ); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:2: ( ( ',' )? attr= rule_attribute )*
+            loop26:
+            do {
+                int alt26=2;
+                int LA26_0 = input.LA(1);
+
+                if ( (LA26_0==COMMA||(LA26_0>=DATE_EFFECTIVE && LA26_0<=ENABLED)||LA26_0==SALIENCE||(LA26_0>=NO_LOOP && LA26_0<=LOCK_ON_ACTIVE)) ) {
+                    alt26=1;
+                }
+
+
+                switch (alt26) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ( ',' )? attr= rule_attribute
+            	    {
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ( ',' )?
+            	    int alt25=2;
+            	    int LA25_0 = input.LA(1);
+
+            	    if ( (LA25_0==COMMA) ) {
+            	        alt25=1;
+            	    }
+            	    switch (alt25) {
+            	        case 1 :
+            	            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:521:4: ','
+            	            {
+            	            match(input,COMMA,FOLLOW_COMMA_in_rule_attributes1338); if (failed) return ;
+
+            	            }
+            	            break;
+
+            	    }
+
+            	    pushFollow(FOLLOW_rule_attribute_in_rule_attributes1343);
+            	    attr=rule_attribute();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       rule.addAttribute( attr ); 
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop26;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end rule_attributes
+
+
+    // $ANTLR start rule_attribute
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:526:1: rule_attribute returns [AttributeDescr attr] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect );
+    public final AttributeDescr rule_attribute() throws RecognitionException {
+        AttributeDescr attr = null;
+
+        AttributeDescr a = null;
+
+
+        
+        		attr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:533:2: (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect )
+            int alt27=12;
+            switch ( input.LA(1) ) {
+            case SALIENCE:
+                {
+                alt27=1;
+                }
+                break;
+            case NO_LOOP:
+                {
+                alt27=2;
+                }
+                break;
+            case AGENDA_GROUP:
+                {
+                alt27=3;
+                }
+                break;
+            case DURATION:
+                {
+                alt27=4;
+                }
+                break;
+            case ACTIVATION_GROUP:
+                {
+                alt27=5;
+                }
+                break;
+            case AUTO_FOCUS:
+                {
+                alt27=6;
+                }
+                break;
+            case DATE_EFFECTIVE:
+                {
+                alt27=7;
+                }
+                break;
+            case DATE_EXPIRES:
+                {
+                alt27=8;
+                }
+                break;
+            case ENABLED:
+                {
+                alt27=9;
+                }
+                break;
+            case RULEFLOW_GROUP:
+                {
+                alt27=10;
+                }
+                break;
+            case LOCK_ON_ACTIVE:
+                {
+                alt27=11;
+                }
+                break;
+            case DIALECT:
+                {
+                alt27=12;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return attr;}
+                NoViableAltException nvae =
+                    new NoViableAltException("526:1: rule_attribute returns [AttributeDescr attr] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= activation_group | a= auto_focus | a= date_effective | a= date_expires | a= enabled | a= ruleflow_group | a= lock_on_active | a= dialect );", 27, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt27) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:533:4: a= salience
+                    {
+                    pushFollow(FOLLOW_salience_in_rule_attribute1380);
+                    a=salience();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:534:4: a= no_loop
+                    {
+                    pushFollow(FOLLOW_no_loop_in_rule_attribute1388);
+                    a=no_loop();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:535:4: a= agenda_group
+                    {
+                    pushFollow(FOLLOW_agenda_group_in_rule_attribute1397);
+                    a=agenda_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:536:4: a= duration
+                    {
+                    pushFollow(FOLLOW_duration_in_rule_attribute1406);
+                    a=duration();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:537:4: a= activation_group
+                    {
+                    pushFollow(FOLLOW_activation_group_in_rule_attribute1415);
+                    a=activation_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:538:4: a= auto_focus
+                    {
+                    pushFollow(FOLLOW_auto_focus_in_rule_attribute1423);
+                    a=auto_focus();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:539:4: a= date_effective
+                    {
+                    pushFollow(FOLLOW_date_effective_in_rule_attribute1431);
+                    a=date_effective();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:540:4: a= date_expires
+                    {
+                    pushFollow(FOLLOW_date_expires_in_rule_attribute1439);
+                    a=date_expires();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:541:4: a= enabled
+                    {
+                    pushFollow(FOLLOW_enabled_in_rule_attribute1447);
+                    a=enabled();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 10 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:542:4: a= ruleflow_group
+                    {
+                    pushFollow(FOLLOW_ruleflow_group_in_rule_attribute1455);
+                    a=ruleflow_group();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 11 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:543:4: a= lock_on_active
+                    {
+                    pushFollow(FOLLOW_lock_on_active_in_rule_attribute1463);
+                    a=lock_on_active();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+                case 12 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:544:4: a= dialect
+                    {
+                    pushFollow(FOLLOW_dialect_in_rule_attribute1470);
+                    a=dialect();
+                    _fsp--;
+                    if (failed) return attr;
+
+                    }
+                    break;
+
+            }
+            if ( backtracking==0 ) {
+              
+              		attr = a;
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return attr;
+    }
+    // $ANTLR end rule_attribute
+
+
+    // $ANTLR start date_effective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:547:1: date_effective returns [AttributeDescr descr] : DATE_EFFECTIVE STRING ;
+    public final AttributeDescr date_effective() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING13=null;
+        Token DATE_EFFECTIVE14=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:551:2: ( DATE_EFFECTIVE STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:552:3: DATE_EFFECTIVE STRING
+            {
+            DATE_EFFECTIVE14=(Token)input.LT(1);
+            match(input,DATE_EFFECTIVE,FOLLOW_DATE_EFFECTIVE_in_date_effective1496); if (failed) return descr;
+            STRING13=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_date_effective1498); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "date-effective", getString( STRING13.getText() ) );
+              			descr.setLocation( offset( DATE_EFFECTIVE14.getLine() ), DATE_EFFECTIVE14.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DATE_EFFECTIVE14).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING13).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end date_effective
+
+
+    // $ANTLR start date_expires
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:562:1: date_expires returns [AttributeDescr descr] : DATE_EXPIRES STRING ;
+    public final AttributeDescr date_expires() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING15=null;
+        Token DATE_EXPIRES16=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:566:2: ( DATE_EXPIRES STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:566:4: DATE_EXPIRES STRING
+            {
+            DATE_EXPIRES16=(Token)input.LT(1);
+            match(input,DATE_EXPIRES,FOLLOW_DATE_EXPIRES_in_date_expires1527); if (failed) return descr;
+            STRING15=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_date_expires1529); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "date-expires", getString( STRING15.getText() ) );
+              			descr.setLocation( offset(DATE_EXPIRES16.getLine()), DATE_EXPIRES16.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DATE_EXPIRES16).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING15).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end date_expires
+
+
+    // $ANTLR start enabled
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:575:1: enabled returns [AttributeDescr descr] : ENABLED BOOL ;
+    public final AttributeDescr enabled() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token BOOL17=null;
+        Token ENABLED18=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:579:2: ( ENABLED BOOL )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:579:5: ENABLED BOOL
+            {
+            ENABLED18=(Token)input.LT(1);
+            match(input,ENABLED,FOLLOW_ENABLED_in_enabled1558); if (failed) return descr;
+            BOOL17=(Token)input.LT(1);
+            match(input,BOOL,FOLLOW_BOOL_in_enabled1560); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              				descr = new AttributeDescr( "enabled", BOOL17.getText() );
+              				descr.setLocation( offset(ENABLED18.getLine()), ENABLED18.getCharPositionInLine() );
+              				descr.setStartCharacter( ((CommonToken)ENABLED18).getStartIndex() );
+              				descr.setEndCharacter( ((CommonToken)BOOL17).getStopIndex() );
+              			
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end enabled
+
+
+    // $ANTLR start salience
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:588:1: salience returns [AttributeDescr descr] : SALIENCE ( INT | txt= paren_chunk ) ;
+    public final AttributeDescr salience() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token SALIENCE19=null;
+        Token INT20=null;
+        paren_chunk_return txt = null;
+
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:592:2: ( SALIENCE ( INT | txt= paren_chunk ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:593:3: SALIENCE ( INT | txt= paren_chunk )
+            {
+            SALIENCE19=(Token)input.LT(1);
+            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience1593); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "salience" );
+              			descr.setLocation( offset(SALIENCE19.getLine()), SALIENCE19.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)SALIENCE19).getStartIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:599:3: ( INT | txt= paren_chunk )
+            int alt28=2;
+            int LA28_0 = input.LA(1);
+
+            if ( (LA28_0==INT) ) {
+                alt28=1;
+            }
+            else if ( (LA28_0==LEFT_PAREN) ) {
+                alt28=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return descr;}
+                NoViableAltException nvae =
+                    new NoViableAltException("599:3: ( INT | txt= paren_chunk )", 28, 0, input);
+
+                throw nvae;
+            }
+            switch (alt28) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:599:5: INT
+                    {
+                    INT20=(Token)input.LT(1);
+                    match(input,INT,FOLLOW_INT_in_salience1604); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      			descr.setValue( INT20.getText() );
+                      			descr.setEndCharacter( ((CommonToken)INT20).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:604:5: txt= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_salience1619);
+                    txt=paren_chunk();
+                    _fsp--;
+                    if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      			descr.setValue( input.toString(txt.start,txt.stop) );
+                      			descr.setEndCharacter( ((CommonToken)((Token)txt.stop)).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end salience
+
+
+    // $ANTLR start no_loop
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:612:1: no_loop returns [AttributeDescr descr] : NO_LOOP ( BOOL )? ;
+    public final AttributeDescr no_loop() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token NO_LOOP21=null;
+        Token BOOL22=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:616:2: ( NO_LOOP ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:616:4: NO_LOOP ( BOOL )?
+            {
+            NO_LOOP21=(Token)input.LT(1);
+            match(input,NO_LOOP,FOLLOW_NO_LOOP_in_no_loop1649); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "no-loop", "true" );
+              			descr.setLocation( offset(NO_LOOP21.getLine()), NO_LOOP21.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)NO_LOOP21).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)NO_LOOP21).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:623:3: ( BOOL )?
+            int alt29=2;
+            int LA29_0 = input.LA(1);
+
+            if ( (LA29_0==BOOL) ) {
+                alt29=1;
+            }
+            switch (alt29) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:623:5: BOOL
+                    {
+                    BOOL22=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_no_loop1662); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL22.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL22).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end no_loop
+
+
+    // $ANTLR start auto_focus
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:631:1: auto_focus returns [AttributeDescr descr] : AUTO_FOCUS ( BOOL )? ;
+    public final AttributeDescr auto_focus() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token AUTO_FOCUS23=null;
+        Token BOOL24=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:635:2: ( AUTO_FOCUS ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:635:4: AUTO_FOCUS ( BOOL )?
+            {
+            AUTO_FOCUS23=(Token)input.LT(1);
+            match(input,AUTO_FOCUS,FOLLOW_AUTO_FOCUS_in_auto_focus1697); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "auto-focus", "true" );
+              			descr.setLocation( offset(AUTO_FOCUS23.getLine()), AUTO_FOCUS23.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)AUTO_FOCUS23).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)AUTO_FOCUS23).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:642:3: ( BOOL )?
+            int alt30=2;
+            int LA30_0 = input.LA(1);
+
+            if ( (LA30_0==BOOL) ) {
+                alt30=1;
+            }
+            switch (alt30) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:642:5: BOOL
+                    {
+                    BOOL24=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_auto_focus1710); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL24.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL24).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end auto_focus
+
+
+    // $ANTLR start activation_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:650:1: activation_group returns [AttributeDescr descr] : ACTIVATION_GROUP STRING ;
+    public final AttributeDescr activation_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING25=null;
+        Token ACTIVATION_GROUP26=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:654:2: ( ACTIVATION_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:654:4: ACTIVATION_GROUP STRING
+            {
+            ACTIVATION_GROUP26=(Token)input.LT(1);
+            match(input,ACTIVATION_GROUP,FOLLOW_ACTIVATION_GROUP_in_activation_group1746); if (failed) return descr;
+            STRING25=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_activation_group1748); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "activation-group", getString( STRING25.getText() ) );
+              			descr.setLocation( offset(ACTIVATION_GROUP26.getLine()), ACTIVATION_GROUP26.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)ACTIVATION_GROUP26).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING25).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end activation_group
+
+
+    // $ANTLR start ruleflow_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:663:1: ruleflow_group returns [AttributeDescr descr] : RULEFLOW_GROUP STRING ;
+    public final AttributeDescr ruleflow_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING27=null;
+        Token RULEFLOW_GROUP28=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:667:2: ( RULEFLOW_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:667:4: RULEFLOW_GROUP STRING
+            {
+            RULEFLOW_GROUP28=(Token)input.LT(1);
+            match(input,RULEFLOW_GROUP,FOLLOW_RULEFLOW_GROUP_in_ruleflow_group1776); if (failed) return descr;
+            STRING27=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_ruleflow_group1778); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "ruleflow-group", getString( STRING27.getText() ) );
+              			descr.setLocation( offset(RULEFLOW_GROUP28.getLine()), RULEFLOW_GROUP28.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)RULEFLOW_GROUP28).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING27).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end ruleflow_group
+
+
+    // $ANTLR start agenda_group
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:676:1: agenda_group returns [AttributeDescr descr] : AGENDA_GROUP STRING ;
+    public final AttributeDescr agenda_group() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING29=null;
+        Token AGENDA_GROUP30=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:680:2: ( AGENDA_GROUP STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:680:4: AGENDA_GROUP STRING
+            {
+            AGENDA_GROUP30=(Token)input.LT(1);
+            match(input,AGENDA_GROUP,FOLLOW_AGENDA_GROUP_in_agenda_group1806); if (failed) return descr;
+            STRING29=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_agenda_group1808); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "agenda-group", getString( STRING29.getText() ) );
+              			descr.setLocation( offset(AGENDA_GROUP30.getLine()), AGENDA_GROUP30.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)AGENDA_GROUP30).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING29).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end agenda_group
+
+
+    // $ANTLR start duration
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:689:1: duration returns [AttributeDescr descr] : DURATION INT ;
+    public final AttributeDescr duration() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token INT31=null;
+        Token DURATION32=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:693:2: ( DURATION INT )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:693:4: DURATION INT
+            {
+            DURATION32=(Token)input.LT(1);
+            match(input,DURATION,FOLLOW_DURATION_in_duration1836); if (failed) return descr;
+            INT31=(Token)input.LT(1);
+            match(input,INT,FOLLOW_INT_in_duration1838); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "duration", INT31.getText() );
+              			descr.setLocation( offset(DURATION32.getLine()), DURATION32.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DURATION32).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)INT31).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end duration
+
+
+    // $ANTLR start dialect
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:702:1: dialect returns [AttributeDescr descr] : DIALECT STRING ;
+    public final AttributeDescr dialect() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token STRING33=null;
+        Token DIALECT34=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:706:2: ( DIALECT STRING )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:706:4: DIALECT STRING
+            {
+            DIALECT34=(Token)input.LT(1);
+            match(input,DIALECT,FOLLOW_DIALECT_in_dialect1866); if (failed) return descr;
+            STRING33=(Token)input.LT(1);
+            match(input,STRING,FOLLOW_STRING_in_dialect1868); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "dialect", getString( STRING33.getText() ) );
+              			descr.setLocation( offset(DIALECT34.getLine()), DIALECT34.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)DIALECT34).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)STRING33).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end dialect
+
+
+    // $ANTLR start lock_on_active
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:715:1: lock_on_active returns [AttributeDescr descr] : LOCK_ON_ACTIVE ( BOOL )? ;
+    public final AttributeDescr lock_on_active() throws RecognitionException {
+        AttributeDescr descr = null;
+
+        Token LOCK_ON_ACTIVE35=null;
+        Token BOOL36=null;
+
+        
+        		descr = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:719:2: ( LOCK_ON_ACTIVE ( BOOL )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:719:4: LOCK_ON_ACTIVE ( BOOL )?
+            {
+            LOCK_ON_ACTIVE35=(Token)input.LT(1);
+            match(input,LOCK_ON_ACTIVE,FOLLOW_LOCK_ON_ACTIVE_in_lock_on_active1900); if (failed) return descr;
+            if ( backtracking==0 ) {
+              
+              			descr = new AttributeDescr( "lock-on-active", "true" );
+              			descr.setLocation( offset(LOCK_ON_ACTIVE35.getLine()), LOCK_ON_ACTIVE35.getCharPositionInLine() );
+              			descr.setStartCharacter( ((CommonToken)LOCK_ON_ACTIVE35).getStartIndex() );
+              			descr.setEndCharacter( ((CommonToken)LOCK_ON_ACTIVE35).getStopIndex() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:726:3: ( BOOL )?
+            int alt31=2;
+            int LA31_0 = input.LA(1);
+
+            if ( (LA31_0==BOOL) ) {
+                alt31=1;
+            }
+            switch (alt31) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:726:5: BOOL
+                    {
+                    BOOL36=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_lock_on_active1913); if (failed) return descr;
+                    if ( backtracking==0 ) {
+                      
+                      				descr.setValue( BOOL36.getText() );
+                      				descr.setEndCharacter( ((CommonToken)BOOL36).getStopIndex() );
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return descr;
+    }
+    // $ANTLR end lock_on_active
+
+
+    // $ANTLR start normal_lhs_block
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:734:1: normal_lhs_block[AndDescr descr] : (d= lhs[$descr] )* ;
+    public final void normal_lhs_block(AndDescr descr) throws RecognitionException {
+        BaseDescr d = null;
+
+
+        
+        		location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:738:2: ( (d= lhs[$descr] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:3: (d= lhs[$descr] )*
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:3: (d= lhs[$descr] )*
+            loop32:
+            do {
+                int alt32=2;
+                int LA32_0 = input.LA(1);
+
+                if ( (LA32_0==ID||LA32_0==LEFT_PAREN||(LA32_0>=EXISTS && LA32_0<=FORALL)) ) {
+                    alt32=1;
+                }
+
+
+                switch (alt32) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:739:5: d= lhs[$descr]
+            	    {
+            	    pushFollow(FOLLOW_lhs_in_normal_lhs_block1952);
+            	    d=lhs(descr);
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       if( d != null) descr.addDescr( d ); 
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop32;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end normal_lhs_block
+
+
+    // $ANTLR start lhs
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:745:1: lhs[ConditionalElementDescr ce] returns [BaseDescr d] : l= lhs_or ;
+    public final BaseDescr lhs(ConditionalElementDescr ce) throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr l = null;
+
+
+        
+        		d =null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:749:2: (l= lhs_or )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:749:4: l= lhs_or
+            {
+            pushFollow(FOLLOW_lhs_or_in_lhs1989);
+            l=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               d = l; 
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs
+
+
+    // $ANTLR start lhs_or
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );
+    public final BaseDescr lhs_or() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr lhsand = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d = null;
+        		OrDescr or = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:758:2: ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* )
+            int alt35=2;
+            int LA35_0 = input.LA(1);
+
+            if ( (LA35_0==LEFT_PAREN) ) {
+                int LA35_1 = input.LA(2);
+
+                if ( (LA35_1==ID||LA35_1==LEFT_PAREN||LA35_1==AND||(LA35_1>=EXISTS && LA35_1<=FORALL)) ) {
+                    alt35=2;
+                }
+                else if ( (LA35_1==OR) ) {
+                    alt35=1;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );", 35, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA35_0==ID||(LA35_0>=EXISTS && LA35_0<=FORALL)) ) {
+                alt35=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("753:1: lhs_or returns [BaseDescr d] : ( LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN | left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )* );", 35, 0, input);
+
+                throw nvae;
+            }
+            switch (alt35) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:758:4: LEFT_PAREN OR (lhsand= lhs_and )+ RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_or2014); if (failed) return d;
+                    match(input,OR,FOLLOW_OR_in_lhs_or2016); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      			or = new OrDescr();
+                      			d = or;
+                      			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:764:3: (lhsand= lhs_and )+
+                    int cnt33=0;
+                    loop33:
+                    do {
+                        int alt33=2;
+                        int LA33_0 = input.LA(1);
+
+                        if ( (LA33_0==ID||LA33_0==LEFT_PAREN||(LA33_0>=EXISTS && LA33_0<=FORALL)) ) {
+                            alt33=1;
+                        }
+
+
+                        switch (alt33) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:764:5: lhsand= lhs_and
+                    	    {
+                    	    pushFollow(FOLLOW_lhs_and_in_lhs_or2029);
+                    	    lhsand=lhs_and();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      			or.addDescr( lhsand );
+                    	      		
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt33 >= 1 ) break loop33;
+                    	    if (backtracking>0) {failed=true; return d;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(33, input);
+                                throw eee;
+                        }
+                        cnt33++;
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_or2040); if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:770:10: left= lhs_and ( ( OR | DOUBLE_PIPE ) right= lhs_and )*
+                    {
+                    pushFollow(FOLLOW_lhs_and_in_lhs_or2058);
+                    left=lhs_and();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = left; 
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:771:3: ( ( OR | DOUBLE_PIPE ) right= lhs_and )*
+                    loop34:
+                    do {
+                        int alt34=2;
+                        int LA34_0 = input.LA(1);
+
+                        if ( ((LA34_0>=OR && LA34_0<=DOUBLE_PIPE)) ) {
+                            alt34=1;
+                        }
+
+
+                        switch (alt34) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:771:5: ( OR | DOUBLE_PIPE ) right= lhs_and
+                    	    {
+                    	    if ( (input.LA(1)>=OR && input.LA(1)<=DOUBLE_PIPE) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_or2066);    throw mse;
+                    	    }
+
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                    	      			
+                    	    }
+                    	    pushFollow(FOLLOW_lhs_and_in_lhs_or2082);
+                    	    right=lhs_and();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( or == null ) {
+                    	      					or = new OrDescr();
+                    	      					or.addDescr( left );
+                    	      					d = or;
+                    	      				}
+                    	      				
+                    	      				or.addDescr( right );
+                    	      			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop34;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_or
+
+
+    // $ANTLR start lhs_and
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );
+    public final BaseDescr lhs_and() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr lhsunary = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d = null;
+        		AndDescr and = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:793:2: ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* )
+            int alt38=2;
+            int LA38_0 = input.LA(1);
+
+            if ( (LA38_0==LEFT_PAREN) ) {
+                int LA38_1 = input.LA(2);
+
+                if ( (LA38_1==AND) ) {
+                    alt38=1;
+                }
+                else if ( (LA38_1==ID||LA38_1==LEFT_PAREN||(LA38_1>=EXISTS && LA38_1<=FORALL)) ) {
+                    alt38=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );", 38, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( (LA38_0==ID||(LA38_0>=EXISTS && LA38_0<=FORALL)) ) {
+                alt38=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("788:1: lhs_and returns [BaseDescr d] : ( LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN | left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )* );", 38, 0, input);
+
+                throw nvae;
+            }
+            switch (alt38) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:793:4: LEFT_PAREN AND (lhsunary= lhs_unary )+ RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_and2113); if (failed) return d;
+                    match(input,AND,FOLLOW_AND_in_lhs_and2115); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      			and = new AndDescr();
+                      			d = and;
+                      			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:799:3: (lhsunary= lhs_unary )+
+                    int cnt36=0;
+                    loop36:
+                    do {
+                        int alt36=2;
+                        int LA36_0 = input.LA(1);
+
+                        if ( (LA36_0==ID||LA36_0==LEFT_PAREN||(LA36_0>=EXISTS && LA36_0<=FORALL)) ) {
+                            alt36=1;
+                        }
+
+
+                        switch (alt36) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:799:4: lhsunary= lhs_unary
+                    	    {
+                    	    pushFollow(FOLLOW_lhs_unary_in_lhs_and2127);
+                    	    lhsunary=lhs_unary();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      			and.addDescr( lhsunary );
+                    	      		
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    if ( cnt36 >= 1 ) break loop36;
+                    	    if (backtracking>0) {failed=true; return d;}
+                                EarlyExitException eee =
+                                    new EarlyExitException(36, input);
+                                throw eee;
+                        }
+                        cnt36++;
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_and2137); if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:805:10: left= lhs_unary ( ( AND | DOUBLE_AMPER ) right= lhs_unary )*
+                    {
+                    pushFollow(FOLLOW_lhs_unary_in_lhs_and2155);
+                    left=lhs_unary();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = left; 
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:806:3: ( ( AND | DOUBLE_AMPER ) right= lhs_unary )*
+                    loop37:
+                    do {
+                        int alt37=2;
+                        int LA37_0 = input.LA(1);
+
+                        if ( ((LA37_0>=AND && LA37_0<=DOUBLE_AMPER)) ) {
+                            alt37=1;
+                        }
+
+
+                        switch (alt37) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:806:5: ( AND | DOUBLE_AMPER ) right= lhs_unary
+                    	    {
+                    	    if ( (input.LA(1)>=AND && input.LA(1)<=DOUBLE_AMPER) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_and2163);    throw mse;
+                    	    }
+
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR );
+                    	      			
+                    	    }
+                    	    pushFollow(FOLLOW_lhs_unary_in_lhs_and2179);
+                    	    right=lhs_unary();
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( and == null ) {
+                    	      					and = new AndDescr();
+                    	      					and.addDescr( left );
+                    	      					d = and;
+                    	      				}
+                    	      				
+                    	      				and.addDescr( right );
+                    	      			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop37;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_and
+
+
+    // $ANTLR start lhs_unary
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:823:1: lhs_unary returns [BaseDescr d] : ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon ;
+    public final BaseDescr lhs_unary() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr u = null;
+
+        BaseDescr ps = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:2: ( ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source ) opt_semicolon
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source )
+            int alt39=6;
+            int LA39_0 = input.LA(1);
+
+            if ( (LA39_0==EXISTS) && (synpred1())) {
+                alt39=1;
+            }
+            else if ( (LA39_0==NOT) && (synpred2())) {
+                alt39=2;
+            }
+            else if ( (LA39_0==EVAL) && (synpred3())) {
+                alt39=3;
+            }
+            else if ( (LA39_0==FORALL) && (synpred4())) {
+                alt39=4;
+            }
+            else if ( (LA39_0==LEFT_PAREN) && (synpred5())) {
+                alt39=5;
+            }
+            else if ( (LA39_0==ID) ) {
+                alt39=6;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("827:4: ( ( EXISTS )=>u= lhs_exist | ( NOT )=>u= lhs_not | ( EVAL )=>u= lhs_eval | ( FORALL )=>u= lhs_forall | ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN | ps= pattern_source )", 39, 0, input);
+
+                throw nvae;
+            }
+            switch (alt39) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:6: ( EXISTS )=>u= lhs_exist
+                    {
+                    pushFollow(FOLLOW_lhs_exist_in_lhs_unary2224);
+                    u=lhs_exist();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:5: ( NOT )=>u= lhs_not
+                    {
+                    pushFollow(FOLLOW_lhs_not_in_lhs_unary2242);
+                    u=lhs_not();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:5: ( EVAL )=>u= lhs_eval
+                    {
+                    pushFollow(FOLLOW_lhs_eval_in_lhs_unary2261);
+                    u=lhs_eval();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:5: ( FORALL )=>u= lhs_forall
+                    {
+                    pushFollow(FOLLOW_lhs_forall_in_lhs_unary2280);
+                    u=lhs_forall();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:5: ( LEFT_PAREN )=> LEFT_PAREN u= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_unary2297); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_unary2301);
+                    u=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_unary2303); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = u; 
+                    }
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:832:5: ps= pattern_source
+                    {
+                    pushFollow(FOLLOW_pattern_source_in_lhs_unary2314);
+                    ps=pattern_source();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d = (BaseDescr) ps; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+            pushFollow(FOLLOW_opt_semicolon_in_lhs_unary2326);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return d;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_unary
+
+
+    // $ANTLR start pattern_source
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:837:1: pattern_source returns [BaseDescr d] : u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )? ;
+    public final BaseDescr pattern_source() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr u = null;
+
+        EntryPointDescr ep = null;
+
+        AccumulateDescr ac = null;
+
+        TimeWindowDescr tw = null;
+
+        CollectDescr cs = null;
+
+        FromDescr fm = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:841:2: (u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:842:3: u= lhs_pattern ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )?
+            {
+            pushFollow(FOLLOW_lhs_pattern_in_pattern_source2353);
+            u=lhs_pattern();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               d = u; 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:843:3: ( ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement ) | FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) ) )?
+            int alt41=3;
+            int LA41_0 = input.LA(1);
+
+            if ( (LA41_0==FROM) ) {
+                int LA41_1 = input.LA(2);
+
+                if ( ((LA41_1>=PACKAGE && LA41_1<=ID)||LA41_1==GLOBAL||(LA41_1>=QUERY && LA41_1<=ATTRIBUTES)||LA41_1==ENABLED||LA41_1==SALIENCE||(LA41_1>=DURATION && LA41_1<=DIALECT)||LA41_1==FROM||(LA41_1>=ACCUMULATE && LA41_1<=COLLECT)||(LA41_1>=CONTAINS && LA41_1<=MEMBEROF)||LA41_1==IN||(LA41_1>=THEN && LA41_1<=EVENT)) ) {
+                    alt41=2;
+                }
+                else if ( (LA41_1==ENTRY_POINT) && (synpred6())) {
+                    alt41=1;
+                }
+            }
+            switch (alt41) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:11: ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:11: ( ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:13: ( FROM ENTRY_POINT )=> FROM ep= entrypoint_statement
+                    {
+                    match(input,FROM,FOLLOW_FROM_in_pattern_source2404); if (failed) return d;
+                    pushFollow(FOLLOW_entrypoint_statement_in_pattern_source2408);
+                    ep=entrypoint_statement();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) ep); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:848:4: FROM ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )
+                    {
+                    match(input,FROM,FOLLOW_FROM_in_pattern_source2428); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType(Location.LOCATION_LHS_FROM);
+                      				location.setProperty(Location.LOCATION_FROM_CONTENT, "");
+                      		        
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:853:11: ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )
+                    int alt40=4;
+                    switch ( input.LA(1) ) {
+                    case ACCUMULATE:
+                        {
+                        alt40=1;
+                        }
+                        break;
+                    case TIMEWINDOW:
+                        {
+                        alt40=2;
+                        }
+                        break;
+                    case COLLECT:
+                        {
+                        alt40=3;
+                        }
+                        break;
+                    case PACKAGE:
+                    case IMPORT:
+                    case FUNCTION:
+                    case ID:
+                    case GLOBAL:
+                    case QUERY:
+                    case END:
+                    case TEMPLATE:
+                    case RULE:
+                    case WHEN:
+                    case ATTRIBUTES:
+                    case ENABLED:
+                    case SALIENCE:
+                    case DURATION:
+                    case DIALECT:
+                    case FROM:
+                    case INIT:
+                    case ACTION:
+                    case REVERSE:
+                    case RESULT:
+                    case CONTAINS:
+                    case EXCLUDES:
+                    case MATCHES:
+                    case SOUNDSLIKE:
+                    case MEMBEROF:
+                    case IN:
+                    case THEN:
+                    case EVENT:
+                        {
+                        alt40=4;
+                        }
+                        break;
+                    default:
+                        if (backtracking>0) {failed=true; return d;}
+                        NoViableAltException nvae =
+                            new NoViableAltException("853:11: ( options {k=1; backtrack=true; } : (ac= accumulate_statement ) | (tw= timewindow_statement ) | (cs= collect_statement ) | (fm= from_statement ) )", 40, 0, input);
+
+                        throw nvae;
+                    }
+
+                    switch (alt40) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:13: (ac= accumulate_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:13: (ac= accumulate_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:854:15: ac= accumulate_statement
+                            {
+                            pushFollow(FOLLOW_accumulate_statement_in_pattern_source2486);
+                            ac=accumulate_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) ac); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 2 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:15: (tw= timewindow_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:15: (tw= timewindow_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:855:17: tw= timewindow_statement
+                            {
+                            pushFollow(FOLLOW_timewindow_statement_in_pattern_source2509);
+                            tw=timewindow_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) tw); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 3 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:15: (cs= collect_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:15: (cs= collect_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:856:17: cs= collect_statement
+                            {
+                            pushFollow(FOLLOW_collect_statement_in_pattern_source2533);
+                            cs=collect_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) cs); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+                        case 4 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:15: (fm= from_statement )
+                            {
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:15: (fm= from_statement )
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:858:17: fm= from_statement
+                            {
+                            pushFollow(FOLLOW_from_statement_in_pattern_source2570);
+                            fm=from_statement();
+                            _fsp--;
+                            if (failed) return d;
+                            if ( backtracking==0 ) {
+                               if( d != null ) ((PatternDescr)d).setSource((PatternSourceDescr) fm); 
+                            }
+
+                            }
+
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end pattern_source
+
+
+    // $ANTLR start lhs_exist
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:863:1: lhs_exist returns [BaseDescr d] : EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) ;
+    public final BaseDescr lhs_exist() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token EXISTS37=null;
+        Token RIGHT_PAREN38=null;
+        BaseDescr or = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:867:2: ( EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:867:4: EXISTS ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            {
+            EXISTS37=(Token)input.LT(1);
+            match(input,EXISTS,FOLLOW_EXISTS_in_lhs_exist2612); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d = new ExistsDescr( ); 
+              			d.setLocation( offset(EXISTS37.getLine()), EXISTS37.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)EXISTS37).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:10: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            int alt42=2;
+            int LA42_0 = input.LA(1);
+
+            if ( (LA42_0==LEFT_PAREN) ) {
+                alt42=1;
+            }
+            else if ( (LA42_0==ID) ) {
+                alt42=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("874:10: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )", 42, 0, input);
+
+                throw nvae;
+            }
+            switch (alt42) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:12: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:12: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:874:14: LEFT_PAREN or= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_exist2632); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_exist2636);
+                    or=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if ( or != null ) ((ExistsDescr)d).addDescr( or ); 
+                    }
+                    RIGHT_PAREN38=(Token)input.LT(1);
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_exist2666); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d.setEndCharacter( ((CommonToken)RIGHT_PAREN38).getStopIndex() ); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:879:12: pattern= lhs_pattern
+                    {
+                    pushFollow(FOLLOW_lhs_pattern_in_lhs_exist2716);
+                    pattern=lhs_pattern();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      	                	if ( pattern != null ) {
+                      	                		((ExistsDescr)d).addDescr( pattern );
+                      	                		d.setEndCharacter( pattern.getEndCharacter() );
+                      	                	}
+                      	                
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_exist
+
+
+    // $ANTLR start lhs_not
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:889:1: lhs_not returns [NotDescr d] : NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) ;
+    public final NotDescr lhs_not() throws RecognitionException {
+        NotDescr d = null;
+
+        Token NOT39=null;
+        Token RIGHT_PAREN40=null;
+        BaseDescr or = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:893:2: ( NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:893:4: NOT ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            {
+            NOT39=(Token)input.LT(1);
+            match(input,NOT,FOLLOW_NOT_in_lhs_not2768); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d = new NotDescr( ); 
+              			d.setLocation( offset(NOT39.getLine()), NOT39.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)NOT39).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:3: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )
+            int alt43=2;
+            int LA43_0 = input.LA(1);
+
+            if ( (LA43_0==LEFT_PAREN) ) {
+                alt43=1;
+            }
+            else if ( (LA43_0==ID) ) {
+                alt43=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("900:3: ( ( LEFT_PAREN or= lhs_or RIGHT_PAREN ) | pattern= lhs_pattern )", 43, 0, input);
+
+                throw nvae;
+            }
+            switch (alt43) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:5: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:5: ( LEFT_PAREN or= lhs_or RIGHT_PAREN )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:900:7: LEFT_PAREN or= lhs_or RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_not2781); if (failed) return d;
+                    pushFollow(FOLLOW_lhs_or_in_lhs_not2785);
+                    or=lhs_or();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                       if ( or != null ) d.addDescr( or ); 
+                    }
+                    RIGHT_PAREN40=(Token)input.LT(1);
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_not2816); if (failed) return d;
+                    if ( backtracking==0 ) {
+                       d.setEndCharacter( ((CommonToken)RIGHT_PAREN40).getStopIndex() ); 
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:906:3: pattern= lhs_pattern
+                    {
+                    pushFollow(FOLLOW_lhs_pattern_in_lhs_not2853);
+                    pattern=lhs_pattern();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      	                	if ( pattern != null ) {
+                      	                		d.addDescr( pattern );
+                      	                		d.setEndCharacter( pattern.getEndCharacter() );
+                      	                	}
+                      	                
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_not
+
+
+    // $ANTLR start lhs_eval
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:916:1: lhs_eval returns [BaseDescr d] : EVAL c= paren_chunk ;
+    public final BaseDescr lhs_eval() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token EVAL41=null;
+        paren_chunk_return c = null;
+
+
+        
+        		d = new EvalDescr( );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:920:2: ( EVAL c= paren_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:921:3: EVAL c= paren_chunk
+            {
+            EVAL41=(Token)input.LT(1);
+            match(input,EVAL,FOLLOW_EVAL_in_lhs_eval2899); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_INSIDE_EVAL );
+              		
+            }
+            pushFollow(FOLLOW_paren_chunk_in_lhs_eval2910);
+            c=paren_chunk();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setStartCharacter( ((CommonToken)EVAL41).getStartIndex() );
+              		        if( input.toString(c.start,c.stop) != null ) {
+              	  		    this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		            String body = safeSubstring( input.toString(c.start,c.stop), 1, input.toString(c.start,c.stop).length()-1 );
+              			    checkTrailingSemicolon( body, offset(EVAL41.getLine()) );
+              			    ((EvalDescr) d).setContent( body );
+              			    location.setProperty(Location.LOCATION_EVAL_CONTENT, body);
+              			}
+              			if( ((Token)c.stop) != null ) {
+              			    d.setEndCharacter( ((CommonToken)((Token)c.stop)).getStopIndex() );
+              			}
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_eval
+
+
+    // $ANTLR start lhs_forall
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:941:1: lhs_forall returns [ForallDescr d] : FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN ;
+    public final ForallDescr lhs_forall() throws RecognitionException {
+        ForallDescr d = null;
+
+        Token FORALL42=null;
+        Token RIGHT_PAREN43=null;
+        BaseDescr base = null;
+
+        BaseDescr pattern = null;
+
+
+        
+        		d = factory.createForall();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:945:2: ( FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:945:4: FORALL LEFT_PAREN base= lhs_pattern (pattern= lhs_pattern )* RIGHT_PAREN
+            {
+            FORALL42=(Token)input.LT(1);
+            match(input,FORALL,FOLLOW_FORALL_in_lhs_forall2936); if (failed) return d;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lhs_forall2938); if (failed) return d;
+            pushFollow(FOLLOW_lhs_pattern_in_lhs_forall2942);
+            base=lhs_pattern();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			d.setStartCharacter( ((CommonToken)FORALL42).getStartIndex() );
+              		        // adding the base pattern
+              		        d.addDescr( base );
+              			d.setLocation( offset(FORALL42.getLine()), FORALL42.getCharPositionInLine() );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:952:3: (pattern= lhs_pattern )*
+            loop44:
+            do {
+                int alt44=2;
+                int LA44_0 = input.LA(1);
+
+                if ( (LA44_0==ID) ) {
+                    alt44=1;
+                }
+
+
+                switch (alt44) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:952:5: pattern= lhs_pattern
+            	    {
+            	    pushFollow(FOLLOW_lhs_pattern_in_lhs_forall2957);
+            	    pattern=lhs_pattern();
+            	    _fsp--;
+            	    if (failed) return d;
+            	    if ( backtracking==0 ) {
+            	      
+            	      		        // adding additional patterns
+            	      			d.addDescr( pattern );
+            	      		   
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop44;
+                }
+            } while (true);
+
+            RIGHT_PAREN43=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lhs_forall2973); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setEndCharacter( ((CommonToken)RIGHT_PAREN43).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_forall
+
+
+    // $ANTLR start lhs_pattern
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );
+    public final BaseDescr lhs_pattern() throws RecognitionException {
+        BaseDescr d = null;
+
+        BaseDescr f = null;
+
+
+        
+        		d =null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:971:2: (f= fact_binding | f= fact[null] )
+            int alt45=2;
+            int LA45_0 = input.LA(1);
+
+            if ( (LA45_0==ID) ) {
+                int LA45_1 = input.LA(2);
+
+                if ( (LA45_1==79) ) {
+                    alt45=1;
+                }
+                else if ( (LA45_1==DOT||LA45_1==LEFT_PAREN||LA45_1==LEFT_SQUARE) ) {
+                    alt45=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return d;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );", 45, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("964:1: lhs_pattern returns [BaseDescr d] : (f= fact_binding | f= fact[null] );", 45, 0, input);
+
+                throw nvae;
+            }
+            switch (alt45) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:971:4: f= fact_binding
+                    {
+                    pushFollow(FOLLOW_fact_binding_in_lhs_pattern3006);
+                    f=fact_binding();
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:972:4: f= fact[null]
+                    {
+                    pushFollow(FOLLOW_fact_in_lhs_pattern3014);
+                    f=fact(null);
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+
+            }
+            if ( backtracking==0 ) {
+              
+              		d =f;
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end lhs_pattern
+
+
+    // $ANTLR start from_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:975:1: from_statement returns [FromDescr d] : ds= from_source[$d] ;
+    public final FromDescr from_statement() throws RecognitionException {
+        FromDescr d = null;
+
+        DeclarativeInvokerDescr ds = null;
+
+
+        
+        		d =factory.createFrom();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:979:2: (ds= from_source[$d] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:980:2: ds= from_source[$d]
+            {
+            pushFollow(FOLLOW_from_source_in_from_statement3041);
+            ds=from_source(d);
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		d.setDataSource( ds );
+              	
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end from_statement
+
+
+    // $ANTLR start accumulate_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:987:1: accumulate_statement returns [AccumulateDescr d] : ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN ;
+    public final AccumulateDescr accumulate_statement() throws RecognitionException {
+        AccumulateDescr d = null;
+
+        Token id=null;
+        Token ACCUMULATE44=null;
+        Token RIGHT_PAREN45=null;
+        BaseDescr inputCE = null;
+
+        paren_chunk_return text = null;
+
+
+        
+        		d = factory.createAccumulate();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:991:2: ( ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:992:10: ACCUMULATE LEFT_PAREN inputCE= lhs_or ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN
+            {
+            ACCUMULATE44=(Token)input.LT(1);
+            match(input,ACCUMULATE,FOLLOW_ACCUMULATE_in_accumulate_statement3078); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(ACCUMULATE44.getLine()), ACCUMULATE44.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)ACCUMULATE44).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_accumulate_statement3088); if (failed) return d;
+            pushFollow(FOLLOW_lhs_or_in_accumulate_statement3092);
+            inputCE=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:998:29: ( COMMA )?
+            int alt46=2;
+            int LA46_0 = input.LA(1);
+
+            if ( (LA46_0==COMMA) ) {
+                alt46=1;
+            }
+            switch (alt46) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:998:29: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3094); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              		        d.setInput( inputCE );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )
+            int alt51=2;
+            int LA51_0 = input.LA(1);
+
+            if ( (LA51_0==INIT) ) {
+                alt51=1;
+            }
+            else if ( (LA51_0==ID) ) {
+                alt51=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1002:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )", 51, 0, input);
+
+                throw nvae;
+            }
+            switch (alt51) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1002:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1003:4: INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk
+                    {
+                    match(input,INIT,FOLLOW_INIT_in_accumulate_statement3112); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_INIT );
+                      			
+                    }
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3125);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1007:21: ( COMMA )?
+                    int alt47=2;
+                    int LA47_0 = input.LA(1);
+
+                    if ( (LA47_0==COMMA) ) {
+                        alt47=1;
+                    }
+                    switch (alt47) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1007:21: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3127); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setInitCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_INIT_CONTENT, d.getInitCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_ACTION );
+                      				}
+                      			
+                    }
+                    match(input,ACTION,FOLLOW_ACTION_in_accumulate_statement3138); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3142);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1015:28: ( COMMA )?
+                    int alt48=2;
+                    int LA48_0 = input.LA(1);
+
+                    if ( (LA48_0==COMMA) ) {
+                        alt48=1;
+                    }
+                    switch (alt48) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1015:28: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3144); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setActionCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_ACTION_CONTENT, d.getActionCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_REVERSE );
+                      				}
+                      			
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:4: ( REVERSE text= paren_chunk ( COMMA )? )?
+                    int alt50=2;
+                    int LA50_0 = input.LA(1);
+
+                    if ( (LA50_0==REVERSE) ) {
+                        alt50=1;
+                    }
+                    switch (alt50) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:6: REVERSE text= paren_chunk ( COMMA )?
+                            {
+                            match(input,REVERSE,FOLLOW_REVERSE_in_accumulate_statement3157); if (failed) return d;
+                            pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3161);
+                            text=paren_chunk();
+                            _fsp--;
+                            if (failed) return d;
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:31: ( COMMA )?
+                            int alt49=2;
+                            int LA49_0 = input.LA(1);
+
+                            if ( (LA49_0==COMMA) ) {
+                                alt49=1;
+                            }
+                            switch (alt49) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1023:31: COMMA
+                                    {
+                                    match(input,COMMA,FOLLOW_COMMA_in_accumulate_statement3163); if (failed) return d;
+
+                                    }
+                                    break;
+
+                            }
+
+                            if ( backtracking==0 ) {
+                              
+                              				if( input.toString(text.start,text.stop) != null ) {
+                              				        d.setReverseCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                              	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_REVERSE_CONTENT, d.getReverseCode());
+                              					location.setType( Location.LOCATION_LHS_FROM_ACCUMULATE_RESULT );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RESULT,FOLLOW_RESULT_in_accumulate_statement3180); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3184);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setResultCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_RESULT_CONTENT, d.getResultCode());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1041:3: (id= ID text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1041:3: (id= ID text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1042:4: id= ID text= paren_chunk
+                    {
+                    id=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_accumulate_statement3210); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_accumulate_statement3214);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( id.getText() != null ) {
+                      				        d.setExternalFunction( true );
+                      					d.setFunctionIdentifier( id.getText() );
+                      				}
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setExpression( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_ACCUMULATE_EXPRESSION_CONTENT, d.getExpression());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN45=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_accumulate_statement3231); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN45).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end accumulate_statement
+
+
+    // $ANTLR start timewindow_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1062:1: timewindow_statement returns [TimeWindowDescr d] : TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN ;
+    public final TimeWindowDescr timewindow_statement() throws RecognitionException {
+        TimeWindowDescr d = null;
+
+        Token id=null;
+        Token TIMEWINDOW46=null;
+        Token INT47=null;
+        Token RIGHT_PAREN48=null;
+        BaseDescr inputCE = null;
+
+        paren_chunk_return text = null;
+
+
+        
+        		d = factory.createTimeWindow();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1066:2: ( TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1067:10: TIMEWINDOW LEFT_PAREN inputCE= lhs_or ( COMMA )? INT ( COMMA )? ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) ) RIGHT_PAREN
+            {
+            TIMEWINDOW46=(Token)input.LT(1);
+            match(input,TIMEWINDOW,FOLLOW_TIMEWINDOW_in_timewindow_statement3269); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(TIMEWINDOW46.getLine()), TIMEWINDOW46.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)TIMEWINDOW46).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_timewindow_statement3279); if (failed) return d;
+            pushFollow(FOLLOW_lhs_or_in_timewindow_statement3283);
+            inputCE=lhs_or();
+            _fsp--;
+            if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1073:29: ( COMMA )?
+            int alt52=2;
+            int LA52_0 = input.LA(1);
+
+            if ( (LA52_0==COMMA) ) {
+                alt52=1;
+            }
+            switch (alt52) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1073:29: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3285); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              		        d.setInput( inputCE );
+              		
+            }
+            INT47=(Token)input.LT(1);
+            match(input,INT,FOLLOW_INT_in_timewindow_statement3295); if (failed) return d;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1077:7: ( COMMA )?
+            int alt53=2;
+            int LA53_0 = input.LA(1);
+
+            if ( (LA53_0==COMMA) ) {
+                alt53=1;
+            }
+            switch (alt53) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1077:7: COMMA
+                    {
+                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3297); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              			d.setWindowSize( INT47.getText() );
+              			location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_WINDOWSIZE );
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )
+            int alt58=2;
+            int LA58_0 = input.LA(1);
+
+            if ( (LA58_0==INIT) ) {
+                alt58=1;
+            }
+            else if ( (LA58_0==ID) ) {
+                alt58=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1082:3: ( ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk ) | (id= ID text= paren_chunk ) )", 58, 0, input);
+
+                throw nvae;
+            }
+            switch (alt58) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1082:5: ( INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1083:4: INIT text= paren_chunk ( COMMA )? ACTION text= paren_chunk ( COMMA )? ( REVERSE text= paren_chunk ( COMMA )? )? RESULT text= paren_chunk
+                    {
+                    match(input,INIT,FOLLOW_INIT_in_timewindow_statement3313); if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_INIT );
+                      			
+                    }
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3326);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1087:21: ( COMMA )?
+                    int alt54=2;
+                    int LA54_0 = input.LA(1);
+
+                    if ( (LA54_0==COMMA) ) {
+                        alt54=1;
+                    }
+                    switch (alt54) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1087:21: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3328); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setInitCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_INIT_CONTENT, d.getInitCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_ACTION );
+                      				}
+                      			
+                    }
+                    match(input,ACTION,FOLLOW_ACTION_in_timewindow_statement3339); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3343);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1095:28: ( COMMA )?
+                    int alt55=2;
+                    int LA55_0 = input.LA(1);
+
+                    if ( (LA55_0==COMMA) ) {
+                        alt55=1;
+                    }
+                    switch (alt55) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1095:28: COMMA
+                            {
+                            match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3345); if (failed) return d;
+
+                            }
+                            break;
+
+                    }
+
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setActionCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_ACTION_CONTENT, d.getActionCode());
+                      					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_REVERSE );
+                      				}
+                      			
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:4: ( REVERSE text= paren_chunk ( COMMA )? )?
+                    int alt57=2;
+                    int LA57_0 = input.LA(1);
+
+                    if ( (LA57_0==REVERSE) ) {
+                        alt57=1;
+                    }
+                    switch (alt57) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:6: REVERSE text= paren_chunk ( COMMA )?
+                            {
+                            match(input,REVERSE,FOLLOW_REVERSE_in_timewindow_statement3358); if (failed) return d;
+                            pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3362);
+                            text=paren_chunk();
+                            _fsp--;
+                            if (failed) return d;
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:31: ( COMMA )?
+                            int alt56=2;
+                            int LA56_0 = input.LA(1);
+
+                            if ( (LA56_0==COMMA) ) {
+                                alt56=1;
+                            }
+                            switch (alt56) {
+                                case 1 :
+                                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1103:31: COMMA
+                                    {
+                                    match(input,COMMA,FOLLOW_COMMA_in_timewindow_statement3364); if (failed) return d;
+
+                                    }
+                                    break;
+
+                            }
+
+                            if ( backtracking==0 ) {
+                              
+                              				if( input.toString(text.start,text.stop) != null ) {
+                              				        d.setReverseCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                              	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_REVERSE_CONTENT, d.getReverseCode());
+                              					location.setType( Location.LOCATION_LHS_FROM_TIMEWINDOW_RESULT );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+
+                    }
+
+                    match(input,RESULT,FOLLOW_RESULT_in_timewindow_statement3381); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3385);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setResultCode( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      					location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_RESULT_CONTENT, d.getResultCode());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1121:3: (id= ID text= paren_chunk )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1121:3: (id= ID text= paren_chunk )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1122:4: id= ID text= paren_chunk
+                    {
+                    id=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_timewindow_statement3410); if (failed) return d;
+                    pushFollow(FOLLOW_paren_chunk_in_timewindow_statement3414);
+                    text=paren_chunk();
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                      				if( id.getText() != null ) {
+                      				        d.setExternalFunction( true );
+                      					d.setFunctionIdentifier( id.getText() );
+                      				}
+                      				if( input.toString(text.start,text.stop) != null ) {
+                      				        d.setExpression( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+                      	       				location.setProperty(Location.LOCATION_PROPERTY_FROM_TIMEWINDOW_EXPRESSION_CONTENT, d.getExpression());
+                      				}
+                      			
+                    }
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN48=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_timewindow_statement3431); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN48).getStopIndex() );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end timewindow_statement
+
+
+    // $ANTLR start from_source
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1142:1: from_source[FromDescr from] returns [DeclarativeInvokerDescr ds] : ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )? ;
+    public final DeclarativeInvokerDescr from_source(FromDescr from) throws RecognitionException {
+        DeclarativeInvokerDescr ds = null;
+
+        identifier_return ident = null;
+
+        paren_chunk_return args = null;
+
+
+        
+        		ds = null;
+        		AccessorDescr ad = null;
+        		FunctionCallDescr fc = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1148:2: (ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1148:4: ident= identifier ( options {k=1; } : args= paren_chunk )? ( expression_chain[$from, ad] )?
+            {
+            pushFollow(FOLLOW_identifier_in_from_source3461);
+            ident=identifier();
+            _fsp--;
+            if (failed) return ds;
+            if ( backtracking==0 ) {
+              
+              			ad = new AccessorDescr(ident.start.getText());	
+              			ad.setLocation( offset(ident.start.getLine()), ident.start.getCharPositionInLine() );
+              			ad.setStartCharacter( ((CommonToken)ident.start).getStartIndex() );
+              			ad.setEndCharacter( ((CommonToken)ident.start).getStopIndex() );
+              			ds = ad;
+              			location.setProperty(Location.LOCATION_FROM_CONTENT, ident.start.getText());
+              		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1157:3: ( options {k=1; } : args= paren_chunk )?
+            int alt59=2;
+            int LA59_0 = input.LA(1);
+
+            if ( (LA59_0==LEFT_PAREN) ) {
+                alt59=1;
+            }
+            switch (alt59) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1164:5: args= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_from_source3489);
+                    args=paren_chunk();
+                    _fsp--;
+                    if (failed) return ds;
+                    if ( backtracking==0 ) {
+                      
+                      			if( input.toString(args.start,args.stop) != null ) {
+                      				ad.setVariableName( null );
+                      				fc = new FunctionCallDescr(((Token)ident.start).getText());
+                      				fc.setLocation( offset(((Token)ident.start).getLine()), ((Token)ident.start).getCharPositionInLine() );			
+                      				fc.setArguments(input.toString(args.start,args.stop));
+                      				fc.setStartCharacter( ((CommonToken)((Token)ident.start)).getStartIndex() );
+                      				fc.setEndCharacter( ((CommonToken)((Token)ident.start)).getStopIndex() );
+                      				location.setProperty(Location.LOCATION_FROM_CONTENT, input.toString(args.start,args.stop));
+                      				from.setEndCharacter( ((CommonToken)((Token)args.stop)).getStopIndex() );
+                      			}
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1178:3: ( expression_chain[$from, ad] )?
+            int alt60=2;
+            int LA60_0 = input.LA(1);
+
+            if ( (LA60_0==DOT) ) {
+                alt60=1;
+            }
+            switch (alt60) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1178:3: expression_chain[$from, ad]
+                    {
+                    pushFollow(FOLLOW_expression_chain_in_from_source3502);
+                    expression_chain(from,  ad);
+                    _fsp--;
+                    if (failed) return ds;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		if( ad != null ) {
+            			if( fc != null ) {
+            				ad.addFirstInvoker( fc );
+            			}
+            			location.setProperty(Location.LOCATION_FROM_CONTENT, ad.toString() );
+            		}
+            	
+        }
+        return ds;
+    }
+    // $ANTLR end from_source
+
+
+    // $ANTLR start expression_chain
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1189:1: expression_chain[FromDescr from, AccessorDescr as] : ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? ) ;
+    public final void expression_chain(FromDescr from, AccessorDescr as) throws RecognitionException {
+        identifier_return field = null;
+
+        square_chunk_return sqarg = null;
+
+        paren_chunk_return paarg = null;
+
+
+        
+          		FieldAccessDescr fa = null;
+        	    	MethodAccessDescr ma = null;	
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1194:2: ( ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:2: ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:2: ( DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1195:4: DOT field= identifier ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )? ( expression_chain[from, as] )?
+            {
+            match(input,DOT,FOLLOW_DOT_in_expression_chain3533); if (failed) return ;
+            pushFollow(FOLLOW_identifier_in_expression_chain3537);
+            field=identifier();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              	        fa = new FieldAccessDescr(((Token)field.start).getText());	
+              		fa.setLocation( offset(((Token)field.start).getLine()), ((Token)field.start).getCharPositionInLine() );
+              		fa.setStartCharacter( ((CommonToken)((Token)field.start)).getStartIndex() );
+              		fa.setEndCharacter( ((CommonToken)((Token)field.start)).getStopIndex() );
+              	    
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1202:4: ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )?
+            int alt61=3;
+            alt61 = dfa61.predict(input);
+            switch (alt61) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:6: ( LEFT_SQUARE )=>sqarg= square_chunk
+                    {
+                    pushFollow(FOLLOW_square_chunk_in_expression_chain3568);
+                    sqarg=square_chunk();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      	          fa.setArgument( input.toString(sqarg.start,sqarg.stop) );	
+                      		  from.setEndCharacter( ((CommonToken)((Token)sqarg.stop)).getStopIndex() );
+                      	      
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:6: ( LEFT_PAREN )=>paarg= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_expression_chain3601);
+                    paarg=paren_chunk();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      	    	  ma = new MethodAccessDescr( ((Token)field.start).getText(), input.toString(paarg.start,paarg.stop) );	
+                      		  ma.setLocation( offset(((Token)field.start).getLine()), ((Token)field.start).getCharPositionInLine() );
+                      		  ma.setStartCharacter( ((CommonToken)((Token)field.start)).getStartIndex() );
+                      		  from.setEndCharacter( ((CommonToken)((Token)paarg.stop)).getStopIndex() );
+                      		
+                    }
+
+                    }
+                    break;
+
+            }
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1217:4: ( expression_chain[from, as] )?
+            int alt62=2;
+            int LA62_0 = input.LA(1);
+
+            if ( (LA62_0==DOT) ) {
+                alt62=1;
+            }
+            switch (alt62) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1217:4: expression_chain[from, as]
+                    {
+                    pushFollow(FOLLOW_expression_chain_in_expression_chain3616);
+                    expression_chain(from,  as);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		// must be added to the start, since it is a recursive rule
+            		if( ma != null ) {
+            			as.addFirstInvoker( ma );
+            		} else {
+            			as.addFirstInvoker( fa );
+            		}
+            	
+        }
+        return ;
+    }
+    // $ANTLR end expression_chain
+
+
+    // $ANTLR start collect_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1231:1: collect_statement returns [CollectDescr d] : COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN ;
+    public final CollectDescr collect_statement() throws RecognitionException {
+        CollectDescr d = null;
+
+        Token COLLECT49=null;
+        Token RIGHT_PAREN50=null;
+        BaseDescr pattern = null;
+
+
+        
+        		d = factory.createCollect();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1235:2: ( COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1236:10: COLLECT LEFT_PAREN pattern= pattern_source RIGHT_PAREN
+            {
+            COLLECT49=(Token)input.LT(1);
+            match(input,COLLECT,FOLLOW_COLLECT_in_collect_statement3667); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(COLLECT49.getLine()), COLLECT49.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)COLLECT49).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_COLLECT );
+              		
+            }
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_collect_statement3677); if (failed) return d;
+            pushFollow(FOLLOW_pattern_source_in_collect_statement3681);
+            pattern=pattern_source();
+            _fsp--;
+            if (failed) return d;
+            RIGHT_PAREN50=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_collect_statement3683); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setInputPattern( (PatternDescr) pattern );
+              			d.setEndCharacter( ((CommonToken)RIGHT_PAREN50).getStopIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end collect_statement
+
+
+    // $ANTLR start entrypoint_statement
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1250:1: entrypoint_statement returns [EntryPointDescr d] : ENTRY_POINT id= name ;
+    public final EntryPointDescr entrypoint_statement() throws RecognitionException {
+        EntryPointDescr d = null;
+
+        Token ENTRY_POINT51=null;
+        name_return id = null;
+
+
+        
+        		d = factory.createEntryPoint();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1254:2: ( ENTRY_POINT id= name )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1255:10: ENTRY_POINT id= name
+            {
+            ENTRY_POINT51=(Token)input.LT(1);
+            match(input,ENTRY_POINT,FOLLOW_ENTRY_POINT_in_entrypoint_statement3720); if (failed) return d;
+            if ( backtracking==0 ) {
+               
+              			d.setLocation( offset(ENTRY_POINT51.getLine()), ENTRY_POINT51.getCharPositionInLine() );
+              			d.setStartCharacter( ((CommonToken)ENTRY_POINT51).getStartIndex() );
+              			location.setType( Location.LOCATION_LHS_FROM_ENTRY_POINT );
+              		
+            }
+            pushFollow(FOLLOW_name_in_entrypoint_statement3732);
+            id=name();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        d.setEntryId( id.name );
+              			d.setEndCharacter( ((CommonToken)((Token)id.stop)).getStopIndex() );
+              			location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end entrypoint_statement
+
+
+    // $ANTLR start fact_binding
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1269:1: fact_binding returns [BaseDescr d] : ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN ) ;
+    public final BaseDescr fact_binding() throws RecognitionException {
+        BaseDescr d = null;
+
+        Token ID52=null;
+        BaseDescr fe = null;
+
+        BaseDescr left = null;
+
+        BaseDescr right = null;
+
+
+        
+        		d =null;
+        		OrDescr or = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1274:3: ( ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1275:4: ID ':' (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )
+            {
+            ID52=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_fact_binding3764); if (failed) return d;
+            match(input,79,FOLLOW_79_in_fact_binding3766); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+               		        // handling incomplete parsing
+               		        d = new PatternDescr( );
+               		        ((PatternDescr) d).setIdentifier( ID52.getText() );
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1281:3: (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )
+            int alt64=2;
+            int LA64_0 = input.LA(1);
+
+            if ( (LA64_0==ID) ) {
+                alt64=1;
+            }
+            else if ( (LA64_0==LEFT_PAREN) ) {
+                alt64=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return d;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1281:3: (fe= fact[$ID.text] | LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN )", 64, 0, input);
+
+                throw nvae;
+            }
+            switch (alt64) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1281:5: fe= fact[$ID.text]
+                    {
+                    pushFollow(FOLLOW_fact_in_fact_binding3780);
+                    fe=fact(ID52.getText());
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                       		        // override previously instantiated pattern
+                       			d =fe;
+                       			if( d != null ) {
+                         			    d.setStartCharacter( ((CommonToken)ID52).getStartIndex() );
+                         			}
+                       		
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1290:4: LEFT_PAREN left= fact[$ID.text] ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )* RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_fact_binding3796); if (failed) return d;
+                    pushFollow(FOLLOW_fact_in_fact_binding3800);
+                    left=fact(ID52.getText());
+                    _fsp--;
+                    if (failed) return d;
+                    if ( backtracking==0 ) {
+                      
+                       		        // override previously instantiated pattern
+                       			d =left;
+                       			if( d != null ) {
+                         			    d.setStartCharacter( ((CommonToken)ID52).getStartIndex() );
+                         			}
+                       		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1298:4: ( ( OR | DOUBLE_PIPE ) right= fact[$ID.text] )*
+                    loop63:
+                    do {
+                        int alt63=2;
+                        int LA63_0 = input.LA(1);
+
+                        if ( ((LA63_0>=OR && LA63_0<=DOUBLE_PIPE)) ) {
+                            alt63=1;
+                        }
+
+
+                        switch (alt63) {
+                    	case 1 :
+                    	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1298:6: ( OR | DOUBLE_PIPE ) right= fact[$ID.text]
+                    	    {
+                    	    if ( (input.LA(1)>=OR && input.LA(1)<=DOUBLE_PIPE) ) {
+                    	        input.consume();
+                    	        errorRecovery=false;failed=false;
+                    	    }
+                    	    else {
+                    	        if (backtracking>0) {failed=true; return d;}
+                    	        MismatchedSetException mse =
+                    	            new MismatchedSetException(null,input);
+                    	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_fact_binding3813);    throw mse;
+                    	    }
+
+                    	    pushFollow(FOLLOW_fact_in_fact_binding3825);
+                    	    right=fact(ID52.getText());
+                    	    _fsp--;
+                    	    if (failed) return d;
+                    	    if ( backtracking==0 ) {
+                    	      
+                    	      				if ( or == null ) {
+                    	      					or = new OrDescr();
+                    	      					or.addDescr( left );
+                    	      					d = or;
+                    	      				}
+                    	      				or.addDescr( right );
+                    	       			
+                    	    }
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop63;
+                        }
+                    } while (true);
+
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_fact_binding3843); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end fact_binding
+
+
+    // $ANTLR start fact
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1313:1: fact[String ident] returns [BaseDescr d] : id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )? ;
+    public final BaseDescr fact(String ident) throws RecognitionException {
+        BaseDescr d = null;
+
+        Token LEFT_PAREN53=null;
+        Token RIGHT_PAREN54=null;
+        qualified_id_return id = null;
+
+
+        
+        		d =null;
+        		PatternDescr pattern = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1318:3: (id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )? )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1319:11: id= qualified_id LEFT_PAREN ( constraints[pattern] )? RIGHT_PAREN ( EOF )?
+            {
+            if ( backtracking==0 ) {
+              
+               			pattern = new PatternDescr( );
+               			if( ident != null ) {
+               				pattern.setIdentifier( ident );
+               			}
+               			d = pattern; 
+               	        
+            }
+            pushFollow(FOLLOW_qualified_id_in_fact3898);
+            id=qualified_id();
+            _fsp--;
+            if (failed) return d;
+            if ( backtracking==0 ) {
+               
+               			if( id != null ) {
+              	 		        pattern.setObjectType( id.text );
+               			        pattern.setEndCharacter( -1 );
+              				pattern.setStartCharacter( ((CommonToken)((Token)id.start)).getStartIndex() );
+               			}
+               		
+            }
+            LEFT_PAREN53=(Token)input.LT(1);
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_fact3908); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START );
+                          		location.setProperty( Location.LOCATION_PROPERTY_CLASS_NAME, id.text );
+               				
+               			pattern.setLocation( offset(LEFT_PAREN53.getLine()), LEFT_PAREN53.getCharPositionInLine() );
+               			pattern.setLeftParentCharacter( ((CommonToken)LEFT_PAREN53).getStartIndex() );
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1342:4: ( constraints[pattern] )?
+            int alt65=2;
+            int LA65_0 = input.LA(1);
+
+            if ( ((LA65_0>=PACKAGE && LA65_0<=ID)||(LA65_0>=GLOBAL && LA65_0<=LEFT_PAREN)||(LA65_0>=QUERY && LA65_0<=ATTRIBUTES)||LA65_0==ENABLED||LA65_0==SALIENCE||(LA65_0>=DURATION && LA65_0<=DIALECT)||LA65_0==FROM||LA65_0==EVAL||(LA65_0>=INIT && LA65_0<=RESULT)||(LA65_0>=CONTAINS && LA65_0<=MEMBEROF)||LA65_0==IN||(LA65_0>=THEN && LA65_0<=EVENT)) ) {
+                alt65=1;
+            }
+            switch (alt65) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1342:4: constraints[pattern]
+                    {
+                    pushFollow(FOLLOW_constraints_in_fact3920);
+                    constraints(pattern);
+                    _fsp--;
+                    if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+            RIGHT_PAREN54=(Token)input.LT(1);
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_fact3927); if (failed) return d;
+            if ( backtracking==0 ) {
+              
+              		        if( ")".equals( RIGHT_PAREN54.getText() ) ) {
+              				this.location.setType( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
+              				pattern.setEndLocation( offset(RIGHT_PAREN54.getLine()), RIGHT_PAREN54.getCharPositionInLine() );	
+              				pattern.setEndCharacter( ((CommonToken)RIGHT_PAREN54).getStopIndex() );
+              		        	pattern.setRightParentCharacter( ((CommonToken)RIGHT_PAREN54).getStartIndex() );
+              		        }
+               		
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1352:4: ( EOF )?
+            int alt66=2;
+            int LA66_0 = input.LA(1);
+
+            if ( (LA66_0==EOF) ) {
+                alt66=1;
+            }
+            switch (alt66) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1352:4: EOF
+                    {
+                    match(input,EOF,FOLLOW_EOF_in_fact3936); if (failed) return d;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return d;
+    }
+    // $ANTLR end fact
+
+
+    // $ANTLR start constraints
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1356:1: constraints[PatternDescr pattern] : constraint[$pattern] ( COMMA constraint[$pattern] )* ;
+    public final void constraints(PatternDescr pattern) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1357:2: ( constraint[$pattern] ( COMMA constraint[$pattern] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1357:4: constraint[$pattern] ( COMMA constraint[$pattern] )*
+            {
+            pushFollow(FOLLOW_constraint_in_constraints3954);
+            constraint(pattern);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1358:3: ( COMMA constraint[$pattern] )*
+            loop67:
+            do {
+                int alt67=2;
+                int LA67_0 = input.LA(1);
+
+                if ( (LA67_0==COMMA) ) {
+                    alt67=1;
+                }
+
+
+                switch (alt67) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1358:5: COMMA constraint[$pattern]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_constraints3961); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       location.setType( Location.LOCATION_LHS_INSIDE_CONDITION_START ); 
+            	    }
+            	    pushFollow(FOLLOW_constraint_in_constraints3970);
+            	    constraint(pattern);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop67;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraints
+
+
+    // $ANTLR start constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1363:1: constraint[PatternDescr pattern] : or_constr[top] ;
+    public final void constraint(PatternDescr pattern) throws RecognitionException {
+        
+        		ConditionalElementDescr top = null;
+        		location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+        		location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, input.LT(1).getText() );
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1369:2: ( or_constr[top] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1370:3: or_constr[top]
+            {
+            if ( backtracking==0 ) {
+              
+              			top = pattern.getConstraint();
+              		
+            }
+            pushFollow(FOLLOW_or_constr_in_constraint4003);
+            or_constr(top);
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraint
+
+
+    // $ANTLR start or_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1376:1: or_constr[ConditionalElementDescr base] : and_constr[or] ( DOUBLE_PIPE and_constr[or] )* ;
+    public final void or_constr(ConditionalElementDescr base) throws RecognitionException {
+        
+        		OrDescr or = new OrDescr();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1380:2: ( and_constr[or] ( DOUBLE_PIPE and_constr[or] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1381:3: and_constr[or] ( DOUBLE_PIPE and_constr[or] )*
+            {
+            pushFollow(FOLLOW_and_constr_in_or_constr4026);
+            and_constr(or);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1382:3: ( DOUBLE_PIPE and_constr[or] )*
+            loop68:
+            do {
+                int alt68=2;
+                int LA68_0 = input.LA(1);
+
+                if ( (LA68_0==DOUBLE_PIPE) ) {
+                    alt68=1;
+                }
+
+
+                switch (alt68) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1382:5: DOUBLE_PIPE and_constr[or]
+            	    {
+            	    match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_or_constr4034); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+            	      		
+            	    }
+            	    pushFollow(FOLLOW_and_constr_in_or_constr4043);
+            	    and_constr(or);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop68;
+                }
+            } while (true);
+
+            if ( backtracking==0 ) {
+              
+              		        if( or.getDescrs().size() == 1 ) {
+              		                base.addOrMerge( (BaseDescr) or.getDescrs().get(0) );
+              		        } else if ( or.getDescrs().size() > 1 ) {
+              		        	base.addDescr( or );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end or_constr
+
+
+    // $ANTLR start and_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1397:1: and_constr[ConditionalElementDescr base] : unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )* ;
+    public final void and_constr(ConditionalElementDescr base) throws RecognitionException {
+        
+        		AndDescr and = new AndDescr();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1401:2: ( unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1402:3: unary_constr[and] ( DOUBLE_AMPER unary_constr[and] )*
+            {
+            pushFollow(FOLLOW_unary_constr_in_and_constr4075);
+            unary_constr(and);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1403:3: ( DOUBLE_AMPER unary_constr[and] )*
+            loop69:
+            do {
+                int alt69=2;
+                int LA69_0 = input.LA(1);
+
+                if ( (LA69_0==DOUBLE_AMPER) ) {
+                    alt69=1;
+                }
+
+
+                switch (alt69) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1403:5: DOUBLE_AMPER unary_constr[and]
+            	    {
+            	    match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_and_constr4083); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_START);
+            	      		
+            	    }
+            	    pushFollow(FOLLOW_unary_constr_in_and_constr4092);
+            	    unary_constr(and);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop69;
+                }
+            } while (true);
+
+            if ( backtracking==0 ) {
+              
+              		        if( and.getDescrs().size() == 1) {
+              		                base.addOrMerge( (BaseDescr) and.getDescrs().get(0) );
+              		        } else if( and.getDescrs().size() > 1) {
+              		        	base.addDescr( and );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end and_constr
+
+
+    // $ANTLR start unary_constr
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1418:1: unary_constr[ConditionalElementDescr base] : ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] ) ;
+    public final void unary_constr(ConditionalElementDescr base) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1419:2: ( ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )
+            int alt70=3;
+            switch ( input.LA(1) ) {
+            case PACKAGE:
+            case IMPORT:
+            case FUNCTION:
+            case ID:
+            case GLOBAL:
+            case QUERY:
+            case END:
+            case TEMPLATE:
+            case RULE:
+            case WHEN:
+            case ATTRIBUTES:
+            case ENABLED:
+            case SALIENCE:
+            case DURATION:
+            case DIALECT:
+            case FROM:
+            case INIT:
+            case ACTION:
+            case REVERSE:
+            case RESULT:
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case IN:
+            case THEN:
+            case EVENT:
+                {
+                alt70=1;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt70=2;
+                }
+                break;
+            case EVAL:
+                {
+                alt70=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1420:3: ( field_constraint[$base] | LEFT_PAREN or_constr[$base] RIGHT_PAREN | EVAL predicate[$base] )", 70, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt70) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1420:5: field_constraint[$base]
+                    {
+                    pushFollow(FOLLOW_field_constraint_in_unary_constr4120);
+                    field_constraint(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1421:5: LEFT_PAREN or_constr[$base] RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_unary_constr4128); if (failed) return ;
+                    pushFollow(FOLLOW_or_constr_in_unary_constr4130);
+                    or_constr(base);
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_unary_constr4133); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1422:5: EVAL predicate[$base]
+                    {
+                    match(input,EVAL,FOLLOW_EVAL_in_unary_constr4139); if (failed) return ;
+                    pushFollow(FOLLOW_predicate_in_unary_constr4141);
+                    predicate(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end unary_constr
+
+
+    // $ANTLR start field_constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );
+    public final void field_constraint(ConditionalElementDescr base) throws RecognitionException {
+        Token ID55=null;
+        accessor_path_return f = null;
+
+
+        
+        		FieldBindingDescr fbd = null;
+        		FieldConstraintDescr fc = null;
+        		RestrictionConnectiveDescr top = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1432:2: ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) )
+            int alt72=2;
+            int LA72_0 = input.LA(1);
+
+            if ( (LA72_0==ID) ) {
+                int LA72_1 = input.LA(2);
+
+                if ( (LA72_1==79) ) {
+                    alt72=1;
+                }
+                else if ( (LA72_1==DOT||LA72_1==LEFT_PAREN||LA72_1==NOT||(LA72_1>=CONTAINS && LA72_1<=IN)||LA72_1==LEFT_SQUARE||(LA72_1>=81 && LA72_1<=86)) ) {
+                    alt72=2;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );", 72, 1, input);
+
+                    throw nvae;
+                }
+            }
+            else if ( ((LA72_0>=PACKAGE && LA72_0<=FUNCTION)||LA72_0==GLOBAL||(LA72_0>=QUERY && LA72_0<=ATTRIBUTES)||LA72_0==ENABLED||LA72_0==SALIENCE||(LA72_0>=DURATION && LA72_0<=DIALECT)||LA72_0==FROM||(LA72_0>=INIT && LA72_0<=RESULT)||(LA72_0>=CONTAINS && LA72_0<=MEMBEROF)||LA72_0==IN||(LA72_0>=THEN && LA72_0<=EVENT)) ) {
+                alt72=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1426:1: field_constraint[ConditionalElementDescr base] : ( ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? ) | (f= accessor_path or_restr_connective[top] ) );", 72, 0, input);
+
+                throw nvae;
+            }
+            switch (alt72) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1433:10: ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1433:10: ( ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )? )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1434:3: ID ':' f= accessor_path ( or_restr_connective[top] | '->' predicate[$base] )?
+                    {
+                    ID55=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_field_constraint4180); if (failed) return ;
+                    match(input,79,FOLLOW_79_in_field_constraint4182); if (failed) return ;
+                    if ( backtracking==0 ) {
+                       
+                      			fbd = new FieldBindingDescr();
+                      			fbd.setIdentifier( ID55.getText() );
+                      			fbd.setLocation( offset(ID55.getLine()), ID55.getCharPositionInLine() );
+                      			fbd.setStartCharacter( ((CommonToken)ID55).getStartIndex() );
+                      			base.addDescr( fbd );
+                      
+                      		    
+                    }
+                    pushFollow(FOLLOW_accessor_path_in_field_constraint4201);
+                    f=accessor_path();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      		    // use ((Token)f.start) to get token matched in identifier
+                      		    // or use f.text to get text.
+                      		    if( f.text != null ) {
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, f.text);
+                      		    
+                      			if ( fbd != null ) {
+                      			    fbd.setFieldName( f.text );
+                      			    // may have been overwritten
+                      			    fbd.setStartCharacter( ((CommonToken)ID55).getStartIndex() );
+                      			} 
+                      			fc = new FieldConstraintDescr(f.text);
+                      			fc.setLocation( offset(((Token)f.start).getLine()), ((Token)f.start).getCharPositionInLine() );
+                      			fc.setStartCharacter( ((CommonToken)((Token)f.start)).getStartIndex() );
+                      			top = fc.getRestriction();
+                      			
+                      			// it must be a field constraint, as it is not a binding
+                      			if( ID55 == null ) {
+                      			    base.addDescr( fc );
+                      			}
+                      		    }
+                      		
+                    }
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1468:3: ( or_restr_connective[top] | '->' predicate[$base] )?
+                    int alt71=3;
+                    int LA71_0 = input.LA(1);
+
+                    if ( (LA71_0==LEFT_PAREN||LA71_0==NOT||(LA71_0>=CONTAINS && LA71_0<=IN)||(LA71_0>=81 && LA71_0<=86)) ) {
+                        alt71=1;
+                    }
+                    else if ( (LA71_0==80) ) {
+                        alt71=2;
+                    }
+                    switch (alt71) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1469:4: or_restr_connective[top]
+                            {
+                            pushFollow(FOLLOW_or_restr_connective_in_field_constraint4215);
+                            or_restr_connective(top);
+                            _fsp--;
+                            if (failed) return ;
+                            if ( backtracking==0 ) {
+                              
+                              				// we must add now as we didn't before
+                              				if( ID55 != null) {
+                              				    base.addDescr( fc );
+                              				}
+                              			
+                            }
+
+                            }
+                            break;
+                        case 2 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1477:4: '->' predicate[$base]
+                            {
+                            match(input,80,FOLLOW_80_in_field_constraint4230); if (failed) return ;
+                            pushFollow(FOLLOW_predicate_in_field_constraint4232);
+                            predicate(base);
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1481:3: (f= accessor_path or_restr_connective[top] )
+                    {
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1481:3: (f= accessor_path or_restr_connective[top] )
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1482:3: f= accessor_path or_restr_connective[top]
+                    {
+                    pushFollow(FOLLOW_accessor_path_in_field_constraint4258);
+                    f=accessor_path();
+                    _fsp--;
+                    if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      		    // use ((Token)f.start) to get token matched in identifier
+                      		    // or use f.text to get text.
+                      		    if( f.text != null ) {
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      			location.setProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME, f.text);
+                      		    
+                      			fc = new FieldConstraintDescr(f.text);
+                      			fc.setLocation( offset(((Token)f.start).getLine()), ((Token)f.start).getCharPositionInLine() );
+                      			fc.setStartCharacter( ((CommonToken)((Token)f.start)).getStartIndex() );
+                      			top = fc.getRestriction();
+                      			
+                      			base.addDescr( fc );
+                      		    }
+                      		
+                    }
+                    pushFollow(FOLLOW_or_restr_connective_in_field_constraint4267);
+                    or_restr_connective(top);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+        }
+        catch ( NoViableAltException nvae ) {
+            
+            	    if( input.LT(1) != null ) {
+            	                // in case of incomplete parsing, build as much as possible of the AST
+            	                // so that IDE requirements can be met
+            			fc = new FieldConstraintDescr( input.LT(1).getText() );
+            			fc.setLocation( offset(input.LT(1).getLine()), input.LT(1).getCharPositionInLine() );
+            			fc.setStartCharacter( ((CommonToken)input.LT(1)).getStartIndex() );
+            			base.addDescr( fc );
+            	    }
+            	    throw nvae;
+            	
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end field_constraint
+
+
+    // $ANTLR start or_restr_connective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1514:1: or_restr_connective[ RestrictionConnectiveDescr base ] options {backtrack=true; } : and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )* ;
+    public final void or_restr_connective(RestrictionConnectiveDescr base) throws RecognitionException {
+        
+        		RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1521:2: ( and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1522:3: and_restr_connective[or] ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*
+            {
+            pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective4314);
+            and_restr_connective(or);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1523:3: ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*
+            loop73:
+            do {
+                int alt73=2;
+                alt73 = dfa73.predict(input);
+                switch (alt73) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: DOUBLE_PIPE and_restr_connective[or]
+            	    {
+            	    match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_or_restr_connective4338); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+            	      			
+            	    }
+            	    pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective4349);
+            	    and_restr_connective(or);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop73;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            	        if( or.getRestrictions().size() == 1 ) {
+            	                base.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
+            	        } else if ( or.getRestrictions().size() > 1 ) {
+            	        	base.addRestriction( or );
+            	        }
+            	
+        }
+        return ;
+    }
+    // $ANTLR end or_restr_connective
+
+
+    // $ANTLR start and_restr_connective
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1540:1: and_restr_connective[ RestrictionConnectiveDescr base ] : constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )* ;
+    public final void and_restr_connective(RestrictionConnectiveDescr base) throws RecognitionException {
+        Token t=null;
+
+        
+        		RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1544:2: ( constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1545:3: constraint_expression[and] ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*
+            {
+            pushFollow(FOLLOW_constraint_expression_in_and_restr_connective4381);
+            constraint_expression(and);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1546:3: ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*
+            loop74:
+            do {
+                int alt74=2;
+                alt74 = dfa74.predict(input);
+                switch (alt74) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: t= DOUBLE_AMPER constraint_expression[and]
+            	    {
+            	    t=(Token)input.LT(1);
+            	    match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_and_restr_connective4401); if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	      
+            	      				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+            	      			
+            	    }
+            	    pushFollow(FOLLOW_constraint_expression_in_and_restr_connective4412);
+            	    constraint_expression(and);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop74;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            	        if( and.getRestrictions().size() == 1) {
+            	                base.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
+            	        } else if ( and.getRestrictions().size() > 1 ) {
+            	        	base.addRestriction( and );
+            	        }
+            	
+        }
+        return ;
+    }
+    // $ANTLR end and_restr_connective
+
+
+    // $ANTLR start constraint_expression
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1562:1: constraint_expression[RestrictionConnectiveDescr base] : ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN ) ;
+    public final void constraint_expression(RestrictionConnectiveDescr base) throws RecognitionException {
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1563:9: ( ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )
+            int alt75=3;
+            switch ( input.LA(1) ) {
+            case IN:
+                {
+                alt75=1;
+                }
+                break;
+            case NOT:
+                {
+                int LA75_2 = input.LA(2);
+
+                if ( (LA75_2==CONTAINS||LA75_2==MATCHES||(LA75_2>=MEMBEROF && LA75_2<=TILDE)) ) {
+                    alt75=2;
+                }
+                else if ( (LA75_2==IN) ) {
+                    alt75=1;
+                }
+                else {
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )", 75, 2, input);
+
+                    throw nvae;
+                }
+                }
+                break;
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case TILDE:
+            case 81:
+            case 82:
+            case 83:
+            case 84:
+            case 85:
+            case 86:
+                {
+                alt75=2;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt75=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1564:3: ( compound_operator[$base] | simple_operator[$base] | LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN )", 75, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt75) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1564:5: compound_operator[$base]
+                    {
+                    pushFollow(FOLLOW_compound_operator_in_constraint_expression4449);
+                    compound_operator(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1565:5: simple_operator[$base]
+                    {
+                    pushFollow(FOLLOW_simple_operator_in_constraint_expression4456);
+                    simple_operator(base);
+                    _fsp--;
+                    if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1566:5: LEFT_PAREN or_restr_connective[$base] RIGHT_PAREN
+                    {
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_constraint_expression4464); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+                      		
+                    }
+                    pushFollow(FOLLOW_or_restr_connective_in_constraint_expression4473);
+                    or_restr_connective(base);
+                    _fsp--;
+                    if (failed) return ;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_constraint_expression4478); if (failed) return ;
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end constraint_expression
+
+
+    // $ANTLR start simple_operator
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1575:1: simple_operator[RestrictionConnectiveDescr base] : (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText] ;
+    public final void simple_operator(RestrictionConnectiveDescr base) throws RecognitionException {
+        Token t=null;
+        Token n=null;
+        square_chunk_return param = null;
+
+        RestrictionDescr rd = null;
+
+
+        
+        		String op = null;
+        		String paramText = null;
+        		boolean isNegated = false;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1581:2: ( (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText] )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? ) rd= expression_value[$base, op, isNegated, paramText]
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )
+            int alt78=16;
+            switch ( input.LA(1) ) {
+            case 81:
+                {
+                alt78=1;
+                }
+                break;
+            case 82:
+                {
+                alt78=2;
+                }
+                break;
+            case 83:
+                {
+                alt78=3;
+                }
+                break;
+            case 84:
+                {
+                alt78=4;
+                }
+                break;
+            case 85:
+                {
+                alt78=5;
+                }
+                break;
+            case 86:
+                {
+                alt78=6;
+                }
+                break;
+            case CONTAINS:
+                {
+                alt78=7;
+                }
+                break;
+            case NOT:
+                {
+                switch ( input.LA(2) ) {
+                case MEMBEROF:
+                    {
+                    alt78=14;
+                    }
+                    break;
+                case CONTAINS:
+                    {
+                    alt78=8;
+                    }
+                    break;
+                case TILDE:
+                    {
+                    alt78=16;
+                    }
+                    break;
+                case MATCHES:
+                    {
+                    alt78=12;
+                    }
+                    break;
+                default:
+                    if (backtracking>0) {failed=true; return ;}
+                    NoViableAltException nvae =
+                        new NoViableAltException("1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )", 78, 8, input);
+
+                    throw nvae;
+                }
+
+                }
+                break;
+            case EXCLUDES:
+                {
+                alt78=9;
+                }
+                break;
+            case MATCHES:
+                {
+                alt78=10;
+                }
+                break;
+            case SOUNDSLIKE:
+                {
+                alt78=11;
+                }
+                break;
+            case MEMBEROF:
+                {
+                alt78=13;
+                }
+                break;
+            case TILDE:
+                {
+                alt78=15;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1582:3: (t= '==' | t= '>' | t= '>=' | t= '<' | t= '<=' | t= '!=' | t= CONTAINS | n= NOT t= CONTAINS | t= EXCLUDES | t= MATCHES | t= SOUNDSLIKE | n= NOT t= MATCHES | t= MEMBEROF | n= NOT t= MEMBEROF | TILDE t= ID (param= square_chunk )? | n= NOT TILDE t= ID (param= square_chunk )? )", 78, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt78) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1582:5: t= '=='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,81,FOLLOW_81_in_simple_operator4509); if (failed) return ;
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1583:5: t= '>'
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,82,FOLLOW_82_in_simple_operator4517); if (failed) return ;
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1584:5: t= '>='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,83,FOLLOW_83_in_simple_operator4525); if (failed) return ;
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1585:5: t= '<'
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,84,FOLLOW_84_in_simple_operator4533); if (failed) return ;
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1586:5: t= '<='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,85,FOLLOW_85_in_simple_operator4541); if (failed) return ;
+
+                    }
+                    break;
+                case 6 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1587:5: t= '!='
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,86,FOLLOW_86_in_simple_operator4549); if (failed) return ;
+
+                    }
+                    break;
+                case 7 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1588:25: t= CONTAINS
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,CONTAINS,FOLLOW_CONTAINS_in_simple_operator4577); if (failed) return ;
+
+                    }
+                    break;
+                case 8 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1589:25: n= NOT t= CONTAINS
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4605); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,CONTAINS,FOLLOW_CONTAINS_in_simple_operator4609); if (failed) return ;
+
+                    }
+                    break;
+                case 9 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1590:25: t= EXCLUDES
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,EXCLUDES,FOLLOW_EXCLUDES_in_simple_operator4637); if (failed) return ;
+
+                    }
+                    break;
+                case 10 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1591:25: t= MATCHES
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,MATCHES,FOLLOW_MATCHES_in_simple_operator4665); if (failed) return ;
+
+                    }
+                    break;
+                case 11 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1592:25: t= SOUNDSLIKE
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,SOUNDSLIKE,FOLLOW_SOUNDSLIKE_in_simple_operator4693); if (failed) return ;
+
+                    }
+                    break;
+                case 12 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1593:25: n= NOT t= MATCHES
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4721); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,MATCHES,FOLLOW_MATCHES_in_simple_operator4725); if (failed) return ;
+
+                    }
+                    break;
+                case 13 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1594:25: t= MEMBEROF
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,MEMBEROF,FOLLOW_MEMBEROF_in_simple_operator4753); if (failed) return ;
+
+                    }
+                    break;
+                case 14 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1595:25: n= NOT t= MEMBEROF
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4781); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,MEMBEROF,FOLLOW_MEMBEROF_in_simple_operator4785); if (failed) return ;
+
+                    }
+                    break;
+                case 15 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:5: TILDE t= ID (param= square_chunk )?
+                    {
+                    match(input,TILDE,FOLLOW_TILDE_in_simple_operator4791); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_simple_operator4795); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:21: (param= square_chunk )?
+                    int alt76=2;
+                    int LA76_0 = input.LA(1);
+
+                    if ( (LA76_0==LEFT_SQUARE) ) {
+                        alt76=1;
+                    }
+                    switch (alt76) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1596:21: param= square_chunk
+                            {
+                            pushFollow(FOLLOW_square_chunk_in_simple_operator4799);
+                            param=square_chunk();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+                case 16 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:5: n= NOT TILDE t= ID (param= square_chunk )?
+                    {
+                    n=(Token)input.LT(1);
+                    match(input,NOT,FOLLOW_NOT_in_simple_operator4808); if (failed) return ;
+                    match(input,TILDE,FOLLOW_TILDE_in_simple_operator4810); if (failed) return ;
+                    t=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_simple_operator4814); if (failed) return ;
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:27: (param= square_chunk )?
+                    int alt77=2;
+                    int LA77_0 = input.LA(1);
+
+                    if ( (LA77_0==LEFT_SQUARE) ) {
+                        alt77=1;
+                    }
+                    switch (alt77) {
+                        case 1 :
+                            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1597:27: param= square_chunk
+                            {
+                            pushFollow(FOLLOW_square_chunk_in_simple_operator4818);
+                            param=square_chunk();
+                            _fsp--;
+                            if (failed) return ;
+
+                            }
+                            break;
+
+                    }
+
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+                		    location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, t.getText());
+               	            op = t.getText();
+               	            isNegated = n != null;
+               	            if( param != null ) {
+                                      paramText = safeSubstring( input.toString(param.start,param.stop), 1, input.toString(param.start,param.stop).length()-1 );
+               	            } 
+              		
+            }
+            pushFollow(FOLLOW_expression_value_in_simple_operator4833);
+            rd=expression_value(base,  op,  isNegated,  paramText);
+            _fsp--;
+            if (failed) return ;
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+            
+            		if ( rd == null && op != null ) {
+            		        base.addRestriction( new LiteralRestrictionDescr(op, false, null) );
+            		}
+            	
+        }
+        return ;
+    }
+    // $ANTLR end simple_operator
+
+
+    // $ANTLR start compound_operator
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1616:1: compound_operator[RestrictionConnectiveDescr base] : ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN ;
+    public final void compound_operator(RestrictionConnectiveDescr base) throws RecognitionException {
+        RestrictionDescr rd = null;
+
+
+        
+        		String op = null;
+        		RestrictionConnectiveDescr group = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1621:2: ( ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:3: ( IN | NOT IN ) LEFT_PAREN rd= expression_value[group, op, false, null] ( COMMA rd= expression_value[group, op, false, null] )* RIGHT_PAREN
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:3: ( IN | NOT IN )
+            int alt79=2;
+            int LA79_0 = input.LA(1);
+
+            if ( (LA79_0==IN) ) {
+                alt79=1;
+            }
+            else if ( (LA79_0==NOT) ) {
+                alt79=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return ;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1622:3: ( IN | NOT IN )", 79, 0, input);
+
+                throw nvae;
+            }
+            switch (alt79) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1622:5: IN
+                    {
+                    match(input,IN,FOLLOW_IN_in_compound_operator4863); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			  op = "==";
+                      			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+                      			  base.addRestriction( group );
+                        		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                          	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+                      			
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1630:5: NOT IN
+                    {
+                    match(input,NOT,FOLLOW_NOT_in_compound_operator4875); if (failed) return ;
+                    match(input,IN,FOLLOW_IN_in_compound_operator4877); if (failed) return ;
+                    if ( backtracking==0 ) {
+                      
+                      			  op = "!=";
+                      			  group = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+                      			  base.addRestriction( group );
+                        		    	  location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
+                                          	  location.setProperty(Location.LOCATION_PROPERTY_OPERATOR, "in");
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_compound_operator4892); if (failed) return ;
+            pushFollow(FOLLOW_expression_value_in_compound_operator4896);
+            rd=expression_value(group,  op,  false,  null);
+            _fsp--;
+            if (failed) return ;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1640:3: ( COMMA rd= expression_value[group, op, false, null] )*
+            loop80:
+            do {
+                int alt80=2;
+                int LA80_0 = input.LA(1);
+
+                if ( (LA80_0==COMMA) ) {
+                    alt80=1;
+                }
+
+
+                switch (alt80) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1640:5: COMMA rd= expression_value[group, op, false, null]
+            	    {
+            	    match(input,COMMA,FOLLOW_COMMA_in_compound_operator4903); if (failed) return ;
+            	    pushFollow(FOLLOW_expression_value_in_compound_operator4907);
+            	    rd=expression_value(group,  op,  false,  null);
+            	    _fsp--;
+            	    if (failed) return ;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop80;
+                }
+            } while (true);
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_compound_operator4916); if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end compound_operator
+
+
+    // $ANTLR start expression_value
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1647:1: expression_value[RestrictionConnectiveDescr base, String op, boolean isNegated, String paramText] returns [RestrictionDescr rd] : (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk ) ;
+    public final RestrictionDescr expression_value(RestrictionConnectiveDescr base, String op, boolean isNegated, String paramText) throws RecognitionException {
+        RestrictionDescr rd = null;
+
+        accessor_path_return ap = null;
+
+        literal_constraint_return lc = null;
+
+        paren_chunk_return rvc = null;
+
+
+        
+        		rd = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1651:2: ( (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )
+            int alt81=3;
+            switch ( input.LA(1) ) {
+            case PACKAGE:
+            case IMPORT:
+            case FUNCTION:
+            case ID:
+            case GLOBAL:
+            case QUERY:
+            case END:
+            case TEMPLATE:
+            case RULE:
+            case WHEN:
+            case ATTRIBUTES:
+            case ENABLED:
+            case SALIENCE:
+            case DURATION:
+            case DIALECT:
+            case FROM:
+            case INIT:
+            case ACTION:
+            case REVERSE:
+            case RESULT:
+            case CONTAINS:
+            case EXCLUDES:
+            case MATCHES:
+            case SOUNDSLIKE:
+            case MEMBEROF:
+            case IN:
+            case THEN:
+            case EVENT:
+                {
+                alt81=1;
+                }
+                break;
+            case STRING:
+            case BOOL:
+            case INT:
+            case FLOAT:
+            case NULL:
+                {
+                alt81=2;
+                }
+                break;
+            case LEFT_PAREN:
+                {
+                alt81=3;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return rd;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1652:3: (ap= accessor_path | lc= literal_constraint | rvc= paren_chunk )", 81, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt81) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1652:5: ap= accessor_path
+                    {
+                    pushFollow(FOLLOW_accessor_path_in_expression_value4950);
+                    ap=accessor_path();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      			        if( ap.text.indexOf( '.' ) > -1 || ap.text.indexOf( '[' ) > -1) {
+                      					rd = new QualifiedIdentifierRestrictionDescr(op, isNegated, paramText, ap.text);
+                      				} else {
+                      					rd = new VariableRestrictionDescr(op, isNegated, paramText, ap.text);
+                      				}
+                      			
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1660:5: lc= literal_constraint
+                    {
+                    pushFollow(FOLLOW_literal_constraint_in_expression_value4970);
+                    lc=literal_constraint();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      				rd = new LiteralRestrictionDescr(op, isNegated, paramText, lc.text, lc.type );
+                      			
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1664:5: rvc= paren_chunk
+                    {
+                    pushFollow(FOLLOW_paren_chunk_in_expression_value4984);
+                    rvc=paren_chunk();
+                    _fsp--;
+                    if (failed) return rd;
+                    if ( backtracking==0 ) {
+                       
+                      				rd = new ReturnValueRestrictionDescr(op, isNegated, paramText, safeSubstring( input.toString(rvc.start,rvc.stop), 1, input.toString(rvc.start,rvc.stop).length()-1) );							
+                      			
+                    }
+
+                    }
+                    break;
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              			if( rd != null ) {
+              				base.addRestriction( rd );
+              			}
+              			location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_END);
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return rd;
+    }
+    // $ANTLR end expression_value
+
+    public static class literal_constraint_return extends ParserRuleReturnScope {
+        public String text;
+        public int type;
+    };
+
+    // $ANTLR start literal_constraint
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1677:1: literal_constraint returns [String text, int type] : (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+    public final literal_constraint_return literal_constraint() throws RecognitionException {
+        literal_constraint_return retval = new literal_constraint_return();
+        retval.start = input.LT(1);
+
+        Token t=null;
+
+        
+        		retval.text = null;
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:2: ( (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            int alt82=5;
+            switch ( input.LA(1) ) {
+            case STRING:
+                {
+                alt82=1;
+                }
+                break;
+            case INT:
+                {
+                alt82=2;
+                }
+                break;
+            case FLOAT:
+                {
+                alt82=3;
+                }
+                break;
+            case BOOL:
+                {
+                alt82=4;
+                }
+                break;
+            case NULL:
+                {
+                alt82=5;
+                }
+                break;
+            default:
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1681:4: (t= STRING | t= INT | t= FLOAT | t= BOOL | t= NULL )", 82, 0, input);
+
+                throw nvae;
+            }
+
+            switch (alt82) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1681:6: t= STRING
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_literal_constraint5027); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = getString( t.getText() ); retval.type = LiteralRestrictionDescr.TYPE_STRING; 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1682:5: t= INT
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,INT,FOLLOW_INT_in_literal_constraint5038); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_NUMBER; 
+                    }
+
+                    }
+                    break;
+                case 3 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1683:5: t= FLOAT
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,FLOAT,FOLLOW_FLOAT_in_literal_constraint5051); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_NUMBER; 
+                    }
+
+                    }
+                    break;
+                case 4 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1684:5: t= BOOL
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,BOOL,FOLLOW_BOOL_in_literal_constraint5062); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = t.getText(); retval.type = LiteralRestrictionDescr.TYPE_BOOLEAN; 
+                    }
+
+                    }
+                    break;
+                case 5 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1685:5: t= NULL
+                    {
+                    t=(Token)input.LT(1);
+                    match(input,NULL,FOLLOW_NULL_in_literal_constraint5074); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.text = null; retval.type = LiteralRestrictionDescr.TYPE_NULL; 
+                    }
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end literal_constraint
+
+
+    // $ANTLR start predicate
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1689:1: predicate[ConditionalElementDescr base] : text= paren_chunk ;
+    public final void predicate(ConditionalElementDescr base) throws RecognitionException {
+        paren_chunk_return text = null;
+
+
+        
+        		PredicateDescr d = null;
+                
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1693:2: (text= paren_chunk )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1694:3: text= paren_chunk
+            {
+            pushFollow(FOLLOW_paren_chunk_in_predicate5112);
+            text=paren_chunk();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+              		        if( input.toString(text.start,text.stop) != null ) {
+              				d = new PredicateDescr( );
+              			        d.setContent( safeSubstring( input.toString(text.start,text.stop), 1, input.toString(text.start,text.stop).length()-1 ) );
+              				d.setEndCharacter( ((CommonToken)((Token)text.stop)).getStopIndex() );
+              				base.addDescr( d );
+              		        }
+              		
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end predicate
+
+    public static class curly_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start curly_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1706:1: curly_chunk : LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY ;
+    public final curly_chunk_return curly_chunk() throws RecognitionException {
+        curly_chunk_return retval = new curly_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1707:2: ( LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:3: LEFT_CURLY (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )* RIGHT_CURLY
+            {
+            match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_curly_chunk5130); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:14: (~ ( LEFT_CURLY | RIGHT_CURLY ) | curly_chunk )*
+            loop83:
+            do {
+                int alt83=3;
+                int LA83_0 = input.LA(1);
+
+                if ( ((LA83_0>=PACKAGE && LA83_0<=DECLARE)||(LA83_0>=STRING && LA83_0<=86)) ) {
+                    alt83=1;
+                }
+                else if ( (LA83_0==LEFT_CURLY) ) {
+                    alt83=2;
+                }
+
+
+                switch (alt83) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:16: ~ ( LEFT_CURLY | RIGHT_CURLY )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=DECLARE)||(input.LA(1)>=STRING && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_curly_chunk5134);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1708:44: curly_chunk
+            	    {
+            	    pushFollow(FOLLOW_curly_chunk_in_curly_chunk5143);
+            	    curly_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop83;
+                }
+            } while (true);
+
+            match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_curly_chunk5148); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end curly_chunk
+
+    public static class paren_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start paren_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1711:1: paren_chunk : LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN ;
+    public final paren_chunk_return paren_chunk() throws RecognitionException {
+        paren_chunk_return retval = new paren_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1712:2: ( LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:3: LEFT_PAREN (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )* RIGHT_PAREN
+            {
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_paren_chunk5162); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:14: (~ ( LEFT_PAREN | RIGHT_PAREN ) | paren_chunk )*
+            loop84:
+            do {
+                int alt84=3;
+                int LA84_0 = input.LA(1);
+
+                if ( ((LA84_0>=PACKAGE && LA84_0<=GLOBAL)||LA84_0==COMMA||(LA84_0>=DECLARE && LA84_0<=86)) ) {
+                    alt84=1;
+                }
+                else if ( (LA84_0==LEFT_PAREN) ) {
+                    alt84=2;
+                }
+
+
+                switch (alt84) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:16: ~ ( LEFT_PAREN | RIGHT_PAREN )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=GLOBAL)||input.LA(1)==COMMA||(input.LA(1)>=DECLARE && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_paren_chunk5166);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1713:44: paren_chunk
+            	    {
+            	    pushFollow(FOLLOW_paren_chunk_in_paren_chunk5175);
+            	    paren_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop84;
+                }
+            } while (true);
+
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_paren_chunk5180); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end paren_chunk
+
+    public static class square_chunk_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start square_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1716:1: square_chunk : LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE ;
+    public final square_chunk_return square_chunk() throws RecognitionException {
+        square_chunk_return retval = new square_chunk_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1717:2: ( LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:3: LEFT_SQUARE (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )* RIGHT_SQUARE
+            {
+            match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_square_chunk5193); if (failed) return retval;
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:15: (~ ( LEFT_SQUARE | RIGHT_SQUARE ) | square_chunk )*
+            loop85:
+            do {
+                int alt85=3;
+                int LA85_0 = input.LA(1);
+
+                if ( ((LA85_0>=PACKAGE && LA85_0<=NULL)||(LA85_0>=THEN && LA85_0<=86)) ) {
+                    alt85=1;
+                }
+                else if ( (LA85_0==LEFT_SQUARE) ) {
+                    alt85=2;
+                }
+
+
+                switch (alt85) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:17: ~ ( LEFT_SQUARE | RIGHT_SQUARE )
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=NULL)||(input.LA(1)>=THEN && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return retval;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_square_chunk5197);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1718:47: square_chunk
+            	    {
+            	    pushFollow(FOLLOW_square_chunk_in_square_chunk5206);
+            	    square_chunk();
+            	    _fsp--;
+            	    if (failed) return retval;
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop85;
+                }
+            } while (true);
+
+            match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_square_chunk5211); if (failed) return retval;
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end square_chunk
+
+    public static class qualified_id_return extends ParserRuleReturnScope {
+        public String text;
+    };
+
+    // $ANTLR start qualified_id
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1721:1: qualified_id returns [ String text ] : ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* ;
+    public final qualified_id_return qualified_id() throws RecognitionException {
+        qualified_id_return retval = new qualified_id_return();
+        retval.start = input.LT(1);
+
+        Token ID56=null;
+        identifier_return identifier57 = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:2: ( ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:5: ID ( DOT identifier )* ( LEFT_SQUARE RIGHT_SQUARE )*
+            {
+            ID56=(Token)input.LT(1);
+            match(input,ID,FOLLOW_ID_in_qualified_id5240); if (failed) return retval;
+            if ( backtracking==0 ) {
+              buf.append(ID56.getText());
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:32: ( DOT identifier )*
+            loop86:
+            do {
+                int alt86=2;
+                int LA86_0 = input.LA(1);
+
+                if ( (LA86_0==DOT) ) {
+                    alt86=1;
+                }
+
+
+                switch (alt86) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:34: DOT identifier
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_qualified_id5246); if (failed) return retval;
+            	    pushFollow(FOLLOW_identifier_in_qualified_id5248);
+            	    identifier57=identifier();
+            	    _fsp--;
+            	    if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+input.toString(identifier57.start,identifier57.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop86;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:88: ( LEFT_SQUARE RIGHT_SQUARE )*
+            loop87:
+            do {
+                int alt87=2;
+                int LA87_0 = input.LA(1);
+
+                if ( (LA87_0==LEFT_SQUARE) ) {
+                    alt87=1;
+                }
+
+
+                switch (alt87) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1728:90: LEFT_SQUARE RIGHT_SQUARE
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_qualified_id5257); if (failed) return retval;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_qualified_id5259); if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("[]");
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop87;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+            if ( backtracking==0 ) {
+              
+              	        retval.text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end qualified_id
+
+
+    // $ANTLR start dotted_name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1731:1: dotted_name returns [ String text ] : i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* ;
+    public final String dotted_name() throws RecognitionException {
+        String text = null;
+
+        identifier_return i = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:2: (i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:4: i= identifier ( DOT i= identifier )* ( LEFT_SQUARE RIGHT_SQUARE )*
+            {
+            pushFollow(FOLLOW_identifier_in_dotted_name5293);
+            i=identifier();
+            _fsp--;
+            if (failed) return text;
+            if ( backtracking==0 ) {
+              buf.append(input.toString(i.start,i.stop));
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:40: ( DOT i= identifier )*
+            loop88:
+            do {
+                int alt88=2;
+                int LA88_0 = input.LA(1);
+
+                if ( (LA88_0==DOT) ) {
+                    alt88=1;
+                }
+
+
+                switch (alt88) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:42: DOT i= identifier
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_dotted_name5299); if (failed) return text;
+            	    pushFollow(FOLLOW_identifier_in_dotted_name5303);
+            	    i=identifier();
+            	    _fsp--;
+            	    if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+input.toString(i.start,i.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop88;
+                }
+            } while (true);
+
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:89: ( LEFT_SQUARE RIGHT_SQUARE )*
+            loop89:
+            do {
+                int alt89=2;
+                int LA89_0 = input.LA(1);
+
+                if ( (LA89_0==LEFT_SQUARE) ) {
+                    alt89=1;
+                }
+
+
+                switch (alt89) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1738:91: LEFT_SQUARE RIGHT_SQUARE
+            	    {
+            	    match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_dotted_name5312); if (failed) return text;
+            	    match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_dotted_name5314); if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append("[]");
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop89;
+                }
+            } while (true);
+
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              	        text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return text;
+    }
+    // $ANTLR end dotted_name
+
+    public static class accessor_path_return extends ParserRuleReturnScope {
+        public String text;
+    };
+
+    // $ANTLR start accessor_path
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1741:1: accessor_path returns [ String text ] : a= accessor_element ( DOT a= accessor_element )* ;
+    public final accessor_path_return accessor_path() throws RecognitionException {
+        accessor_path_return retval = new accessor_path_return();
+        retval.start = input.LT(1);
+
+        String a = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:2: (a= accessor_element ( DOT a= accessor_element )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:4: a= accessor_element ( DOT a= accessor_element )*
+            {
+            pushFollow(FOLLOW_accessor_element_in_accessor_path5348);
+            a=accessor_element();
+            _fsp--;
+            if (failed) return retval;
+            if ( backtracking==0 ) {
+              buf.append(a);
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:46: ( DOT a= accessor_element )*
+            loop90:
+            do {
+                int alt90=2;
+                int LA90_0 = input.LA(1);
+
+                if ( (LA90_0==DOT) ) {
+                    alt90=1;
+                }
+
+
+                switch (alt90) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1748:48: DOT a= accessor_element
+            	    {
+            	    match(input,DOT,FOLLOW_DOT_in_accessor_path5354); if (failed) return retval;
+            	    pushFollow(FOLLOW_accessor_element_in_accessor_path5358);
+            	    a=accessor_element();
+            	    _fsp--;
+            	    if (failed) return retval;
+            	    if ( backtracking==0 ) {
+            	      buf.append("."+a);
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop90;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+            if ( backtracking==0 ) {
+              
+              	        retval.text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end accessor_path
+
+
+    // $ANTLR start accessor_element
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1751:1: accessor_element returns [ String text ] : i= identifier (s= square_chunk )* ;
+    public final String accessor_element() throws RecognitionException {
+        String text = null;
+
+        identifier_return i = null;
+
+        square_chunk_return s = null;
+
+
+        
+        	        StringBuffer buf = new StringBuffer();
+        	
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1758:2: (i= identifier (s= square_chunk )* )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:3: i= identifier (s= square_chunk )*
+            {
+            pushFollow(FOLLOW_identifier_in_accessor_element5396);
+            i=identifier();
+            _fsp--;
+            if (failed) return text;
+            if ( backtracking==0 ) {
+              buf.append(input.toString(i.start,i.stop));
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:39: (s= square_chunk )*
+            loop91:
+            do {
+                int alt91=2;
+                int LA91_0 = input.LA(1);
+
+                if ( (LA91_0==LEFT_SQUARE) ) {
+                    alt91=1;
+                }
+
+
+                switch (alt91) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1759:40: s= square_chunk
+            	    {
+            	    pushFollow(FOLLOW_square_chunk_in_accessor_element5403);
+            	    s=square_chunk();
+            	    _fsp--;
+            	    if (failed) return text;
+            	    if ( backtracking==0 ) {
+            	      buf.append(input.toString(s.start,s.stop));
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop91;
+                }
+            } while (true);
+
+
+            }
+
+            if ( backtracking==0 ) {
+              
+              	        text = buf != null ? buf.toString() : "";
+              	
+            }
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return text;
+    }
+    // $ANTLR end accessor_element
+
+
+    // $ANTLR start rhs_chunk
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1762:1: rhs_chunk[RuleDescr rule] : THEN (~ END )* loc= END opt_semicolon ;
+    public final void rhs_chunk(RuleDescr rule) throws RecognitionException {
+        Token loc=null;
+        Token THEN58=null;
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1763:2: ( THEN (~ END )* loc= END opt_semicolon )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1764:3: THEN (~ END )* loc= END opt_semicolon
+            {
+            THEN58=(Token)input.LT(1);
+            match(input,THEN,FOLLOW_THEN_in_rhs_chunk5424); if (failed) return ;
+            if ( backtracking==0 ) {
+               location.setType( Location.LOCATION_RHS ); 
+            }
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1765:3: (~ END )*
+            loop92:
+            do {
+                int alt92=2;
+                int LA92_0 = input.LA(1);
+
+                if ( ((LA92_0>=PACKAGE && LA92_0<=QUERY)||(LA92_0>=TEMPLATE && LA92_0<=86)) ) {
+                    alt92=1;
+                }
+
+
+                switch (alt92) {
+            	case 1 :
+            	    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1765:5: ~ END
+            	    {
+            	    if ( (input.LA(1)>=PACKAGE && input.LA(1)<=QUERY)||(input.LA(1)>=TEMPLATE && input.LA(1)<=86) ) {
+            	        input.consume();
+            	        errorRecovery=false;failed=false;
+            	    }
+            	    else {
+            	        if (backtracking>0) {failed=true; return ;}
+            	        MismatchedSetException mse =
+            	            new MismatchedSetException(null,input);
+            	        recoverFromMismatchedSet(input,mse,FOLLOW_set_in_rhs_chunk5432);    throw mse;
+            	    }
+
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop92;
+                }
+            } while (true);
+
+            loc=(Token)input.LT(1);
+            match(input,END,FOLLOW_END_in_rhs_chunk5456); if (failed) return ;
+            pushFollow(FOLLOW_opt_semicolon_in_rhs_chunk5458);
+            opt_semicolon();
+            _fsp--;
+            if (failed) return ;
+            if ( backtracking==0 ) {
+              
+                                  // ignoring first line in the consequence
+                                  String buf = input.toString( THEN58, loc );
+                                  // removing final END keyword
+                                  int idx=4;
+                                  while( idx < buf.length()-3 && (buf.charAt(idx) == ' ' || buf.charAt(idx) == '\t') ) {
+                                      idx++;
+                                  }
+                                  if( idx < buf.length()-3 && buf.charAt(idx) == '\r' ) idx++;
+                                  if( idx < buf.length()-3 && buf.charAt(idx) == '\n' ) idx++;
+                                  buf = safeSubstring( buf, idx, buf.length()-3 );
+              		    rule.setConsequence( buf );
+                   		    rule.setConsequenceLocation(offset(THEN58.getLine()), THEN58.getCharPositionInLine());
+               		    rule.setEndCharacter( ((CommonToken)loc).getStopIndex() );
+               		    location.setProperty( Location.LOCATION_RHS_CONTENT, rule.getConsequence() );
+                              
+            }
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end rhs_chunk
+
+    public static class name_return extends ParserRuleReturnScope {
+        public String name;
+    };
+
+    // $ANTLR start name
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1785:1: name returns [String name] : ( ID | STRING );
+    public final name_return name() throws RecognitionException {
+        name_return retval = new name_return();
+        retval.start = input.LT(1);
+
+        Token ID59=null;
+        Token STRING60=null;
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1786:2: ( ID | STRING )
+            int alt93=2;
+            int LA93_0 = input.LA(1);
+
+            if ( (LA93_0==ID) ) {
+                alt93=1;
+            }
+            else if ( (LA93_0==STRING) ) {
+                alt93=2;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                NoViableAltException nvae =
+                    new NoViableAltException("1785:1: name returns [String name] : ( ID | STRING );", 93, 0, input);
+
+                throw nvae;
+            }
+            switch (alt93) {
+                case 1 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1786:5: ID
+                    {
+                    ID59=(Token)input.LT(1);
+                    match(input,ID,FOLLOW_ID_in_name5492); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.name = ID59.getText(); 
+                    }
+
+                    }
+                    break;
+                case 2 :
+                    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1787:5: STRING
+                    {
+                    STRING60=(Token)input.LT(1);
+                    match(input,STRING,FOLLOW_STRING_in_name5500); if (failed) return retval;
+                    if ( backtracking==0 ) {
+                       retval.name = getString( STRING60.getText() ); 
+                    }
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end name
+
+    public static class identifier_return extends ParserRuleReturnScope {
+    };
+
+    // $ANTLR start identifier
+    // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1790:1: identifier : ( ID | PACKAGE | FUNCTION | GLOBAL | IMPORT | EVENT | RULE | QUERY | TEMPLATE | ATTRIBUTES | ENABLED | SALIENCE | DURATION | DIALECT | FROM | INIT | ACTION | REVERSE | RESULT | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | WHEN | THEN | END | IN );
+    public final identifier_return identifier() throws RecognitionException {
+        identifier_return retval = new identifier_return();
+        retval.start = input.LT(1);
+
+        try {
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1791:2: ( ID | PACKAGE | FUNCTION | GLOBAL | IMPORT | EVENT | RULE | QUERY | TEMPLATE | ATTRIBUTES | ENABLED | SALIENCE | DURATION | DIALECT | FROM | INIT | ACTION | REVERSE | RESULT | CONTAINS | EXCLUDES | MEMBEROF | MATCHES | SOUNDSLIKE | WHEN | THEN | END | IN )
+            // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:
+            {
+            if ( (input.LA(1)>=PACKAGE && input.LA(1)<=ID)||input.LA(1)==GLOBAL||(input.LA(1)>=QUERY && input.LA(1)<=ATTRIBUTES)||input.LA(1)==ENABLED||input.LA(1)==SALIENCE||(input.LA(1)>=DURATION && input.LA(1)<=DIALECT)||input.LA(1)==FROM||(input.LA(1)>=INIT && input.LA(1)<=RESULT)||(input.LA(1)>=CONTAINS && input.LA(1)<=MEMBEROF)||input.LA(1)==IN||(input.LA(1)>=THEN && input.LA(1)<=EVENT) ) {
+                input.consume();
+                errorRecovery=false;failed=false;
+            }
+            else {
+                if (backtracking>0) {failed=true; return retval;}
+                MismatchedSetException mse =
+                    new MismatchedSetException(null,input);
+                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_identifier0);    throw mse;
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return retval;
+    }
+    // $ANTLR end identifier
+
+    // $ANTLR start synpred1
+    public final void synpred1_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:6: ( EXISTS )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:827:8: EXISTS
+        {
+        match(input,EXISTS,FOLLOW_EXISTS_in_synpred12216); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred1
+
+    // $ANTLR start synpred2
+    public final void synpred2_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:5: ( NOT )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:828:7: NOT
+        {
+        match(input,NOT,FOLLOW_NOT_in_synpred22234); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred2
+
+    // $ANTLR start synpred3
+    public final void synpred3_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:5: ( EVAL )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:829:7: EVAL
+        {
+        match(input,EVAL,FOLLOW_EVAL_in_synpred32253); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred3
+
+    // $ANTLR start synpred4
+    public final void synpred4_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:5: ( FORALL )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:830:7: FORALL
+        {
+        match(input,FORALL,FOLLOW_FORALL_in_synpred42272); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred4
+
+    // $ANTLR start synpred5
+    public final void synpred5_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:5: ( LEFT_PAREN )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:831:7: LEFT_PAREN
+        {
+        match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_synpred52291); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred5
+
+    // $ANTLR start synpred6
+    public final void synpred6_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:13: ( FROM ENTRY_POINT )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:846:14: FROM ENTRY_POINT
+        {
+        match(input,FROM,FOLLOW_FROM_in_synpred62397); if (failed) return ;
+        match(input,ENTRY_POINT,FOLLOW_ENTRY_POINT_in_synpred62399); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred6
+
+    // $ANTLR start synpred10
+    public final void synpred10_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:6: ( LEFT_SQUARE )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1203:8: LEFT_SQUARE
+        {
+        match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_synpred103560); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred10
+
+    // $ANTLR start synpred11
+    public final void synpred11_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:6: ( LEFT_PAREN )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1209:8: LEFT_PAREN
+        {
+        match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_synpred113593); if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred11
+
+    // $ANTLR start synpred12
+    public final void synpred12_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: ( DOUBLE_PIPE and_restr_connective[or] )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1525:4: DOUBLE_PIPE and_restr_connective[or]
+        {
+        match(input,DOUBLE_PIPE,FOLLOW_DOUBLE_PIPE_in_synpred124338); if (failed) return ;
+        pushFollow(FOLLOW_and_restr_connective_in_synpred124349);
+        and_restr_connective(or);
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred12
+
+    // $ANTLR start synpred13
+    public final void synpred13_fragment() throws RecognitionException {   
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: ( DOUBLE_AMPER constraint_expression[and] )
+        // C:\\Documents and Settings\\D049579\\My Documents\\Code\\workspace_jboss_modified\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1547:5: DOUBLE_AMPER constraint_expression[and]
+        {
+        match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_synpred134401); if (failed) return ;
+        pushFollow(FOLLOW_constraint_expression_in_synpred134412);
+        constraint_expression(and);
+        _fsp--;
+        if (failed) return ;
+
+        }
+    }
+    // $ANTLR end synpred13
+
+    public final boolean synpred5() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred5_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred6() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred6_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred10() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred10_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred1() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred1_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred11() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred11_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred2() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred2_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred12() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred12_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred3() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred3_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred13() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred13_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+    public final boolean synpred4() {
+        backtracking++;
+        int start = input.mark();
+        try {
+            synpred4_fragment(); // can never throw exception
+        } catch (RecognitionException re) {
+            System.err.println("impossible: "+re);
+        }
+        boolean success = !failed;
+        input.rewind(start);
+        backtracking--;
+        failed=false;
+        return success;
+    }
+
+
+    protected DFA8 dfa8 = new DFA8(this);
+    protected DFA9 dfa9 = new DFA9(this);
+    protected DFA19 dfa19 = new DFA19(this);
+    protected DFA61 dfa61 = new DFA61(this);
+    protected DFA73 dfa73 = new DFA73(this);
+    protected DFA74 dfa74 = new DFA74(this);
+    static final String DFA8_eotS =
+        "\6\uffff";
+    static final String DFA8_eofS =
+        "\6\uffff";
+    static final String DFA8_minS =
+        "\2\4\1\100\2\uffff\1\4";
+    static final String DFA8_maxS =
+        "\2\102\1\100\2\uffff\1\102";
+    static final String DFA8_acceptS =
+        "\3\uffff\1\2\1\1\1\uffff";
+    static final String DFA8_specialS =
+        "\6\uffff}>";
+    static final String[] DFA8_transitionS = {
+            "\4\1\1\uffff\1\1\7\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6\uffff"+
+            "\2\1\5\uffff\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\1\1\4\uffff"+
+            "\2\1",
+            "\6\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff\1\4\6\uffff"+
+            "\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff\1\4\2\uffff"+
+            "\1\2\1\uffff\2\4",
+            "\1\5",
+            "",
+            "",
+            "\4\4\1\uffff\1\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff"+
+            "\1\4\6\uffff\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff"+
+            "\1\4\2\uffff\1\2\1\uffff\2\4"
+    };
+
+    static final short[] DFA8_eot = DFA.unpackEncodedString(DFA8_eotS);
+    static final short[] DFA8_eof = DFA.unpackEncodedString(DFA8_eofS);
+    static final char[] DFA8_min = DFA.unpackEncodedStringToUnsignedChars(DFA8_minS);
+    static final char[] DFA8_max = DFA.unpackEncodedStringToUnsignedChars(DFA8_maxS);
+    static final short[] DFA8_accept = DFA.unpackEncodedString(DFA8_acceptS);
+    static final short[] DFA8_special = DFA.unpackEncodedString(DFA8_specialS);
+    static final short[][] DFA8_transition;
+
+    static {
+        int numStates = DFA8_transitionS.length;
+        DFA8_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA8_transition[i] = DFA.unpackEncodedString(DFA8_transitionS[i]);
+        }
+    }
+
+    class DFA8 extends DFA {
+
+        public DFA8(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 8;
+            this.eot = DFA8_eot;
+            this.eof = DFA8_eof;
+            this.min = DFA8_min;
+            this.max = DFA8_max;
+            this.accept = DFA8_accept;
+            this.special = DFA8_special;
+            this.transition = DFA8_transition;
+        }
+        public String getDescription() {
+            return "345:15: (paramType= dotted_name )?";
+        }
+    }
+    static final String DFA9_eotS =
+        "\6\uffff";
+    static final String DFA9_eofS =
+        "\6\uffff";
+    static final String DFA9_minS =
+        "\2\4\1\100\2\uffff\1\4";
+    static final String DFA9_maxS =
+        "\2\102\1\100\2\uffff\1\102";
+    static final String DFA9_acceptS =
+        "\3\uffff\1\2\1\1\1\uffff";
+    static final String DFA9_specialS =
+        "\6\uffff}>";
+    static final String[] DFA9_transitionS = {
+            "\4\1\1\uffff\1\1\7\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6\uffff"+
+            "\2\1\5\uffff\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\1\1\4\uffff"+
+            "\2\1",
+            "\6\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff\1\4\6\uffff"+
+            "\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff\1\4\2\uffff"+
+            "\1\2\1\uffff\2\4",
+            "\1\5",
+            "",
+            "",
+            "\4\4\1\uffff\1\4\1\uffff\2\3\4\uffff\6\4\2\uffff\1\4\1\uffff"+
+            "\1\4\6\uffff\2\4\5\uffff\1\4\5\uffff\4\4\3\uffff\5\4\1\uffff"+
+            "\1\4\2\uffff\1\2\1\uffff\2\4"
+    };
+
+    static final short[] DFA9_eot = DFA.unpackEncodedString(DFA9_eotS);
+    static final short[] DFA9_eof = DFA.unpackEncodedString(DFA9_eofS);
+    static final char[] DFA9_min = DFA.unpackEncodedStringToUnsignedChars(DFA9_minS);
+    static final char[] DFA9_max = DFA.unpackEncodedStringToUnsignedChars(DFA9_maxS);
+    static final short[] DFA9_accept = DFA.unpackEncodedString(DFA9_acceptS);
+    static final short[] DFA9_special = DFA.unpackEncodedString(DFA9_specialS);
+    static final short[][] DFA9_transition;
+
+    static {
+        int numStates = DFA9_transitionS.length;
+        DFA9_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA9_transition[i] = DFA.unpackEncodedString(DFA9_transitionS[i]);
+        }
+    }
+
+    class DFA9 extends DFA {
+
+        public DFA9(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 9;
+            this.eot = DFA9_eot;
+            this.eof = DFA9_eof;
+            this.min = DFA9_min;
+            this.max = DFA9_max;
+            this.accept = DFA9_accept;
+            this.special = DFA9_special;
+            this.transition = DFA9_transition;
+        }
+        public String getDescription() {
+            return "350:22: (paramType= dotted_name )?";
+        }
+    }
+    static final String DFA19_eotS =
+        "\11\uffff";
+    static final String DFA19_eofS =
+        "\11\uffff";
+    static final String DFA19_minS =
+        "\2\7\1\uffff\1\7\1\uffff\1\4\1\100\2\7";
+    static final String DFA19_maxS =
+        "\2\55\1\uffff\1\117\1\uffff\1\102\1\100\2\77";
+    static final String DFA19_acceptS =
+        "\2\uffff\1\2\1\uffff\1\1\4\uffff";
+    static final String DFA19_specialS =
+        "\11\uffff}>";
+    static final String[] DFA19_transitionS = {
+            "\1\2\2\uffff\1\1\7\uffff\1\2\27\uffff\4\2",
+            "\1\3\2\uffff\1\2\1\uffff\1\4\30\uffff\1\2\1\uffff\1\2\2\uffff"+
+            "\4\2",
+            "",
+            "\1\4\1\5\1\uffff\1\2\2\4\62\uffff\1\6\17\uffff\1\2",
+            "",
+            "\4\7\1\uffff\1\7\7\uffff\6\7\2\uffff\1\7\1\uffff\1\7\6\uffff"+
+            "\2\7\5\uffff\1\7\5\uffff\4\7\3\uffff\5\7\1\uffff\1\7\4\uffff"+
+            "\2\7",
+            "\1\10",
+            "\1\4\1\5\1\uffff\1\2\64\uffff\1\6",
+            "\1\4\2\uffff\1\2\64\uffff\1\6"
+    };
+
+    static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
+    static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
+    static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
+    static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
+    static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
+    static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
+    static final short[][] DFA19_transition;
+
+    static {
+        int numStates = DFA19_transitionS.length;
+        DFA19_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
+        }
+    }
+
+    class DFA19 extends DFA {
+
+        public DFA19(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 19;
+            this.eot = DFA19_eot;
+            this.eof = DFA19_eof;
+            this.min = DFA19_min;
+            this.max = DFA19_max;
+            this.accept = DFA19_accept;
+            this.special = DFA19_special;
+            this.transition = DFA19_transition;
+        }
+        public String getDescription() {
+            return "418:3: ( LEFT_PAREN ( ( (paramType= qualified_id )? paramName= ID ) ( COMMA (paramType= qualified_id )? paramName= ID )* )? RIGHT_PAREN )?";
+        }
+    }
+    static final String DFA61_eotS =
+        "\150\uffff";
+    static final String DFA61_eofS =
+        "\150\uffff";
+    static final String DFA61_minS =
+        "\1\7\1\uffff\1\4\1\uffff\3\4\1\0\1\uffff\4\4\1\uffff\1\4\1\0\5\4"+
+        "\1\0\5\4\2\0\1\4\2\0\3\4\1\0\1\4\1\0\1\4\3\0\2\4\1\0\2\4\2\0\1\4"+
+        "\2\0\2\4\1\0\4\4\1\0\2\4\1\0\2\4\1\0\1\4\1\uffff\44\0";
+    static final String DFA61_maxS =
+        "\1\115\1\uffff\1\126\1\uffff\3\126\1\0\1\uffff\4\126\1\uffff\1\126"+
+        "\1\0\5\126\1\0\5\126\2\0\1\126\2\0\3\126\1\0\1\126\1\0\1\126\3\0"+
+        "\2\126\1\0\2\126\2\0\1\126\2\0\2\126\1\0\4\126\1\0\2\126\1\0\2\126"+
+        "\1\0\1\126\1\uffff\44\0";
+    static final String DFA61_acceptS =
+        "\1\uffff\1\1\1\uffff\1\3\4\uffff\1\2\4\uffff\1\2\65\uffff\1\2\44"+
+        "\uffff";
+    static final String DFA61_specialS =
+        "\1\4\1\uffff\1\5\1\uffff\1\66\1\40\1\11\1\10\1\uffff\1\0\1\42\1"+
+        "\22\1\16\1\uffff\1\71\1\56\1\2\1\57\1\54\1\63\1\72\1\37\1\3\1\13"+
+        "\1\67\1\75\1\15\1\60\1\55\1\14\1\30\1\27\1\23\1\46\1\17\1\41\1\62"+
+        "\1\12\1\61\1\26\1\35\1\34\1\70\1\52\1\33\1\53\1\74\1\31\1\7\1\76"+
+        "\1\36\1\1\1\73\1\32\1\6\1\64\1\24\1\47\1\20\1\43\1\25\1\50\1\44"+
+        "\1\21\1\45\1\65\1\51\45\uffff}>";
+    static final String[] DFA61_transitionS = {
+            "\2\3\1\uffff\1\2\2\3\5\uffff\1\3\11\uffff\1\3\10\uffff\4\3\1"+
+            "\uffff\4\3\1\uffff\1\3\17\uffff\1\1\1\uffff\1\3\13\uffff\1\3",
+            "",
+            "\3\15\1\14\2\15\1\7\1\15\1\10\30\15\1\5\1\15\1\4\2\15\1\6\1"+
+            "\11\1\12\1\13\51\15",
+            "",
+            "\3\15\1\23\2\15\1\17\1\15\1\10\35\15\1\16\1\20\1\21\1\22\51"+
+            "\15",
+            "\3\15\1\31\2\15\1\25\1\15\1\10\35\15\1\24\1\26\1\27\1\30\51"+
+            "\15",
+            "\3\15\1\32\2\15\1\33\1\15\1\10\112\15",
+            "\1\uffff",
+            "",
+            "\3\15\1\35\2\15\1\34\1\15\1\10\112\15",
+            "\6\15\1\36\1\15\1\10\112\15",
+            "\6\15\1\37\1\15\1\10\112\15",
+            "\4\15\1\41\1\15\1\43\1\15\1\10\62\15\1\42\17\15\1\40\7\15",
+            "",
+            "\3\15\1\44\2\15\1\45\1\15\1\10\112\15",
+            "\1\uffff",
+            "\3\15\1\46\2\15\1\47\1\15\1\10\112\15",
+            "\6\15\1\50\1\15\1\10\112\15",
+            "\6\15\1\51\1\15\1\10\112\15",
+            "\4\15\1\53\1\15\1\54\1\15\1\10\62\15\1\55\17\15\1\52\7\15",
+            "\3\15\1\56\2\15\1\57\1\15\1\10\112\15",
+            "\1\uffff",
+            "\3\15\1\61\2\15\1\60\1\15\1\10\112\15",
+            "\6\15\1\62\1\15\1\10\112\15",
+            "\6\15\1\63\1\15\1\10\112\15",
+            "\4\15\1\65\1\15\1\66\1\15\1\10\62\15\1\67\17\15\1\64\7\15",
+            "\4\15\1\71\1\15\1\73\1\15\1\10\62\15\1\72\17\15\1\70\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\4\15\1\75\1\15\1\76\1\15\1\10\62\15\1\77\17\15\1\74\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\100\2\15\1\101\1\15\1\10\112\15",
+            "\4\102\1\15\1\102\1\103\1\15\1\10\4\15\6\102\2\15\1\102\1\15"+
+            "\1\102\6\15\2\102\5\15\1\102\5\15\4\102\3\15\5\102\1\15\1\102"+
+            "\4\15\2\102\24\15",
+            "\6\15\1\103\1\15\1\10\63\15\1\104\26\15",
+            "\1\uffff",
+            "\4\15\1\106\1\15\1\107\1\15\1\10\62\15\1\110\17\15\1\105\7\15",
+            "\1\uffff",
+            "\4\15\1\112\1\15\1\114\1\15\1\10\62\15\1\113\17\15\1\111\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\115\2\15\1\116\1\15\1\10\112\15",
+            "\4\117\1\15\1\117\1\103\1\15\1\10\4\15\6\117\2\15\1\117\1\15"+
+            "\1\117\6\15\2\117\5\15\1\117\5\15\4\117\3\15\5\117\1\15\1\117"+
+            "\4\15\2\117\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\120\26\15",
+            "\4\15\1\122\1\15\1\123\1\15\1\10\62\15\1\124\17\15\1\121\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\4\15\1\126\1\15\1\130\1\15\1\10\62\15\1\127\17\15\1\125\7\15",
+            "\1\uffff",
+            "\1\uffff",
+            "\3\15\1\131\2\15\1\132\1\15\1\10\112\15",
+            "\4\133\1\15\1\133\1\103\1\15\1\10\4\15\6\133\2\15\1\133\1\15"+
+            "\1\133\6\15\2\133\5\15\1\133\5\15\4\133\3\15\5\133\1\15\1\133"+
+            "\4\15\2\133\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\134\26\15",
+            "\3\15\1\135\2\15\1\136\1\15\1\10\112\15",
+            "\4\137\1\15\1\137\1\103\1\15\1\10\4\15\6\137\2\15\1\137\1\15"+
+            "\1\137\6\15\2\137\5\15\1\137\5\15\4\137\3\15\5\137\1\15\1\137"+
+            "\4\15\2\137\24\15",
+            "\6\15\1\103\1\15\1\10\63\15\1\140\26\15",
+            "\1\uffff",
+            "\3\15\1\141\2\15\1\142\1\15\1\10\112\15",
+            "\4\143\1\15\1\143\1\103\1\15\1\10\4\15\6\143\2\15\1\143\1\15"+
+            "\1\143\6\15\2\143\5\15\1\143\5\15\4\143\3\15\5\143\1\15\1\143"+
+            "\4\15\2\143\24\15",
+            "\1\uffff",
+            "\6\15\1\103\1\15\1\10\63\15\1\144\26\15",
+            "\4\15\1\145\1\15\1\146\1\15\1\10\62\15\1\147\27\15",
+            "\1\uffff",
+            "\4\15\1\41\1\15\1\43\1\15\1\10\62\15\1\42\27\15",
+            "",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA61_eot = DFA.unpackEncodedString(DFA61_eotS);
+    static final short[] DFA61_eof = DFA.unpackEncodedString(DFA61_eofS);
+    static final char[] DFA61_min = DFA.unpackEncodedStringToUnsignedChars(DFA61_minS);
+    static final char[] DFA61_max = DFA.unpackEncodedStringToUnsignedChars(DFA61_maxS);
+    static final short[] DFA61_accept = DFA.unpackEncodedString(DFA61_acceptS);
+    static final short[] DFA61_special = DFA.unpackEncodedString(DFA61_specialS);
+    static final short[][] DFA61_transition;
+
+    static {
+        int numStates = DFA61_transitionS.length;
+        DFA61_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA61_transition[i] = DFA.unpackEncodedString(DFA61_transitionS[i]);
+        }
+    }
+
+    class DFA61 extends DFA {
+
+        public DFA61(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 61;
+            this.eot = DFA61_eot;
+            this.eof = DFA61_eof;
+            this.min = DFA61_min;
+            this.max = DFA61_max;
+            this.accept = DFA61_accept;
+            this.special = DFA61_special;
+            this.transition = DFA61_transition;
+        }
+        public String getDescription() {
+            return "1202:4: ( ( LEFT_SQUARE )=>sqarg= square_chunk | ( LEFT_PAREN )=>paarg= paren_chunk )?";
+        }
+        public int specialStateTransition(int s, IntStream input) throws NoViableAltException {
+        	int _s = s;
+            switch ( s ) {
+                    case 0 : 
+                        int LA61_9 = input.LA(1);
+
+                         
+                        int index61_9 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_9==LEFT_PAREN) ) {s = 28;}
+
+                        else if ( (LA61_9==ID) ) {s = 29;}
+
+                        else if ( (LA61_9==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_9>=PACKAGE && LA61_9<=FUNCTION)||(LA61_9>=DOT && LA61_9<=GLOBAL)||LA61_9==COMMA||(LA61_9>=DECLARE && LA61_9<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_9);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 1 : 
+                        int LA61_51 = input.LA(1);
+
+                         
+                        int index61_51 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_51);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 2 : 
+                        int LA61_16 = input.LA(1);
+
+                         
+                        int index61_16 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_16==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_16==ID) ) {s = 38;}
+
+                        else if ( (LA61_16==LEFT_PAREN) ) {s = 39;}
+
+                        else if ( ((LA61_16>=PACKAGE && LA61_16<=FUNCTION)||(LA61_16>=DOT && LA61_16<=GLOBAL)||LA61_16==COMMA||(LA61_16>=DECLARE && LA61_16<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_16);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 3 : 
+                        int LA61_22 = input.LA(1);
+
+                         
+                        int index61_22 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_22==LEFT_PAREN) ) {s = 48;}
+
+                        else if ( (LA61_22==ID) ) {s = 49;}
+
+                        else if ( (LA61_22==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_22>=PACKAGE && LA61_22<=FUNCTION)||(LA61_22>=DOT && LA61_22<=GLOBAL)||LA61_22==COMMA||(LA61_22>=DECLARE && LA61_22<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_22);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 4 : 
+                        int LA61_0 = input.LA(1);
+
+                         
+                        int index61_0 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_0==LEFT_SQUARE) && (synpred10())) {s = 1;}
+
+                        else if ( (LA61_0==LEFT_PAREN) ) {s = 2;}
+
+                        else if ( ((LA61_0>=ID && LA61_0<=DOT)||(LA61_0>=COMMA && LA61_0<=RIGHT_PAREN)||LA61_0==END||LA61_0==INT||(LA61_0>=OR && LA61_0<=DOUBLE_AMPER)||(LA61_0>=EXISTS && LA61_0<=FORALL)||LA61_0==INIT||LA61_0==THEN||LA61_0==77) ) {s = 3;}
+
+                         
+                        input.seek(index61_0);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 5 : 
+                        int LA61_2 = input.LA(1);
+
+                         
+                        int index61_2 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_2==AND) ) {s = 4;}
+
+                        else if ( (LA61_2==OR) ) {s = 5;}
+
+                        else if ( (LA61_2==EXISTS) ) {s = 6;}
+
+                        else if ( (LA61_2==LEFT_PAREN) ) {s = 7;}
+
+                        else if ( (LA61_2==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_2==NOT) ) {s = 9;}
+
+                        else if ( (LA61_2==EVAL) ) {s = 10;}
+
+                        else if ( (LA61_2==FORALL) ) {s = 11;}
+
+                        else if ( (LA61_2==ID) ) {s = 12;}
+
+                        else if ( ((LA61_2>=PACKAGE && LA61_2<=FUNCTION)||(LA61_2>=DOT && LA61_2<=GLOBAL)||LA61_2==COMMA||(LA61_2>=DECLARE && LA61_2<=LOCK_ON_ACTIVE)||LA61_2==DOUBLE_PIPE||(LA61_2>=DOUBLE_AMPER && LA61_2<=FROM)||(LA61_2>=ACCUMULATE && LA61_2<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_2);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 6 : 
+                        int LA61_54 = input.LA(1);
+
+                         
+                        int index61_54 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_54);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 7 : 
+                        int LA61_48 = input.LA(1);
+
+                         
+                        int index61_48 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_48);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 8 : 
+                        int LA61_7 = input.LA(1);
+
+                         
+                        int index61_7 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_7);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 9 : 
+                        int LA61_6 = input.LA(1);
+
+                         
+                        int index61_6 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_6==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_6==ID) ) {s = 26;}
+
+                        else if ( (LA61_6==LEFT_PAREN) ) {s = 27;}
+
+                        else if ( ((LA61_6>=PACKAGE && LA61_6<=FUNCTION)||(LA61_6>=DOT && LA61_6<=GLOBAL)||LA61_6==COMMA||(LA61_6>=DECLARE && LA61_6<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_6);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 10 : 
+                        int LA61_37 = input.LA(1);
+
+                         
+                        int index61_37 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_37);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 11 : 
+                        int LA61_23 = input.LA(1);
+
+                         
+                        int index61_23 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_23==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_23>=PACKAGE && LA61_23<=GLOBAL)||LA61_23==COMMA||(LA61_23>=DECLARE && LA61_23<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_23==LEFT_PAREN) ) {s = 50;}
+
+                         
+                        input.seek(index61_23);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 12 : 
+                        int LA61_29 = input.LA(1);
+
+                         
+                        int index61_29 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_29==79) ) {s = 60;}
+
+                        else if ( (LA61_29==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_29==DOT) ) {s = 61;}
+
+                        else if ( (LA61_29==LEFT_PAREN) ) {s = 62;}
+
+                        else if ( (LA61_29==LEFT_SQUARE) ) {s = 63;}
+
+                        else if ( ((LA61_29>=PACKAGE && LA61_29<=ID)||LA61_29==GLOBAL||LA61_29==COMMA||(LA61_29>=DECLARE && LA61_29<=NULL)||(LA61_29>=RIGHT_SQUARE && LA61_29<=78)||(LA61_29>=80 && LA61_29<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_29);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 13 : 
+                        int LA61_26 = input.LA(1);
+
+                         
+                        int index61_26 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_26==79) ) {s = 56;}
+
+                        else if ( (LA61_26==DOT) ) {s = 57;}
+
+                        else if ( (LA61_26==LEFT_SQUARE) ) {s = 58;}
+
+                        else if ( (LA61_26==LEFT_PAREN) ) {s = 59;}
+
+                        else if ( (LA61_26==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_26>=PACKAGE && LA61_26<=ID)||LA61_26==GLOBAL||LA61_26==COMMA||(LA61_26>=DECLARE && LA61_26<=NULL)||(LA61_26>=RIGHT_SQUARE && LA61_26<=78)||(LA61_26>=80 && LA61_26<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_26);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 14 : 
+                        int LA61_12 = input.LA(1);
+
+                         
+                        int index61_12 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_12==79) ) {s = 32;}
+
+                        else if ( (LA61_12==DOT) ) {s = 33;}
+
+                        else if ( (LA61_12==LEFT_SQUARE) ) {s = 34;}
+
+                        else if ( (LA61_12==LEFT_PAREN) ) {s = 35;}
+
+                        else if ( (LA61_12==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_12>=PACKAGE && LA61_12<=ID)||LA61_12==GLOBAL||LA61_12==COMMA||(LA61_12>=DECLARE && LA61_12<=NULL)||(LA61_12>=RIGHT_SQUARE && LA61_12<=78)||(LA61_12>=80 && LA61_12<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_12);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 15 : 
+                        int LA61_34 = input.LA(1);
+
+                         
+                        int index61_34 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_34==RIGHT_SQUARE) ) {s = 68;}
+
+                        else if ( (LA61_34==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_34>=PACKAGE && LA61_34<=GLOBAL)||LA61_34==COMMA||(LA61_34>=DECLARE && LA61_34<=LEFT_SQUARE)||(LA61_34>=THEN && LA61_34<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_34==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_34);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 16 : 
+                        int LA61_58 = input.LA(1);
+
+                         
+                        int index61_58 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_58==RIGHT_SQUARE) ) {s = 96;}
+
+                        else if ( (LA61_58==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_58>=PACKAGE && LA61_58<=GLOBAL)||LA61_58==COMMA||(LA61_58>=DECLARE && LA61_58<=LEFT_SQUARE)||(LA61_58>=THEN && LA61_58<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_58==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_58);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 17 : 
+                        int LA61_63 = input.LA(1);
+
+                         
+                        int index61_63 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_63==RIGHT_SQUARE) ) {s = 100;}
+
+                        else if ( (LA61_63==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_63>=PACKAGE && LA61_63<=GLOBAL)||LA61_63==COMMA||(LA61_63>=DECLARE && LA61_63<=LEFT_SQUARE)||(LA61_63>=THEN && LA61_63<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_63==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_63);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 18 : 
+                        int LA61_11 = input.LA(1);
+
+                         
+                        int index61_11 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_11==LEFT_PAREN) ) {s = 31;}
+
+                        else if ( (LA61_11==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_11>=PACKAGE && LA61_11<=GLOBAL)||LA61_11==COMMA||(LA61_11>=DECLARE && LA61_11<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_11);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 19 : 
+                        int LA61_32 = input.LA(1);
+
+                         
+                        int index61_32 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_32==ID) ) {s = 64;}
+
+                        else if ( (LA61_32==LEFT_PAREN) ) {s = 65;}
+
+                        else if ( (LA61_32==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_32>=PACKAGE && LA61_32<=FUNCTION)||(LA61_32>=DOT && LA61_32<=GLOBAL)||LA61_32==COMMA||(LA61_32>=DECLARE && LA61_32<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_32);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 20 : 
+                        int LA61_56 = input.LA(1);
+
+                         
+                        int index61_56 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_56==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_56==ID) ) {s = 93;}
+
+                        else if ( (LA61_56==LEFT_PAREN) ) {s = 94;}
+
+                        else if ( ((LA61_56>=PACKAGE && LA61_56<=FUNCTION)||(LA61_56>=DOT && LA61_56<=GLOBAL)||LA61_56==COMMA||(LA61_56>=DECLARE && LA61_56<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_56);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 21 : 
+                        int LA61_60 = input.LA(1);
+
+                         
+                        int index61_60 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_60==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_60==ID) ) {s = 97;}
+
+                        else if ( (LA61_60==LEFT_PAREN) ) {s = 98;}
+
+                        else if ( ((LA61_60>=PACKAGE && LA61_60<=FUNCTION)||(LA61_60>=DOT && LA61_60<=GLOBAL)||LA61_60==COMMA||(LA61_60>=DECLARE && LA61_60<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_60);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 22 : 
+                        int LA61_39 = input.LA(1);
+
+                         
+                        int index61_39 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_39);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 23 : 
+                        int LA61_31 = input.LA(1);
+
+                         
+                        int index61_31 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_31);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 24 : 
+                        int LA61_30 = input.LA(1);
+
+                         
+                        int index61_30 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_30);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 25 : 
+                        int LA61_47 = input.LA(1);
+
+                         
+                        int index61_47 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_47);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 26 : 
+                        int LA61_53 = input.LA(1);
+
+                         
+                        int index61_53 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_53>=PACKAGE && LA61_53<=ID)||LA61_53==GLOBAL||(LA61_53>=QUERY && LA61_53<=ATTRIBUTES)||LA61_53==ENABLED||LA61_53==SALIENCE||(LA61_53>=DURATION && LA61_53<=DIALECT)||LA61_53==FROM||(LA61_53>=INIT && LA61_53<=RESULT)||(LA61_53>=CONTAINS && LA61_53<=MEMBEROF)||LA61_53==IN||(LA61_53>=THEN && LA61_53<=EVENT)) ) {s = 91;}
+
+                        else if ( (LA61_53==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_53==DOT||LA61_53==COMMA||(LA61_53>=DECLARE && LA61_53<=STRING)||(LA61_53>=DATE_EFFECTIVE && LA61_53<=DATE_EXPIRES)||LA61_53==BOOL||(LA61_53>=INT && LA61_53<=AGENDA_GROUP)||(LA61_53>=LOCK_ON_ACTIVE && LA61_53<=DOUBLE_AMPER)||(LA61_53>=EXISTS && LA61_53<=ACCUMULATE)||(LA61_53>=TIMEWINDOW && LA61_53<=ENTRY_POINT)||LA61_53==TILDE||(LA61_53>=FLOAT && LA61_53<=RIGHT_SQUARE)||(LA61_53>=EOL && LA61_53<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_53==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_53);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 27 : 
+                        int LA61_44 = input.LA(1);
+
+                         
+                        int index61_44 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_44);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 28 : 
+                        int LA61_41 = input.LA(1);
+
+                         
+                        int index61_41 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_41);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 29 : 
+                        int LA61_40 = input.LA(1);
+
+                         
+                        int index61_40 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_40);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 30 : 
+                        int LA61_50 = input.LA(1);
+
+                         
+                        int index61_50 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_50);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 31 : 
+                        int LA61_21 = input.LA(1);
+
+                         
+                        int index61_21 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_21);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 32 : 
+                        int LA61_5 = input.LA(1);
+
+                         
+                        int index61_5 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_5==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_5==EXISTS) ) {s = 20;}
+
+                        else if ( (LA61_5==LEFT_PAREN) ) {s = 21;}
+
+                        else if ( (LA61_5==NOT) ) {s = 22;}
+
+                        else if ( (LA61_5==EVAL) ) {s = 23;}
+
+                        else if ( (LA61_5==FORALL) ) {s = 24;}
+
+                        else if ( (LA61_5==ID) ) {s = 25;}
+
+                        else if ( ((LA61_5>=PACKAGE && LA61_5<=FUNCTION)||(LA61_5>=DOT && LA61_5<=GLOBAL)||LA61_5==COMMA||(LA61_5>=DECLARE && LA61_5<=FROM)||(LA61_5>=ACCUMULATE && LA61_5<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_5);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 33 : 
+                        int LA61_35 = input.LA(1);
+
+                         
+                        int index61_35 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_35);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 34 : 
+                        int LA61_10 = input.LA(1);
+
+                         
+                        int index61_10 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_10==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_10>=PACKAGE && LA61_10<=GLOBAL)||LA61_10==COMMA||(LA61_10>=DECLARE && LA61_10<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_10==LEFT_PAREN) ) {s = 30;}
+
+                         
+                        input.seek(index61_10);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 35 : 
+                        int LA61_59 = input.LA(1);
+
+                         
+                        int index61_59 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_59);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 36 : 
+                        int LA61_62 = input.LA(1);
+
+                         
+                        int index61_62 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_62);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 37 : 
+                        int LA61_64 = input.LA(1);
+
+                         
+                        int index61_64 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_64==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_64==DOT) ) {s = 101;}
+
+                        else if ( (LA61_64==LEFT_PAREN) ) {s = 102;}
+
+                        else if ( (LA61_64==LEFT_SQUARE) ) {s = 103;}
+
+                        else if ( ((LA61_64>=PACKAGE && LA61_64<=ID)||LA61_64==GLOBAL||LA61_64==COMMA||(LA61_64>=DECLARE && LA61_64<=NULL)||(LA61_64>=RIGHT_SQUARE && LA61_64<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_64);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 38 : 
+                        int LA61_33 = input.LA(1);
+
+                         
+                        int index61_33 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_33>=PACKAGE && LA61_33<=ID)||LA61_33==GLOBAL||(LA61_33>=QUERY && LA61_33<=ATTRIBUTES)||LA61_33==ENABLED||LA61_33==SALIENCE||(LA61_33>=DURATION && LA61_33<=DIALECT)||LA61_33==FROM||(LA61_33>=INIT && LA61_33<=RESULT)||(LA61_33>=CONTAINS && LA61_33<=MEMBEROF)||LA61_33==IN||(LA61_33>=THEN && LA61_33<=EVENT)) ) {s = 66;}
+
+                        else if ( (LA61_33==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_33==DOT||LA61_33==COMMA||(LA61_33>=DECLARE && LA61_33<=STRING)||(LA61_33>=DATE_EFFECTIVE && LA61_33<=DATE_EXPIRES)||LA61_33==BOOL||(LA61_33>=INT && LA61_33<=AGENDA_GROUP)||(LA61_33>=LOCK_ON_ACTIVE && LA61_33<=DOUBLE_AMPER)||(LA61_33>=EXISTS && LA61_33<=ACCUMULATE)||(LA61_33>=TIMEWINDOW && LA61_33<=ENTRY_POINT)||LA61_33==TILDE||(LA61_33>=FLOAT && LA61_33<=RIGHT_SQUARE)||(LA61_33>=EOL && LA61_33<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_33==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_33);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 39 : 
+                        int LA61_57 = input.LA(1);
+
+                         
+                        int index61_57 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_57>=PACKAGE && LA61_57<=ID)||LA61_57==GLOBAL||(LA61_57>=QUERY && LA61_57<=ATTRIBUTES)||LA61_57==ENABLED||LA61_57==SALIENCE||(LA61_57>=DURATION && LA61_57<=DIALECT)||LA61_57==FROM||(LA61_57>=INIT && LA61_57<=RESULT)||(LA61_57>=CONTAINS && LA61_57<=MEMBEROF)||LA61_57==IN||(LA61_57>=THEN && LA61_57<=EVENT)) ) {s = 95;}
+
+                        else if ( (LA61_57==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_57==DOT||LA61_57==COMMA||(LA61_57>=DECLARE && LA61_57<=STRING)||(LA61_57>=DATE_EFFECTIVE && LA61_57<=DATE_EXPIRES)||LA61_57==BOOL||(LA61_57>=INT && LA61_57<=AGENDA_GROUP)||(LA61_57>=LOCK_ON_ACTIVE && LA61_57<=DOUBLE_AMPER)||(LA61_57>=EXISTS && LA61_57<=ACCUMULATE)||(LA61_57>=TIMEWINDOW && LA61_57<=ENTRY_POINT)||LA61_57==TILDE||(LA61_57>=FLOAT && LA61_57<=RIGHT_SQUARE)||(LA61_57>=EOL && LA61_57<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_57==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_57);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 40 : 
+                        int LA61_61 = input.LA(1);
+
+                         
+                        int index61_61 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_61==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_61>=PACKAGE && LA61_61<=ID)||LA61_61==GLOBAL||(LA61_61>=QUERY && LA61_61<=ATTRIBUTES)||LA61_61==ENABLED||LA61_61==SALIENCE||(LA61_61>=DURATION && LA61_61<=DIALECT)||LA61_61==FROM||(LA61_61>=INIT && LA61_61<=RESULT)||(LA61_61>=CONTAINS && LA61_61<=MEMBEROF)||LA61_61==IN||(LA61_61>=THEN && LA61_61<=EVENT)) ) {s = 99;}
+
+                        else if ( (LA61_61==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                        else if ( (LA61_61==DOT||LA61_61==COMMA||(LA61_61>=DECLARE && LA61_61<=STRING)||(LA61_61>=DATE_EFFECTIVE && LA61_61<=DATE_EXPIRES)||LA61_61==BOOL||(LA61_61>=INT && LA61_61<=AGENDA_GROUP)||(LA61_61>=LOCK_ON_ACTIVE && LA61_61<=DOUBLE_AMPER)||(LA61_61>=EXISTS && LA61_61<=ACCUMULATE)||(LA61_61>=TIMEWINDOW && LA61_61<=ENTRY_POINT)||LA61_61==TILDE||(LA61_61>=FLOAT && LA61_61<=RIGHT_SQUARE)||(LA61_61>=EOL && LA61_61<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_61);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 41 : 
+                        int LA61_66 = input.LA(1);
+
+                         
+                        int index61_66 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_66==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_66==LEFT_SQUARE) ) {s = 34;}
+
+                        else if ( (LA61_66==LEFT_PAREN) ) {s = 35;}
+
+                        else if ( (LA61_66==DOT) ) {s = 33;}
+
+                        else if ( ((LA61_66>=PACKAGE && LA61_66<=ID)||LA61_66==GLOBAL||LA61_66==COMMA||(LA61_66>=DECLARE && LA61_66<=NULL)||(LA61_66>=RIGHT_SQUARE && LA61_66<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_66);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 42 : 
+                        int LA61_43 = input.LA(1);
+
+                         
+                        int index61_43 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( ((LA61_43>=PACKAGE && LA61_43<=ID)||LA61_43==GLOBAL||(LA61_43>=QUERY && LA61_43<=ATTRIBUTES)||LA61_43==ENABLED||LA61_43==SALIENCE||(LA61_43>=DURATION && LA61_43<=DIALECT)||LA61_43==FROM||(LA61_43>=INIT && LA61_43<=RESULT)||(LA61_43>=CONTAINS && LA61_43<=MEMBEROF)||LA61_43==IN||(LA61_43>=THEN && LA61_43<=EVENT)) ) {s = 79;}
+
+                        else if ( (LA61_43==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_43==DOT||LA61_43==COMMA||(LA61_43>=DECLARE && LA61_43<=STRING)||(LA61_43>=DATE_EFFECTIVE && LA61_43<=DATE_EXPIRES)||LA61_43==BOOL||(LA61_43>=INT && LA61_43<=AGENDA_GROUP)||(LA61_43>=LOCK_ON_ACTIVE && LA61_43<=DOUBLE_AMPER)||(LA61_43>=EXISTS && LA61_43<=ACCUMULATE)||(LA61_43>=TIMEWINDOW && LA61_43<=ENTRY_POINT)||LA61_43==TILDE||(LA61_43>=FLOAT && LA61_43<=RIGHT_SQUARE)||(LA61_43>=EOL && LA61_43<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_43==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_43);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 43 : 
+                        int LA61_45 = input.LA(1);
+
+                         
+                        int index61_45 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_45==RIGHT_SQUARE) ) {s = 80;}
+
+                        else if ( (LA61_45==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_45>=PACKAGE && LA61_45<=GLOBAL)||LA61_45==COMMA||(LA61_45>=DECLARE && LA61_45<=LEFT_SQUARE)||(LA61_45>=THEN && LA61_45<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_45==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_45);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 44 : 
+                        int LA61_18 = input.LA(1);
+
+                         
+                        int index61_18 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_18==LEFT_PAREN) ) {s = 41;}
+
+                        else if ( (LA61_18==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_18>=PACKAGE && LA61_18<=GLOBAL)||LA61_18==COMMA||(LA61_18>=DECLARE && LA61_18<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_18);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 45 : 
+                        int LA61_28 = input.LA(1);
+
+                         
+                        int index61_28 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_28);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 46 : 
+                        int LA61_15 = input.LA(1);
+
+                         
+                        int index61_15 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_15);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 47 : 
+                        int LA61_17 = input.LA(1);
+
+                         
+                        int index61_17 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_17==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_17>=PACKAGE && LA61_17<=GLOBAL)||LA61_17==COMMA||(LA61_17>=DECLARE && LA61_17<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_17==LEFT_PAREN) ) {s = 40;}
+
+                         
+                        input.seek(index61_17);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 48 : 
+                        int LA61_27 = input.LA(1);
+
+                         
+                        int index61_27 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 13;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_27);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 49 : 
+                        int LA61_38 = input.LA(1);
+
+                         
+                        int index61_38 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_38==79) ) {s = 73;}
+
+                        else if ( (LA61_38==DOT) ) {s = 74;}
+
+                        else if ( (LA61_38==LEFT_SQUARE) ) {s = 75;}
+
+                        else if ( (LA61_38==LEFT_PAREN) ) {s = 76;}
+
+                        else if ( (LA61_38==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_38>=PACKAGE && LA61_38<=ID)||LA61_38==GLOBAL||LA61_38==COMMA||(LA61_38>=DECLARE && LA61_38<=NULL)||(LA61_38>=RIGHT_SQUARE && LA61_38<=78)||(LA61_38>=80 && LA61_38<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_38);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 50 : 
+                        int LA61_36 = input.LA(1);
+
+                         
+                        int index61_36 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_36==79) ) {s = 69;}
+
+                        else if ( (LA61_36==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_36==DOT) ) {s = 70;}
+
+                        else if ( (LA61_36==LEFT_PAREN) ) {s = 71;}
+
+                        else if ( (LA61_36==LEFT_SQUARE) ) {s = 72;}
+
+                        else if ( ((LA61_36>=PACKAGE && LA61_36<=ID)||LA61_36==GLOBAL||LA61_36==COMMA||(LA61_36>=DECLARE && LA61_36<=NULL)||(LA61_36>=RIGHT_SQUARE && LA61_36<=78)||(LA61_36>=80 && LA61_36<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_36);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 51 : 
+                        int LA61_19 = input.LA(1);
+
+                         
+                        int index61_19 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_19==79) ) {s = 42;}
+
+                        else if ( (LA61_19==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_19==DOT) ) {s = 43;}
+
+                        else if ( (LA61_19==LEFT_PAREN) ) {s = 44;}
+
+                        else if ( (LA61_19==LEFT_SQUARE) ) {s = 45;}
+
+                        else if ( ((LA61_19>=PACKAGE && LA61_19<=ID)||LA61_19==GLOBAL||LA61_19==COMMA||(LA61_19>=DECLARE && LA61_19<=NULL)||(LA61_19>=RIGHT_SQUARE && LA61_19<=78)||(LA61_19>=80 && LA61_19<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_19);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 52 : 
+                        int LA61_55 = input.LA(1);
+
+                         
+                        int index61_55 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_55==RIGHT_SQUARE) ) {s = 92;}
+
+                        else if ( (LA61_55==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_55>=PACKAGE && LA61_55<=GLOBAL)||LA61_55==COMMA||(LA61_55>=DECLARE && LA61_55<=LEFT_SQUARE)||(LA61_55>=THEN && LA61_55<=86)) && (synpred11())) {s = 13;}
+
+                        else if ( (LA61_55==LEFT_PAREN) && (synpred11())) {s = 67;}
+
+                         
+                        input.seek(index61_55);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 53 : 
+                        int LA61_65 = input.LA(1);
+
+                         
+                        int index61_65 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (synpred11()) ) {s = 67;}
+
+                        else if ( (true) ) {s = 3;}
+
+                         
+                        input.seek(index61_65);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 54 : 
+                        int LA61_4 = input.LA(1);
+
+                         
+                        int index61_4 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_4==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_4==EXISTS) ) {s = 14;}
+
+                        else if ( (LA61_4==LEFT_PAREN) ) {s = 15;}
+
+                        else if ( (LA61_4==NOT) ) {s = 16;}
+
+                        else if ( (LA61_4==EVAL) ) {s = 17;}
+
+                        else if ( (LA61_4==FORALL) ) {s = 18;}
+
+                        else if ( (LA61_4==ID) ) {s = 19;}
+
+                        else if ( ((LA61_4>=PACKAGE && LA61_4<=FUNCTION)||(LA61_4>=DOT && LA61_4<=GLOBAL)||LA61_4==COMMA||(LA61_4>=DECLARE && LA61_4<=FROM)||(LA61_4>=ACCUMULATE && LA61_4<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_4);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 55 : 
+                        int LA61_24 = input.LA(1);
+
+                         
+                        int index61_24 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_24==LEFT_PAREN) ) {s = 51;}
+
+                        else if ( (LA61_24==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_24>=PACKAGE && LA61_24<=GLOBAL)||LA61_24==COMMA||(LA61_24>=DECLARE && LA61_24<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_24);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 56 : 
+                        int LA61_42 = input.LA(1);
+
+                         
+                        int index61_42 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_42==ID) ) {s = 77;}
+
+                        else if ( (LA61_42==LEFT_PAREN) ) {s = 78;}
+
+                        else if ( (LA61_42==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_42>=PACKAGE && LA61_42<=FUNCTION)||(LA61_42>=DOT && LA61_42<=GLOBAL)||LA61_42==COMMA||(LA61_42>=DECLARE && LA61_42<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_42);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 57 : 
+                        int LA61_14 = input.LA(1);
+
+                         
+                        int index61_14 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_14==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_14==ID) ) {s = 36;}
+
+                        else if ( (LA61_14==LEFT_PAREN) ) {s = 37;}
+
+                        else if ( ((LA61_14>=PACKAGE && LA61_14<=FUNCTION)||(LA61_14>=DOT && LA61_14<=GLOBAL)||LA61_14==COMMA||(LA61_14>=DECLARE && LA61_14<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_14);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 58 : 
+                        int LA61_20 = input.LA(1);
+
+                         
+                        int index61_20 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_20==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_20==ID) ) {s = 46;}
+
+                        else if ( (LA61_20==LEFT_PAREN) ) {s = 47;}
+
+                        else if ( ((LA61_20>=PACKAGE && LA61_20<=FUNCTION)||(LA61_20>=DOT && LA61_20<=GLOBAL)||LA61_20==COMMA||(LA61_20>=DECLARE && LA61_20<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_20);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 59 : 
+                        int LA61_52 = input.LA(1);
+
+                         
+                        int index61_52 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_52==ID) ) {s = 89;}
+
+                        else if ( (LA61_52==LEFT_PAREN) ) {s = 90;}
+
+                        else if ( (LA61_52==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_52>=PACKAGE && LA61_52<=FUNCTION)||(LA61_52>=DOT && LA61_52<=GLOBAL)||LA61_52==COMMA||(LA61_52>=DECLARE && LA61_52<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_52);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 60 : 
+                        int LA61_46 = input.LA(1);
+
+                         
+                        int index61_46 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_46==79) ) {s = 81;}
+
+                        else if ( (LA61_46==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_46==DOT) ) {s = 82;}
+
+                        else if ( (LA61_46==LEFT_PAREN) ) {s = 83;}
+
+                        else if ( (LA61_46==LEFT_SQUARE) ) {s = 84;}
+
+                        else if ( ((LA61_46>=PACKAGE && LA61_46<=ID)||LA61_46==GLOBAL||LA61_46==COMMA||(LA61_46>=DECLARE && LA61_46<=NULL)||(LA61_46>=RIGHT_SQUARE && LA61_46<=78)||(LA61_46>=80 && LA61_46<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_46);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 61 : 
+                        int LA61_25 = input.LA(1);
+
+                         
+                        int index61_25 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_25==79) ) {s = 52;}
+
+                        else if ( (LA61_25==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( (LA61_25==DOT) ) {s = 53;}
+
+                        else if ( (LA61_25==LEFT_PAREN) ) {s = 54;}
+
+                        else if ( (LA61_25==LEFT_SQUARE) ) {s = 55;}
+
+                        else if ( ((LA61_25>=PACKAGE && LA61_25<=ID)||LA61_25==GLOBAL||LA61_25==COMMA||(LA61_25>=DECLARE && LA61_25<=NULL)||(LA61_25>=RIGHT_SQUARE && LA61_25<=78)||(LA61_25>=80 && LA61_25<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_25);
+                        if ( s>=0 ) return s;
+                        break;
+                    case 62 : 
+                        int LA61_49 = input.LA(1);
+
+                         
+                        int index61_49 = input.index();
+                        input.rewind();
+                        s = -1;
+                        if ( (LA61_49==79) ) {s = 85;}
+
+                        else if ( (LA61_49==DOT) ) {s = 86;}
+
+                        else if ( (LA61_49==LEFT_SQUARE) ) {s = 87;}
+
+                        else if ( (LA61_49==LEFT_PAREN) ) {s = 88;}
+
+                        else if ( (LA61_49==RIGHT_PAREN) && (synpred11())) {s = 8;}
+
+                        else if ( ((LA61_49>=PACKAGE && LA61_49<=ID)||LA61_49==GLOBAL||LA61_49==COMMA||(LA61_49>=DECLARE && LA61_49<=NULL)||(LA61_49>=RIGHT_SQUARE && LA61_49<=78)||(LA61_49>=80 && LA61_49<=86)) && (synpred11())) {s = 13;}
+
+                         
+                        input.seek(index61_49);
+                        if ( s>=0 ) return s;
+                        break;
+            }
+            if (backtracking>0) {failed=true; return -1;}
+            NoViableAltException nvae =
+                new NoViableAltException(getDescription(), 61, _s, input);
+            error(nvae);
+            throw nvae;
+        }
+    }
+    static final String DFA73_eotS =
+        "\23\uffff";
+    static final String DFA73_eofS =
+        "\23\uffff";
+    static final String DFA73_minS =
+        "\1\13\1\uffff\1\4\1\10\1\uffff\2\4\14\0";
+    static final String DFA73_maxS =
+        "\1\50\1\uffff\2\126\1\uffff\2\126\14\0";
+    static final String DFA73_acceptS =
+        "\1\uffff\1\2\2\uffff\1\1\16\uffff";
+    static final String DFA73_specialS =
+        "\23\uffff}>";
+    static final String[] DFA73_transitionS = {
+            "\2\1\31\uffff\1\2\1\uffff\1\1",
+            "",
+            "\4\1\1\uffff\1\1\1\12\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\5\1\6\1\7\1\10\1\11\1\4\1\3\4\uffff\2\1\16\uffff\6\4",
+            "\1\1\1\uffff\1\13\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "",
+            "\4\4\1\1\1\4\1\15\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\16\1\17\1\20\1\21\1\22"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\15\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\16\1\17\1\20\1\21\1\22"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA73_eot = DFA.unpackEncodedString(DFA73_eotS);
+    static final short[] DFA73_eof = DFA.unpackEncodedString(DFA73_eofS);
+    static final char[] DFA73_min = DFA.unpackEncodedStringToUnsignedChars(DFA73_minS);
+    static final char[] DFA73_max = DFA.unpackEncodedStringToUnsignedChars(DFA73_maxS);
+    static final short[] DFA73_accept = DFA.unpackEncodedString(DFA73_acceptS);
+    static final short[] DFA73_special = DFA.unpackEncodedString(DFA73_specialS);
+    static final short[][] DFA73_transition;
+
+    static {
+        int numStates = DFA73_transitionS.length;
+        DFA73_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA73_transition[i] = DFA.unpackEncodedString(DFA73_transitionS[i]);
+        }
+    }
+
+    class DFA73 extends DFA {
+
+        public DFA73(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 73;
+            this.eot = DFA73_eot;
+            this.eof = DFA73_eof;
+            this.min = DFA73_min;
+            this.max = DFA73_max;
+            this.accept = DFA73_accept;
+            this.special = DFA73_special;
+            this.transition = DFA73_transition;
+        }
+        public String getDescription() {
+            return "()* loopback of 1523:3: ( options {backtrack=true; } : DOUBLE_PIPE and_restr_connective[or] )*";
+        }
+    }
+    static final String DFA74_eotS =
+        "\70\uffff";
+    static final String DFA74_eofS =
+        "\1\1\13\uffff\6\4\46\uffff";
+    static final String DFA74_minS =
+        "\1\13\1\uffff\1\4\1\10\1\uffff\7\4\1\10\6\4\1\10\2\4\42\0";
+    static final String DFA74_maxS =
+        "\1\50\1\uffff\2\126\1\uffff\7\126\1\77\5\102\4\126\42\0";
+    static final String DFA74_acceptS =
+        "\1\uffff\1\2\2\uffff\1\1\63\uffff";
+    static final String DFA74_specialS =
+        "\70\uffff}>";
+    static final String[] DFA74_transitionS = {
+            "\2\1\31\uffff\1\1\1\uffff\1\2",
+            "",
+            "\4\1\1\uffff\1\1\1\12\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\5\1\6\1\7\1\10\1\11\1\4\1\3\4\uffff\2\1\16\uffff\6\4",
+            "\1\1\1\uffff\1\13\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\22\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\15\1\16\1\17\1\20\1\21"+
+            "\1\1\1\14\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\1\1\uffff\1\1\1\31\6\uffff\6\1\2\uffff\1\1\1\uffff\1\1\6"+
+            "\uffff\2\1\5\uffff\1\1\1\uffff\1\4\1\1\2\uffff\4\1\3\uffff\1"+
+            "\24\1\25\1\26\1\27\1\30\1\4\1\23\4\uffff\2\1\16\uffff\6\4",
+            "\4\4\1\uffff\1\4\1\33\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5"+
+            "\uffff\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\34\1\35\1\36\1"+
+            "\37\1\40\1\1\1\32\2\4\2\uffff\2\4\16\uffff\6\1",
+            "\1\4\1\uffff\1\1\2\4\31\uffff\1\4\1\uffff\1\4\26\uffff\1\4",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\4\1\1\4\2\1\2\4\3\uffff\7\1\2\uffff\4\1\5\uffff\2\1\2\uffff"+
+            "\1\4\1\uffff\1\4\1\1\5\uffff\4\1\3\uffff\5\1\1\uffff\3\1\1\4"+
+            "\1\uffff\2\1",
+            "\6\4\1\42\40\4\1\43\12\4\1\52\1\53\1\54\1\55\1\56\1\57\1\41"+
+            "\24\4\1\44\1\45\1\46\1\47\1\50\1\51",
+            "\1\1\1\uffff\1\60\40\uffff\1\1\12\uffff\7\1\2\uffff\1\1\21\uffff"+
+            "\6\1",
+            "\4\4\1\1\1\4\1\62\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\63\1\64\1\65\1\66\1\67"+
+            "\1\1\1\61\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\4\4\1\1\1\4\1\62\5\uffff\7\4\2\uffff\4\4\5\uffff\2\4\5\uffff"+
+            "\1\4\1\uffff\1\1\3\uffff\4\4\3\uffff\1\63\1\64\1\65\1\66\1\67"+
+            "\1\1\1\61\2\4\1\1\1\uffff\2\4\16\uffff\6\1",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff",
+            "\1\uffff"
+    };
+
+    static final short[] DFA74_eot = DFA.unpackEncodedString(DFA74_eotS);
+    static final short[] DFA74_eof = DFA.unpackEncodedString(DFA74_eofS);
+    static final char[] DFA74_min = DFA.unpackEncodedStringToUnsignedChars(DFA74_minS);
+    static final char[] DFA74_max = DFA.unpackEncodedStringToUnsignedChars(DFA74_maxS);
+    static final short[] DFA74_accept = DFA.unpackEncodedString(DFA74_acceptS);
+    static final short[] DFA74_special = DFA.unpackEncodedString(DFA74_specialS);
+    static final short[][] DFA74_transition;
+
+    static {
+        int numStates = DFA74_transitionS.length;
+        DFA74_transition = new short[numStates][];
+        for (int i=0; i<numStates; i++) {
+            DFA74_transition[i] = DFA.unpackEncodedString(DFA74_transitionS[i]);
+        }
+    }
+
+    class DFA74 extends DFA {
+
+        public DFA74(BaseRecognizer recognizer) {
+            this.recognizer = recognizer;
+            this.decisionNumber = 74;
+            this.eot = DFA74_eot;
+            this.eof = DFA74_eof;
+            this.min = DFA74_min;
+            this.max = DFA74_max;
+            this.accept = DFA74_accept;
+            this.special = DFA74_special;
+            this.transition = DFA74_transition;
+        }
+        public String getDescription() {
+            return "()* loopback of 1546:3: ( options {backtrack=true; } : t= DOUBLE_AMPER constraint_expression[and] )*";
+        }
+    }
+ 
+
+    public static final BitSet FOLLOW_77_in_opt_semicolon39 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_prolog_in_compilation_unit57 = new BitSet(new long[]{0x0000001FEB9A2260L});
+    public static final BitSet FOLLOW_statement_in_compilation_unit62 = new BitSet(new long[]{0x0000001FEB9A2260L});
+    public static final BitSet FOLLOW_EOF_in_compilation_unit67 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_package_statement_in_prolog96 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_attribute_in_statement121 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_import_statement_in_statement128 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_import_statement_in_statement134 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_global_in_statement140 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_in_statement146 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_template_in_statement160 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_in_statement169 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_query_in_statement181 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_type_declaration_in_statement196 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_PACKAGE_in_package_statement222 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_package_statement226 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_package_statement228 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IMPORT_in_import_statement259 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_import_name_in_import_statement282 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_import_statement285 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IMPORT_in_function_import_statement309 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_FUNCTION_in_function_import_statement311 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_import_name_in_function_import_statement334 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_function_import_statement337 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_import_name362 = new BitSet(new long[]{0x0000000000000102L,0x0000000000004000L});
+    public static final BitSet FOLLOW_DOT_in_import_name374 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_import_name378 = new BitSet(new long[]{0x0000000000000102L,0x0000000000004000L});
+    public static final BitSet FOLLOW_78_in_import_name402 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_GLOBAL_in_global436 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_global447 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_global458 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_global460 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FUNCTION_in_function485 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function489 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_function494 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_function503 = new BitSet(new long[]{0x17C7820C0A7E12F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function512 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_argument_in_function517 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_function531 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_dotted_name_in_function535 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_argument_in_function540 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_function564 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_curly_chunk_in_function570 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_argument597 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_argument603 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_argument605 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_DECLARE_in_type_declaration645 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_type_declaration649 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_LEFT_CURLY_in_type_declaration694 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_type_decl_attribute_in_type_declaration720 = new BitSet(new long[]{0x0000000000008800L});
+    public static final BitSet FOLLOW_COMMA_in_type_declaration725 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_type_decl_attribute_in_type_declaration727 = new BitSet(new long[]{0x0000000000008800L});
+    public static final BitSet FOLLOW_RIGHT_CURLY_in_type_declaration749 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_type_decl_attribute785 = new BitSet(new long[]{0x17C7820C0A7F02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_STRING_in_type_decl_attribute808 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_dotted_name_in_type_decl_attribute849 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_QUERY_in_query922 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_query926 = new BitSet(new long[]{0x00003C0000040480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_query936 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_qualified_id_in_query971 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_query976 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_query997 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_qualified_id_in_query1001 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_query1006 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_query1056 = new BitSet(new long[]{0x00003C0000040480L});
+    public static final BitSet FOLLOW_normal_lhs_block_in_query1085 = new BitSet(new long[]{0x0000000000040000L});
+    public static final BitSet FOLLOW_END_in_query1090 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_query1092 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_TEMPLATE_in_template1120 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_template1124 = new BitSet(new long[]{0x0000000000000080L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template1126 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_template_slot_in_template1141 = new BitSet(new long[]{0x0000000000040080L});
+    public static final BitSet FOLLOW_END_in_template1156 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template1158 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_qualified_id_in_template_slot1204 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_template_slot1220 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_template_slot1222 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_RULE_in_rule1253 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_rule1257 = new BitSet(new long[]{0x0000001FEBE00000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_rule_attributes_in_rule1266 = new BitSet(new long[]{0x0000000000200000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_WHEN_in_rule1278 = new BitSet(new long[]{0x00003C0000000480L,0x0000000000008002L});
+    public static final BitSet FOLLOW_79_in_rule1280 = new BitSet(new long[]{0x00003C0000000480L,0x0000000000000002L});
+    public static final BitSet FOLLOW_normal_lhs_block_in_rule1291 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000002L});
+    public static final BitSet FOLLOW_rhs_chunk_in_rule1301 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ATTRIBUTES_in_rule_attributes1321 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_rule_attributes1323 = new BitSet(new long[]{0x0000001FEB800000L});
+    public static final BitSet FOLLOW_rule_attribute_in_rule_attributes1331 = new BitSet(new long[]{0x0000001FEB800802L});
+    public static final BitSet FOLLOW_COMMA_in_rule_attributes1338 = new BitSet(new long[]{0x0000001FEB800000L});
+    public static final BitSet FOLLOW_rule_attribute_in_rule_attributes1343 = new BitSet(new long[]{0x0000001FEB800802L});
+    public static final BitSet FOLLOW_salience_in_rule_attribute1380 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_no_loop_in_rule_attribute1388 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_agenda_group_in_rule_attribute1397 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_duration_in_rule_attribute1406 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_activation_group_in_rule_attribute1415 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_auto_focus_in_rule_attribute1423 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_date_effective_in_rule_attribute1431 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_date_expires_in_rule_attribute1439 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_enabled_in_rule_attribute1447 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ruleflow_group_in_rule_attribute1455 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lock_on_active_in_rule_attribute1463 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_dialect_in_rule_attribute1470 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DATE_EFFECTIVE_in_date_effective1496 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_date_effective1498 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DATE_EXPIRES_in_date_expires1527 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_date_expires1529 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ENABLED_in_enabled1558 = new BitSet(new long[]{0x0000000004000000L});
+    public static final BitSet FOLLOW_BOOL_in_enabled1560 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_SALIENCE_in_salience1593 = new BitSet(new long[]{0x0000000010000400L});
+    public static final BitSet FOLLOW_INT_in_salience1604 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_salience1619 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NO_LOOP_in_no_loop1649 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_no_loop1662 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AUTO_FOCUS_in_auto_focus1697 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_auto_focus1710 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ACTIVATION_GROUP_in_activation_group1746 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_activation_group1748 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_RULEFLOW_GROUP_in_ruleflow_group1776 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_ruleflow_group1778 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AGENDA_GROUP_in_agenda_group1806 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_agenda_group1808 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DURATION_in_duration1836 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_INT_in_duration1838 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DIALECT_in_dialect1866 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_STRING_in_dialect1868 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LOCK_ON_ACTIVE_in_lock_on_active1900 = new BitSet(new long[]{0x0000000004000002L});
+    public static final BitSet FOLLOW_BOOL_in_lock_on_active1913 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_in_normal_lhs_block1952 = new BitSet(new long[]{0x00003C0000000482L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs1989 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_or2014 = new BitSet(new long[]{0x0000002000000000L});
+    public static final BitSet FOLLOW_OR_in_lhs_or2016 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2029 = new BitSet(new long[]{0x00003C0000001480L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_or2040 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2058 = new BitSet(new long[]{0x0000006000000002L});
+    public static final BitSet FOLLOW_set_in_lhs_or2066 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_and_in_lhs_or2082 = new BitSet(new long[]{0x0000006000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_and2113 = new BitSet(new long[]{0x0000008000000000L});
+    public static final BitSet FOLLOW_AND_in_lhs_and2115 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2127 = new BitSet(new long[]{0x00003C0000001480L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_and2137 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2155 = new BitSet(new long[]{0x0000018000000002L});
+    public static final BitSet FOLLOW_set_in_lhs_and2163 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_unary_in_lhs_and2179 = new BitSet(new long[]{0x0000018000000002L});
+    public static final BitSet FOLLOW_lhs_exist_in_lhs_unary2224 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_not_in_lhs_unary2242 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_eval_in_lhs_unary2261 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_lhs_forall_in_lhs_unary2280 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_unary2297 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_unary2301 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_unary2303 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_pattern_source_in_lhs_unary2314 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_lhs_unary2326 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_pattern_source2353 = new BitSet(new long[]{0x0000020000000002L});
+    public static final BitSet FOLLOW_FROM_in_pattern_source2404 = new BitSet(new long[]{0x0020000000000000L});
+    public static final BitSet FOLLOW_entrypoint_statement_in_pattern_source2408 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FROM_in_pattern_source2428 = new BitSet(new long[]{0x17DFC20C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accumulate_statement_in_pattern_source2486 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_timewindow_statement_in_pattern_source2509 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_collect_statement_in_pattern_source2533 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_from_statement_in_pattern_source2570 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EXISTS_in_lhs_exist2612 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_exist2632 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_exist2636 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_exist2666 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_exist2716 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NOT_in_lhs_not2768 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_not2781 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_lhs_not2785 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_not2816 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_not2853 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_lhs_eval2899 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_lhs_eval2910 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FORALL_in_lhs_forall2936 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lhs_forall2938 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_forall2942 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_lhs_pattern_in_lhs_forall2957 = new BitSet(new long[]{0x0000000000001080L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lhs_forall2973 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fact_binding_in_lhs_pattern3006 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_fact_in_lhs_pattern3014 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_from_source_in_from_statement3041 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ACCUMULATE_in_accumulate_statement3078 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_accumulate_statement3088 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_accumulate_statement3092 = new BitSet(new long[]{0x0000800000000880L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3094 = new BitSet(new long[]{0x0000800000000080L});
+    public static final BitSet FOLLOW_INIT_in_accumulate_statement3112 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3125 = new BitSet(new long[]{0x0001000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3127 = new BitSet(new long[]{0x0001000000000000L});
+    public static final BitSet FOLLOW_ACTION_in_accumulate_statement3138 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3142 = new BitSet(new long[]{0x0006000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3144 = new BitSet(new long[]{0x0006000000000000L});
+    public static final BitSet FOLLOW_REVERSE_in_accumulate_statement3157 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3161 = new BitSet(new long[]{0x0004000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_accumulate_statement3163 = new BitSet(new long[]{0x0004000000000000L});
+    public static final BitSet FOLLOW_RESULT_in_accumulate_statement3180 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3184 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_ID_in_accumulate_statement3210 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_accumulate_statement3214 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_accumulate_statement3231 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_TIMEWINDOW_in_timewindow_statement3269 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_timewindow_statement3279 = new BitSet(new long[]{0x00003C0000000480L});
+    public static final BitSet FOLLOW_lhs_or_in_timewindow_statement3283 = new BitSet(new long[]{0x0000000010000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3285 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_INT_in_timewindow_statement3295 = new BitSet(new long[]{0x0000800000000880L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3297 = new BitSet(new long[]{0x0000800000000080L});
+    public static final BitSet FOLLOW_INIT_in_timewindow_statement3313 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3326 = new BitSet(new long[]{0x0001000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3328 = new BitSet(new long[]{0x0001000000000000L});
+    public static final BitSet FOLLOW_ACTION_in_timewindow_statement3339 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3343 = new BitSet(new long[]{0x0006000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3345 = new BitSet(new long[]{0x0006000000000000L});
+    public static final BitSet FOLLOW_REVERSE_in_timewindow_statement3358 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3362 = new BitSet(new long[]{0x0004000000000800L});
+    public static final BitSet FOLLOW_COMMA_in_timewindow_statement3364 = new BitSet(new long[]{0x0004000000000000L});
+    public static final BitSet FOLLOW_RESULT_in_timewindow_statement3381 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3385 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_ID_in_timewindow_statement3410 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_paren_chunk_in_timewindow_statement3414 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_timewindow_statement3431 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_from_source3461 = new BitSet(new long[]{0x0000000000000502L});
+    public static final BitSet FOLLOW_paren_chunk_in_from_source3489 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_expression_chain_in_from_source3502 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOT_in_expression_chain3533 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_expression_chain3537 = new BitSet(new long[]{0x8000000000000502L});
+    public static final BitSet FOLLOW_square_chunk_in_expression_chain3568 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_paren_chunk_in_expression_chain3601 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_expression_chain_in_expression_chain3616 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_COLLECT_in_collect_statement3667 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_collect_statement3677 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_pattern_source_in_collect_statement3681 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_collect_statement3683 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ENTRY_POINT_in_entrypoint_statement3720 = new BitSet(new long[]{0x0000000000010080L});
+    public static final BitSet FOLLOW_name_in_entrypoint_statement3732 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_fact_binding3764 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_fact_binding3766 = new BitSet(new long[]{0x0000000000000480L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3780 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_fact_binding3796 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3800 = new BitSet(new long[]{0x0000006000001000L});
+    public static final BitSet FOLLOW_set_in_fact_binding3813 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_fact_in_fact_binding3825 = new BitSet(new long[]{0x0000006000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_fact_binding3843 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_qualified_id_in_fact3898 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_fact3908 = new BitSet(new long[]{0x17C7920C0A7E16F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_constraints_in_fact3920 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_fact3927 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EOF_in_fact3936 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_constraint_in_constraints3954 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_COMMA_in_constraints3961 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_constraint_in_constraints3970 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_or_constr_in_constraint4003 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_constr_in_or_constr4026 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_or_constr4034 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_and_constr_in_or_constr4043 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_unary_constr_in_and_constr4075 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_and_constr4083 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_unary_constr_in_and_constr4092 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_field_constraint_in_unary_constr4120 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_unary_constr4128 = new BitSet(new long[]{0x17C7920C0A7E06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_or_constr_in_unary_constr4130 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_unary_constr4133 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_unary_constr4139 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_predicate_in_unary_constr4141 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_field_constraint4180 = new BitSet(new long[]{0x0000000000000000L,0x0000000000008000L});
+    public static final BitSet FOLLOW_79_in_field_constraint4182 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accessor_path_in_field_constraint4201 = new BitSet(new long[]{0x1FC0080000000402L,0x00000000007F0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_field_constraint4215 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_80_in_field_constraint4230 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_predicate_in_field_constraint4232 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_accessor_path_in_field_constraint4258 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_field_constraint4267 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective4314 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_or_restr_connective4338 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective4349 = new BitSet(new long[]{0x0000004000000002L});
+    public static final BitSet FOLLOW_constraint_expression_in_and_restr_connective4381 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_and_restr_connective4401 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_constraint_expression_in_and_restr_connective4412 = new BitSet(new long[]{0x0000010000000002L});
+    public static final BitSet FOLLOW_compound_operator_in_constraint_expression4449 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_simple_operator_in_constraint_expression4456 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_constraint_expression4464 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_or_restr_connective_in_constraint_expression4473 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_constraint_expression4478 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_81_in_simple_operator4509 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_82_in_simple_operator4517 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_83_in_simple_operator4525 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_84_in_simple_operator4533 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_85_in_simple_operator4541 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_86_in_simple_operator4549 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_CONTAINS_in_simple_operator4577 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4605 = new BitSet(new long[]{0x0040000000000000L});
+    public static final BitSet FOLLOW_CONTAINS_in_simple_operator4609 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_EXCLUDES_in_simple_operator4637 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_MATCHES_in_simple_operator4665 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_SOUNDSLIKE_in_simple_operator4693 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4721 = new BitSet(new long[]{0x0100000000000000L});
+    public static final BitSet FOLLOW_MATCHES_in_simple_operator4725 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_MEMBEROF_in_simple_operator4753 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4781 = new BitSet(new long[]{0x0400000000000000L});
+    public static final BitSet FOLLOW_MEMBEROF_in_simple_operator4785 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_TILDE_in_simple_operator4791 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_simple_operator4795 = new BitSet(new long[]{0xF7C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_square_chunk_in_simple_operator4799 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_NOT_in_simple_operator4808 = new BitSet(new long[]{0x0800000000000000L});
+    public static final BitSet FOLLOW_TILDE_in_simple_operator4810 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_ID_in_simple_operator4814 = new BitSet(new long[]{0xF7C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_square_chunk_in_simple_operator4818 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_simple_operator4833 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_IN_in_compound_operator4863 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_NOT_in_compound_operator4875 = new BitSet(new long[]{0x1000000000000000L});
+    public static final BitSet FOLLOW_IN_in_compound_operator4877 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_compound_operator4892 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_compound_operator4896 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_COMMA_in_compound_operator4903 = new BitSet(new long[]{0x77C7820C1E7F06F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_expression_value_in_compound_operator4907 = new BitSet(new long[]{0x0000000000001800L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_compound_operator4916 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_accessor_path_in_expression_value4950 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_constraint_in_expression_value4970 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_expression_value4984 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_literal_constraint5027 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_literal_constraint5038 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_literal_constraint5051 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_literal_constraint5062 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_literal_constraint5074 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_paren_chunk_in_predicate5112 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_CURLY_in_curly_chunk5130 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_curly_chunk5134 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_curly_chunk_in_curly_chunk5143 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_CURLY_in_curly_chunk5148 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_paren_chunk5162 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_paren_chunk5166 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_paren_chunk_in_paren_chunk5175 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_paren_chunk5180 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_square_chunk5193 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_square_chunk5197 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_square_chunk_in_square_chunk5206 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_square_chunk5211 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_qualified_id5240 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_qualified_id5246 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_qualified_id5248 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_qualified_id5257 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_qualified_id5259 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_identifier_in_dotted_name5293 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_dotted_name5299 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_identifier_in_dotted_name5303 = new BitSet(new long[]{0x8000000000000102L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_dotted_name5312 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000001L});
+    public static final BitSet FOLLOW_RIGHT_SQUARE_in_dotted_name5314 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_accessor_element_in_accessor_path5348 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_DOT_in_accessor_path5354 = new BitSet(new long[]{0x17C7820C0A7E02F0L,0x0000000000000006L});
+    public static final BitSet FOLLOW_accessor_element_in_accessor_path5358 = new BitSet(new long[]{0x0000000000000102L});
+    public static final BitSet FOLLOW_identifier_in_accessor_element5396 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_square_chunk_in_accessor_element5403 = new BitSet(new long[]{0x8000000000000002L});
+    public static final BitSet FOLLOW_THEN_in_rhs_chunk5424 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_set_in_rhs_chunk5432 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x00000000007FFFFFL});
+    public static final BitSet FOLLOW_END_in_rhs_chunk5456 = new BitSet(new long[]{0x0000000000000002L,0x0000000000002000L});
+    public static final BitSet FOLLOW_opt_semicolon_in_rhs_chunk5458 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_name5492 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_name5500 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_set_in_identifier0 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EXISTS_in_synpred12216 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NOT_in_synpred22234 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EVAL_in_synpred32253 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FORALL_in_synpred42272 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_synpred52291 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FROM_in_synpred62397 = new BitSet(new long[]{0x0020000000000000L});
+    public static final BitSet FOLLOW_ENTRY_POINT_in_synpred62399 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_SQUARE_in_synpred103560 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_synpred113593 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOUBLE_PIPE_in_synpred124338 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_and_restr_connective_in_synpred124349 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_DOUBLE_AMPER_in_synpred134401 = new BitSet(new long[]{0x1FC0080000000400L,0x00000000007E0000L});
+    public static final BitSet FOLLOW_constraint_expression_in_synpred134412 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/dsl/rule1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/dsl/rule1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/dsl/rule1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package foo
+
+expander foo
+
+rule "new rule"
+	activation-group "boo"
+	when
+		line 1
+		line 2
+	then
+		line 3
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/lang/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+<body>
+	This contains the parser and utilities for the native DRL format, for handling DRL source.
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaFunction.mvel
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaFunction.mvel	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaFunction.mvel	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package @{package};
+
+ at foreach{imports as importEntry}
+import @{importEntry};
+ at end{}
+
+ at foreach{staticImports as importEntry}
+import static @{importEntry};
+ at end{}
+
+public class @{className} {
+    private static final long serialVersionUID  = 400L;
+        
+    public static @{returnType} @{methodName}(@foreach{parameterTypes, parameterNames as type, name}@{type} @{name}@end{","}) throws Exception {
+        @{text}
+    }      
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,367 @@
+getMethodBytecode() ::=<<
+    public java.util.List getMethodBytecode() {
+        org.drools.util.asm.MethodComparator.Tracer visit = new org.drools.util.asm.MethodComparator.Tracer("@{methodName}");
+
+
+        java.io.InputStream is = @{ruleClassName}.class.getClassLoader().getResourceAsStream( "@{package}.@{ruleClassName}".replace( '.', '/' ) + ".class" );
+                
+        java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
+        byte[] data = new byte[1024];
+        int byteCount;
+        try {
+            while ( (byteCount = is.read( data,
+                                 0,
+                                 1024 )) > -1 )
+            {                    
+                bos.write(data, 0, byteCount);
+            }
+        } catch ( java.io.IOException e ) {
+            throw new org.drools.RuntimeDroolsException("Unable getResourceAsStream for Class '@{ruleClassName}' ");
+        }               
+        
+        org.drools.asm.ClassReader classReader = new org.drools.asm.ClassReader( bos.toByteArray() );
+        classReader.accept( visit, true );
+        org.drools.asm.util.TraceMethodVisitor trace = visit.getTrace();
+        return trace.getText();     
+    }
+>>=::
+    
+
+equals() ::=<<
+    public boolean equals(Object object) {
+        if (object == null ) {
+            return false;
+        } else if ( object == this ){
+            return true;
+        }
+        
+        if ( ! (object instanceof org.drools.spi.CompiledInvoker) ) {
+            return false;
+        }
+        
+        org.drools.spi.CompiledInvoker other = ( org.drools.spi.CompiledInvoker ) object;
+        
+        return org.drools.util.asm.MethodComparator.compareBytecode( getMethodBytecode(), other.getMethodBytecode() );
+    }
+>>=::
+
+hashCode() ::=<<
+    public int hashCode() {
+        return @{hashCode};
+    }
+>>=::
+
+returnValueInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.ReturnValueExpression, org.drools.spi.CompiledInvoker
+{
+    private static final long serialVersionUID  = 400L;
+    
+    public org.drools.spi.FieldValue evaluate(java.lang.Object object,
+                            org.drools.spi.Tuple tuple,
+                            org.drools.rule.Declaration[] previousDeclarations, 
+                            org.drools.rule.Declaration[] localDeclarations, 
+                            org.drools.WorkingMemory workingMemory) throws Exception {                               
+
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) previousDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) tuple.get( previousDeclarations[@{i0}] ) ).getObject() );
+        @end{}                
+        @if{readLocalsFromTuple}
+          @foreach{localDeclarationTypes, localDeclarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) localDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) tuple.get( localDeclarations[@{i0}] ) ).getObject() );
+          @end{}
+        @else{}
+          @foreach{localDeclarationTypes, localDeclarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) localDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, object );
+          @end{}
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}
+        
+        return @{ruleClassName}.@{methodName}( 
+            @foreach{declarations as declr} @{declr.identifier} 
+            @end{","}  @if{localDeclarations != empty && declarations != empty}, at end{}       
+            @foreach{localDeclarations as declr} @{declr.identifier} 
+            @end{","}@if{globals != empty && (localDeclarations != empty || declarations != empty)}, at end{}
+            @foreach{globals as identifier}@{identifier}
+            @end{","} );
+    }    
+    
+    @includeByRef{hashCode(hashCode = hashCode)}
+    
+    @includeByRef{getMethodBytecode(package = package, ruleClassName = ruleClassName, methodName = methodName)}
+    
+    @includeByRef{equals()}       
+}     
+>>=::
+
+predicateInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.PredicateExpression, org.drools.spi.CompiledInvoker
+{
+    private static final long serialVersionUID  = 400L;
+    
+    public boolean evaluate(java.lang.Object object,
+                            org.drools.spi.Tuple tuple,
+                            org.drools.rule.Declaration[] previousDeclarations, 
+                            org.drools.rule.Declaration[] localDeclarations, 
+                            org.drools.WorkingMemory workingMemory) throws Exception {                               
+
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) previousDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) tuple.get( previousDeclarations[@{i0}] ) ).getObject() );
+        @end{}                
+        @foreach{localDeclarationTypes, localDeclarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) localDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, object );
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}
+        
+        return @{ruleClassName}.@{methodName}( 
+            @foreach{declarations as declr} @{declr.identifier} 
+            @end{","}  @if{localDeclarations != empty && declarations != empty}, at end{}       
+            @foreach{localDeclarations as declr} @{declr.identifier} 
+            @end{","}@if{globals != empty && (localDeclarations != empty || declarations != empty)}, at end{}
+            @foreach{globals as identifier}@{identifier}
+            @end{","} );
+    }    
+    
+    @includeByRef{hashCode(hashCode = hashCode)}
+    
+    @includeByRef{getMethodBytecode(package = package, ruleClassName = ruleClassName, methodName = methodName)}
+    
+    @includeByRef{equals()}       
+}     
+>>=::
+
+evalInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.EvalExpression, org.drools.spi.CompiledInvoker
+{
+    private static final long serialVersionUID  = 400L;
+    
+    public boolean evaluate(org.drools.spi.Tuple tuple,
+                            org.drools.rule.Declaration[] declarations, 
+                            org.drools.WorkingMemory workingMemory) throws Exception {                             
+
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) declarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) tuple.get( declarations[@{i0}] ) ).getObject() );
+        @end{}                
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}
+        
+        return @{ruleClassName}.@{methodName}( 
+            @foreach{declarations as declr} @{declr.identifier} 
+            @end{","} @if{globals != empty && declarations != empty}, at end{}
+            @foreach{globals as identifier}@{identifier}
+            @end{","} );
+    }    
+    
+    @includeByRef{hashCode(hashCode = hashCode)}
+    
+    @includeByRef{getMethodBytecode(package = package, ruleClassName = ruleClassName, methodName = methodName)}
+    
+    @includeByRef{equals()}       
+}     
+>>=::
+
+accumulateInvoker() ::=<<
+package @{package};
+
+import org.drools.asm.ClassReader;
+import org.drools.asm.util.TraceMethodVisitor;
+import org.drools.util.asm.MethodComparator.Tracer;
+import java.util.Collections;
+public class @{invokerClassName} implements org.drools.spi.Accumulator, org.drools.spi.CompiledInvoker
+{
+    private static final long serialVersionUID  = 400L;
+    
+    public Object createContext() {
+        return new @{ruleClassName}.@{className}();
+    }
+    
+    public void init(java.lang.Object workingMemoryContext,
+                     java.lang.Object context,
+                     org.drools.spi.Tuple leftTuple,
+                     org.drools.rule.Declaration[] declarations,
+                     org.drools.WorkingMemory workingMemory) throws Exception {
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) declarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( declarations[@{i0}] ) ).getObject() );
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}    
+        
+        ((@{ruleClassName}.@{className})context).init(
+            @foreach{declarations as declr} @{declr.identifier}@end{","}@if{globals != empty}, at end{}
+	        @foreach{globals as identifier} @{identifier}@end{","} );
+        
+    }
+
+    public void accumulate(java.lang.Object workingMemoryContext,
+                           java.lang.Object context,
+                           org.drools.spi.Tuple leftTuple,
+                           org.drools.common.InternalFactHandle handle,
+                           org.drools.rule.Declaration[] declarations,
+                           org.drools.rule.Declaration[] innerDeclarations,
+                           org.drools.WorkingMemory workingMemory) throws Exception {
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) declarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( declarations[@{i0}] ) ).getObject() );
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}    
+        @if{isMultiPattern}
+          @foreach{innerDeclarations as declr} @{declr.extractor.extractToClassName} @{declr.identifier} = (@{declr.extractor.extractToClassName}) innerDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( innerDeclarations[@{i0}] ) ).getObject() );
+          @end{}
+        @else{}
+          @foreach{innerDeclarations as declr} @{declr.extractor.extractToClassName} @{declr.identifier} = (@{declr.extractor.extractToClassName}) innerDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, handle.getObject() );
+          @end{}
+        @end{}
+        ((@{ruleClassName}.@{className})context).accumulate(
+            workingMemory,
+            innerDeclarations,
+            handle.getObject()@if{declarations != empty}, at end{} 
+            @foreach{declarations as declr} @{declr.identifier}@end{","}@if{globals != empty}, at end{}
+	        @foreach{globals as identifier} @{identifier}@end{","}@if{innerDeclarations != empty}, at end{}
+            @foreach{innerDeclarations as declr} @{declr.identifier}@end{","});
+    }
+
+    public void reverse(java.lang.Object workingMemoryContext,
+                           java.lang.Object context,
+                           org.drools.spi.Tuple leftTuple,
+                           org.drools.common.InternalFactHandle handle,
+                           org.drools.rule.Declaration[] declarations,
+                           org.drools.rule.Declaration[] innerDeclarations,
+                           org.drools.WorkingMemory workingMemory) throws Exception {
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) declarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( declarations[@{i0}] ) ).getObject() );
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}    
+        @if{isMultiPattern}
+          @foreach{innerDeclarations as declr} @{declr.extractor.extractToClassName} @{declr.identifier} = (@{declr.extractor.extractToClassName}) innerDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( innerDeclarations[@{i0}] ) ).getObject() );
+          @end{}
+        @else{}
+          @foreach{innerDeclarations as declr} @{declr.extractor.extractToClassName} @{declr.identifier} = (@{declr.extractor.extractToClassName}) innerDeclarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, handle.getObject() );
+          @end{}
+        @end{}
+        
+        ((@{ruleClassName}.@{className})context).reverse(
+            workingMemory,
+            innerDeclarations,
+            handle.getObject()@if{declarations != empty}, at end{} 
+            @foreach{declarations as declr} @{declr.identifier}@end{","}@if{globals != empty}, at end{}
+	        @foreach{globals as identifier} @{identifier}@end{","}@if{innerDeclarations != empty}, at end{}
+            @foreach{innerDeclarations as declr} @{declr.identifier}@end{","});
+    }
+
+    public Object getResult(java.lang.Object workingMemoryContext,
+                            java.lang.Object context,
+                            org.drools.spi.Tuple leftTuple,
+                            org.drools.rule.Declaration[] declarations,
+                            org.drools.WorkingMemory workingMemory) throws Exception {
+        @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} = ( @{type} ) declarations[@{i0}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, ( (org.drools.common.InternalFactHandle) leftTuple.get( declarations[@{i0}] ) ).getObject() );
+        @end{}
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+        @end{}    
+        
+        return ((@{ruleClassName}.@{className})context).getResult(
+            @foreach{declarations as declr} @{declr.identifier}@end{","}@if{globals != empty}, at end{}
+	        @foreach{globals as identifier} @{identifier}@end{","} );
+    }
+    
+    public boolean supportsReverse() {
+        return @{supportsReverse};
+    }
+
+    public Object createWorkingMemoryContext() {
+        return null;
+    }
+    
+    @includeByRef{hashCode(hashCode = hashCode)}
+    
+    @includeByRef{equals()}       
+
+    public java.util.List getMethodBytecode() {
+        java.io.InputStream is = @{ruleClassName}.class.getClassLoader().getResourceAsStream( "@{package}.@{ruleClassName}".replace( '.', '/' ) + "$@{className}" + ".class" );
+                
+        java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
+        byte[] data = new byte[1024];
+        int byteCount;
+        try {
+            while ( (byteCount = is.read( data,
+                                 0,
+                                 1024 )) > -1 )
+            {                    
+                bos.write(data, 0, byteCount);
+            }
+        } catch ( java.io.IOException e ) {
+            throw new org.drools.RuntimeDroolsException("Unable getResourceAsStream for Class '@{ruleClassName}$@{className}' ");
+        }               
+        return Collections.singletonList( bos );     
+    }
+}     
+>>=::
+
+consequenceInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.Consequence
+{
+    private static final long serialVersionUID  = 400L;
+
+    public void evaluate(org.drools.spi.KnowledgeHelper knowledgeHelper,
+                         org.drools.WorkingMemory workingMemory) throws Exception {    
+                       
+        org.drools.spi.Tuple tuple = knowledgeHelper.getTuple();
+        org.drools.rule.Rule rule = knowledgeHelper.getRule();
+        org.drools.rule.Declaration[] declarations = rule.getDeclarations();                                                  
+
+        @foreach{declarationTypes, declarations, indexes, notPatterns as type, declr, index, notPattern}
+          org.drools.common.InternalFactHandle @{declr.identifier}__Handle__ = ( org.drools.common.InternalFactHandle ) tuple.get( knowledgeHelper.getDeclaration( declarations[@{index}].getIdentifier() ) );        
+          @{type} @{declr.identifier} = ( @{type} )  declarations[@{index}].@{declr.nativeReadMethod.name}( (org.drools.common.InternalWorkingMemory) workingMemory, @{declr.identifier}__Handle__.getObject() );
+          @if{notPattern}@{declr.identifier}__Handle__ =  (org.drools.common.InternalFactHandle) knowledgeHelper.getWorkingMemory().getFactHandle( @{declr.identifier} );@end{}
+        @end{}
+        
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" ); 
+        @end{}    
+        
+        @{ruleClassName}.@{methodName} ( 
+            knowledgeHelper at if{declarations != empty}, at end{}
+            @foreach{declarations as declr} @{declr.identifier}, @{declr.identifier}__Handle__
+            @end{","}@if{globals != empty}, at end{}
+	        @foreach{globals as identifier} @{identifier}
+	        @end{","} );
+    }
+}     
+>>=::
+
+actionInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.Action
+{
+    private static final long serialVersionUID  = 400L;
+
+    public void execute(org.drools.WorkingMemory workingMemory) throws Exception {    
+                               
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" ); 
+        @end{}    
+        
+        @{processClassName}.@{methodName} ( 
+	        @foreach{globals as identifier} @{identifier}
+	        @end{","} );
+    }
+}     
+>>=::
+
+returnValueEvaluatorInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.ReturnValueEvaluator
+{
+    private static final long serialVersionUID  = 400L;
+
+    public Object evaluate(org.drools.WorkingMemory workingMemory) throws Exception {    
+                               
+        @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" ); 
+        @end{}    
+        
+        return @{processClassName}.@{methodName} ( 
+	        @foreach{globals as identifier} @{identifier}
+	        @end{","} );
+    }
+}     
+>>=::
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+returnValueMethod() ::=<<
+public static org.drools.spi.FieldValue @{methodName}(@foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} @end{","} @if{localDeclarations != empty && declarations != empty}, at end{}
+                                                      @foreach{localDeclarationTypes, localDeclarations as type, declr } @{type} @{declr.identifier} @end{","} @if{globals != empty && (localDeclarations != empty || declarations != empty)}, at end{}
+                                                      @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","} ) throws Exception {
+    return org.drools.base.FieldFactory.getFieldValue( @{text} );
+}
+>>=::
+
+predicateMethod() ::=<<
+public static boolean @{methodName}(@foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} @end{","} @if{localDeclarations != empty && declarations != empty}, at end{}
+                                                      @foreach{localDeclarationTypes, localDeclarations as type, declr } @{type} @{declr.identifier} @end{","} @if{globals != empty && (localDeclarations != empty || declarations != empty)}, at end{}
+                                                      @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","} ) throws Exception {
+    return ( @{text} );
+}
+>>=::
+
+evalMethod() ::=<<
+public static boolean @{methodName}(@foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier} @end{","} @if{globals != empty && declarations != empty}, at end{}
+                                    @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","} ) throws Exception {
+    return ( @{text} );
+}
+>>=::
+
+accumulateInnerClass() ::=<<
+public static class @{className} {
+
+    @foreach{attributesTypes, attributes as type, attr} private @{type} @{attr};
+    @end{}    
+    
+    public @{className}() {
+    }
+
+    public void init(@foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier}@end{","}@if{globals != empty && declarations != empty}, at end{} 
+                     @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","}
+                     ) throws Exception {
+        @{initCode}
+    }
+    
+    public void accumulate(org.drools.WorkingMemory workingMemory,
+                           org.drools.rule.Declaration[] innerDeclarations, 
+                           Object object @if{declarations != empty}, @end{}
+                           @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier}@end{","}@if{globals != empty}, at end{} 
+                           @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","}@if{innerDeclarations != empty}, at end{}
+                           @foreach{innerDeclarations as declr}@{declr.extractor.extractToClassName} @{declr.identifier}@end{","}
+                           ) throws Exception {
+        @{actionCode}
+    }
+    
+    public void reverse(org.drools.WorkingMemory workingMemory,
+                           org.drools.rule.Declaration[] innerDeclarations, 
+                           Object object @if{declarations != empty}, @end{}
+                           @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier}@end{","}@if{globals != empty}, at end{} 
+                           @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","}@if{innerDeclarations != empty}, at end{}
+                           @foreach{innerDeclarations as declr}@{declr.extractor.extractToClassName} @{declr.identifier}@end{","}
+                           ) throws Exception {
+        @{reverseCode}
+    }
+    
+    public Object getResult(@foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier}@end{","}@if{globals != empty && declarations != empty}, at end{} 
+                            @foreach{globalTypes, globals as type, identifier}@{type} @{identifier} @end{","}
+                           ) throws Exception {
+        return ( @{resultCode} );
+    }
+    
+    public boolean supportsReverse() {
+        return @{supportsReverse};
+    }
+}
+>>=::
+
+consequenceMethod() ::=<<
+public static void @{methodName}(org.drools.spi.KnowledgeHelper drools at if{declarations != empty}, at end{} @foreach{declarationTypes, declarations as type, declr} @{type} @{declr.identifier}, org.drools.FactHandle @{declr.identifier}__Handle__ @end{","}@if{globals != empty}, at end{} @foreach{globalTypes, globals as type, identifier}  @{type} @{identifier} @end{","} ) throws Exception {
+    @{text}
+}
+>>=::
+
+actionMethod() ::=<<
+public static void @{methodName}(@foreach{globalTypes, globals as type, identifier}  @{type} @{identifier} @end{","} ) throws Exception {
+    @{text}
+}
+>>=::
+
+returnValueEvaluatorMethod() ::=<<
+public static Object @{methodName}(@foreach{globalTypes, globals as type, identifier}  @{type} @{identifier} @end{","} ) throws Exception {
+    @{text}
+}
+>>=::
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.lexer.g
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.lexer.g	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.lexer.g	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,382 @@
+lexer grammar JavaParserLexer;
+ at members {
+	public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
+}
+ at header {
+	package org.drools.semantics.java.parser;
+}
+
+T68 : 'void' ;
+T69 : 'boolean' ;
+T70 : 'byte' ;
+T71 : 'char' ;
+T72 : 'short' ;
+T73 : 'int' ;
+T74 : 'float' ;
+T75 : 'long' ;
+T76 : 'double' ;
+T77 : 'private' ;
+T78 : 'public' ;
+T79 : 'protected' ;
+T80 : 'static' ;
+T81 : 'transient' ;
+T82 : 'final' ;
+T83 : 'abstract' ;
+T84 : 'native' ;
+T85 : 'threadsafe' ;
+T86 : 'synchronized' ;
+T87 : 'volatile' ;
+T88 : 'strictfp' ;
+T89 : 'class' ;
+T90 : 'extends' ;
+T91 : 'interface' ;
+T92 : 'implements' ;
+T93 : 'this' ;
+T94 : 'super' ;
+T95 : 'throws' ;
+T96 : 'if' ;
+T97 : 'else' ;
+T98 : 'for' ;
+T99 : 'while' ;
+T100 : 'do' ;
+T101 : 'break' ;
+T102 : 'continue' ;
+T103 : 'return' ;
+T104 : 'switch' ;
+T105 : 'throw' ;
+T106 : 'case' ;
+T107 : 'default' ;
+T108 : 'try' ;
+T109 : 'finally' ;
+T110 : 'catch' ;
+T111 : 'instanceof' ;
+T112 : 'true' ;
+T113 : 'false' ;
+T114 : 'null' ;
+T115 : 'new' ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 914
+QUESTION		:	'?'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 917
+LPAREN			:	'('		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 920
+RPAREN			:	')'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 923
+LBRACK			:	'['		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 926
+RBRACK			:	']'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 929
+LCURLY			:	'{'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 932
+RCURLY			:	'}'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 935
+COLON			:	':'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 938
+COMMA			:	','		;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 940
+DOT				:	'.'		;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 942
+ASSIGN			:	'='		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 945
+EQUAL			:	'=='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 948
+LNOT			:	'!'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 951
+BNOT			:	'~'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 954
+NOT_EQUAL		:	'!='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 957
+DIV				:	'/'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 960
+DIV_ASSIGN		:	'/='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 963
+PLUS			:	'+'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 966
+PLUS_ASSIGN		:	'+='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 969
+INC				:	'++'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 972
+MINUS			:	'-'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 975
+MINUS_ASSIGN	:	'-='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 978
+DEC				:	'--'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 981
+STAR			:	'*'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 984
+STAR_ASSIGN		:	'*='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 987
+MOD				:	'%'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 990
+MOD_ASSIGN		:	'%='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 993
+SR				:	'>>'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 996
+SR_ASSIGN		:	'>>='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 999
+BSR				:	'>>>'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1002
+BSR_ASSIGN		:	'>>>='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1005
+GE				:	'>='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1008
+GT				:	'>'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1011
+SL				:	'<<'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1014
+SL_ASSIGN		:	'<<='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1017
+LE				:	'<='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1020
+LT				:	'<'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1023
+BXOR			:	'^'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1026
+BXOR_ASSIGN		:	'^='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1029
+BOR				:	'|'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1032
+BOR_ASSIGN		:	'|='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1035
+LOR				:	'||'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1038
+BAND			:	'&'		;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1041
+BAND_ASSIGN		:	'&='	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1044
+LAND			:	'&&'	;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1047
+SEMI			:	';'		;
+
+
+// Whitespace -- ignored
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1053
+WS	:	(	' '
+		|	'\t'
+		|	'\f'
+			// handle newlines
+		|	(	'\r\n'  // Evil DOS
+			|	'\r'    // Macintosh
+			|	'\n'    // Unix (the right way)
+			)
+		)+
+		{ channel=99; /*token = JavaParser.IGNORE_TOKEN;*/ }
+	;
+
+// Single-line comments
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1068
+SL_COMMENT
+	:	'//' (options {greedy=false;} : .)* ('\r')? '\n'
+		{channel=99; /*token = JavaParser.IGNORE_TOKEN;*/}
+	;
+
+// multiple-line comments
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1076
+ML_COMMENT
+	:	'/*'
+		( options {greedy=false;} : . )*
+		'*/'
+		{channel=99;/*token = JavaParser.IGNORE_TOKEN;*/}
+	;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1083
+IDENT
+	:	('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
+	;
+
+// From the java language spec
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1089
+NUM_INT
+    : DECIMAL_LITERAL 
+    | HEX_LITERAL
+    | OCTAL_LITERAL
+    ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1095
+fragment
+DECIMAL_LITERAL: '1'..'9' ('0'..'9')* ('l'|'L')? ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1098
+fragment
+HEX_LITERAL: '0' ('x'|'X') ('0'..'9'|'a'..'f'|'A'..'F')+ ('l'|'L')? ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1101
+fragment
+OCTAL_LITERAL: '0' ('0'..'7')* ('l'|'L')? ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1104
+NUM_FLOAT
+    :     DIGITS '.' (DIGITS)? (EXPONENT_PART)? (FLOAT_TYPE_SUFFIX)?
+    | '.' DIGITS (EXPONENT_PART)? (FLOAT_TYPE_SUFFIX)?
+    |     DIGITS EXPONENT_PART FLOAT_TYPE_SUFFIX
+    |     DIGITS EXPONENT_PART
+    |     DIGITS FLOAT_TYPE_SUFFIX
+    ;
+
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1113
+fragment
+DIGITS : ('0'..'9')+ ;
+
+/*
+fragment
+EXPONENT_PART: ('e'|'E') ('+'|'-')? DIGITS ;
+*/
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1121
+fragment
+EXPONENT_PART: ('e'|'E') ('+'|'-')? DIGITS ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1124
+fragment
+FLOAT_TYPE_SUFFIX :   ('f'|'F'|'d'|'D') ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1127
+CHAR_LITERAL
+    :
+      '\''
+      ( ~('\''|'\\')
+      | ESCAPE_SEQUENCE
+      )
+      '\''
+    ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1136
+STRING_LITERAL
+    :
+      '\"'
+      ( ~('\"'|'\\')
+      | ESCAPE_SEQUENCE
+      )*
+      '\"'
+        ;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1145
+fragment
+ESCAPE_SEQUENCE
+    :	'\\' 'b'
+    |   '\\' 't'
+    |   '\\' 'n'
+    |   '\\' 'f'
+    |   '\\' 'r'
+    |   '\\' '\"'
+    |   '\\' '\''
+    |   '\\' '\\'
+    |	'\\' '0'..'3' OCTAL_DIGIT OCTAL_DIGIT
+    |   '\\' OCTAL_DIGIT OCTAL_DIGIT
+    |   '\\' OCTAL_DIGIT
+	|	UNICODE_CHAR
+	;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1161
+fragment
+UNICODE_CHAR
+	:	'\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+	;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1166
+fragment
+HEX_DIGIT
+	:	'0'..'9'|'a'..'f'|'A'..'F'
+	;
+
+#src "/Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/semantics/java/parser/java.g" 1171
+fragment
+OCTAL_DIGIT
+	:	'0'..'7'
+	;

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.tokens
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.tokens	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParser.tokens	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,112 @@
+COMMA=12
+SR_ASSIGN=22
+MINUS=44
+LOR=29
+BNOT=49
+INC=47
+MOD=46
+OCTAL_LITERAL=60
+PLUS_ASSIGN=17
+QUESTION=28
+HEX_LITERAL=59
+BOR=31
+DOT=7
+SR=41
+FLOAT_TYPE_SUFFIX=63
+RCURLY=11
+LCURLY=9
+CHAR_LITERAL=52
+BOR_ASSIGN=27
+STRING_LITERAL=53
+ASSIGN=15
+LE=38
+RPAREN=14
+STAR_ASSIGN=19
+NUM_INT=51
+LPAREN=13
+HEX_DIGIT=67
+ML_COMMENT=57
+PLUS=43
+SL_COMMENT=56
+BAND=33
+MINUS_ASSIGN=18
+NOT_EQUAL=34
+BAND_ASSIGN=25
+DIGITS=61
+DECIMAL_LITERAL=58
+IDENT=6
+MOD_ASSIGN=21
+WS=55
+BXOR_ASSIGN=26
+LT=36
+BSR=42
+GT=37
+BSR_ASSIGN=23
+SL_ASSIGN=24
+LAND=30
+LBRACK=4
+NUM_FLOAT=54
+SEMI=10
+GE=39
+LNOT=50
+DIV_ASSIGN=20
+UNICODE_CHAR=66
+DEC=48
+EQUAL=35
+ESCAPE_SEQUENCE=64
+OCTAL_DIGIT=65
+RBRACK=5
+COLON=16
+SL=40
+DIV=45
+STAR=8
+BXOR=32
+EXPONENT_PART=62
+'finally'=109
+'break'=101
+'interface'=91
+'case'=106
+'try'=108
+'boolean'=69
+'else'=97
+'final'=82
+'synchronized'=86
+'true'=112
+'default'=107
+'false'=113
+'do'=100
+'int'=73
+'while'=99
+'this'=93
+'continue'=102
+'double'=76
+'long'=75
+'volatile'=87
+'private'=77
+'return'=103
+'instanceof'=111
+'super'=94
+'threadsafe'=85
+'strictfp'=88
+'static'=80
+'native'=84
+'implements'=92
+'throw'=105
+'protected'=79
+'if'=96
+'char'=71
+'void'=68
+'switch'=104
+'catch'=110
+'throws'=95
+'byte'=70
+'transient'=81
+'float'=74
+'new'=115
+'for'=98
+'extends'=90
+'short'=72
+'class'=89
+'null'=114
+'public'=78
+'abstract'=83

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParserLexer.tokens
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParserLexer.tokens	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/rule/builder/dialect/java/parser/JavaParserLexer.tokens	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,113 @@
+SR_ASSIGN=22
+COMMA=12
+MINUS=44
+T70=70
+T74=74
+T85=85
+BOR=31
+DOT=7
+SR=41
+T102=102
+LCURLY=9
+T114=114
+T103=103
+STRING_LITERAL=53
+LE=38
+T81=81
+RPAREN=14
+STAR_ASSIGN=19
+NUM_INT=51
+PLUS=43
+MINUS_ASSIGN=18
+T113=113
+T109=109
+IDENT=6
+DECIMAL_LITERAL=58
+T68=68
+T73=73
+T84=84
+MOD_ASSIGN=21
+T78=78
+T115=115
+WS=55
+LT=36
+BSR=42
+SL_ASSIGN=24
+T96=96
+T71=71
+T72=72
+T94=94
+LAND=30
+LBRACK=4
+T76=76
+NUM_FLOAT=54
+SEMI=10
+GE=39
+LNOT=50
+DIV_ASSIGN=20
+T75=75
+UNICODE_CHAR=66
+EQUAL=35
+T89=89
+OCTAL_DIGIT=65
+COLON=16
+SL=40
+T82=82
+DIV=45
+T100=100
+EXPONENT_PART=62
+T79=79
+LOR=29
+BNOT=49
+INC=47
+T93=93
+T107=107
+MOD=46
+OCTAL_LITERAL=60
+PLUS_ASSIGN=17
+T83=83
+QUESTION=28
+HEX_LITERAL=59
+T101=101
+FLOAT_TYPE_SUFFIX=63
+RCURLY=11
+T91=91
+T105=105
+T86=86
+CHAR_LITERAL=52
+BOR_ASSIGN=27
+ASSIGN=15
+LPAREN=13
+T111=111
+HEX_DIGIT=67
+T77=77
+ML_COMMENT=57
+SL_COMMENT=56
+BAND=33
+T106=106
+T112=112
+T69=69
+NOT_EQUAL=34
+BAND_ASSIGN=25
+T95=95
+DIGITS=61
+T110=110
+T108=108
+T92=92
+BXOR_ASSIGN=26
+GT=37
+BSR_ASSIGN=23
+T88=88
+T98=98
+T87=87
+T80=80
+DEC=48
+T97=97
+ESCAPE_SEQUENCE=64
+T104=104
+Tokens=116
+RBRACK=5
+T99=99
+STAR=8
+BXOR=32
+T90=90

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/parser/Java.g
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/parser/Java.g	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/semantics/java/parser/Java.g	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,1067 @@
+/** A Java 1.5 grammar for ANTLR v3 derived from the spec
+ *
+ *  This is a very close representation of the spec; the changes
+ *  are comestic (remove left recursion) and also fixes (the spec
+ *  isn't exactly perfect).  I have run this on the 1.4.2 source
+ *  and some nasty looking enums from 1.5, but have not really
+ *  tested for 1.5 compatibility.
+ *
+ *  I built this with: java -Xmx100M org.antlr.Tool java.g 
+ *  and got two errors that are ok (for now):
+ *  java.g:691:9: Decision can match input such as
+ *    "'0'..'9'{'E', 'e'}{'+', '-'}'0'..'9'{'D', 'F', 'd', 'f'}"
+ *    using multiple alternatives: 3, 4
+ *  As a result, alternative(s) 4 were disabled for that input
+ *  java.g:734:35: Decision can match input such as "{'$', 'A'..'Z',
+ *    '_', 'a'..'z', '\u00C0'..'\u00D6', '\u00D8'..'\u00F6',
+ *    '\u00F8'..'\u1FFF', '\u3040'..'\u318F', '\u3300'..'\u337F',
+ *    '\u3400'..'\u3D2D', '\u4E00'..'\u9FFF', '\uF900'..'\uFAFF'}"
+ *    using multiple alternatives: 1, 2
+ *  As a result, alternative(s) 2 were disabled for that input
+ *
+ *  You can turn enum on/off as a keyword :)
+ *
+ *  Version 1.0 -- initial release July 5, 2006 (requires 3.0b2 or higher)
+ *
+ *  Primary author: Terence Parr, July 2006
+ *
+ *  Version 1.0.1 -- corrections by Koen Vanderkimpen & Marko van Dooren,
+ *      October 25, 2006;
+ *      fixed normalInterfaceDeclaration: now uses typeParameters instead
+ *          of typeParameter (according to JLS, 3rd edition)
+ *      fixed castExpression: no longer allows expression next to type
+ *          (according to semantics in JLS, in contrast with syntax in JLS)
+ *
+ *  Version 1.0.2 -- Terence Parr, Nov 27, 2006
+ *      java spec I built this from had some bizarre for-loop control.
+ *          Looked weird and so I looked elsewhere...Yep, it's messed up.
+ *          simplified.
+ *
+ *  Version 1.0.3 -- Chris Hogue, Feb 26, 2007
+ *      Factored out an annotationName rule and used it in the annotation rule.
+ *          Not sure why, but typeName wasn't recognizing references to inner
+ *          annotations (e.g. @InterfaceName.InnerAnnotation())
+ *      Factored out the elementValue section of an annotation reference.  Created 
+ *          elementValuePair and elementValuePairs rules, then used them in the 
+ *          annotation rule.  Allows it to recognize annotation references with 
+ *          multiple, comma separated attributes.
+ *      Updated elementValueArrayInitializer so that it allows multiple elements.
+ *          (It was only allowing 0 or 1 element).
+ *      Updated localVariableDeclaration to allow annotations.  Interestingly the JLS
+ *          doesn't appear to indicate this is legal, but it does work as of at least
+ *          JDK 1.5.0_06.
+ *      Moved the Identifier portion of annotationTypeElementRest to annotationMethodRest.
+ *          Because annotationConstantRest already references variableDeclarator which 
+ *          has the Identifier portion in it, the parser would fail on constants in 
+ *          annotation definitions because it expected two identifiers.  
+ *      Added optional trailing ';' to the alternatives in annotationTypeElementRest.
+ *          Wouldn't handle an inner interface that has a trailing ';'.
+ *      Swapped the expression and type rule reference order in castExpression to 
+ *          make it check for genericized casts first.  It was failing to recognize a
+ *          statement like  "Class<Byte> TYPE = (Class<Byte>)...;" because it was seeing
+ *          'Class<Byte' in the cast expression as a less than expression, then failing 
+ *          on the '>'.
+ *      Changed createdName to use typeArguments instead of nonWildcardTypeArguments.
+ *          Again, JLS doesn't seem to allow this, but java.lang.Class has an example of
+ *          of this construct.
+ *      Changed the 'this' alternative in primary to allow 'identifierSuffix' rather than
+ *          just 'arguments'.  The case it couldn't handle was a call to an explicit
+ *          generic method invocation (e.g. this.<E>doSomething()).  Using identifierSuffix
+ *          may be overly aggressive--perhaps should create a more constrained thisSuffix rule?
+ * 		
+ *  Version 1.0.4 -- Hiroaki Nakamura, May 3, 2007
+ *
+ *	Fixed formalParameterDecls, localVariableDeclaration, forInit,
+ *	and forVarControl to use variableModifier* not 'final'? (annotation)?
+ */
+grammar Java;
+options {k=2; backtrack=true; memoize=true;}
+
+ at parser::header {
+	package org.drools.rule.builder.dialect.java.parser;
+	import java.util.Iterator;
+}
+
+ at parser::members {
+	private List identifiers = new ArrayList();
+	public List getIdentifiers() { return identifiers; }
+	private List localDeclarations = new ArrayList();
+	public List getLocalDeclarations() { return localDeclarations; }
+	public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
+	private List errors = new ArrayList();
+	private int localVariableLevel = 0;
+	private List modifyBlocks = new ArrayList();
+	public List getModifyBlocks() { return modifyBlocks; }
+	
+	private String source = "unknown";
+	
+	public void setSource(String source) {
+		this.source = source;
+	}
+	
+	public String getSource() {
+		return this.source;
+	}
+		
+	public void reportError(RecognitionException ex) {
+	        // if we've already reported an error and have not matched a token
+                // yet successfully, don't report any errors.
+                if ( errorRecovery ) {
+                        //System.err.print("[SPURIOUS] ");
+                        return;
+                }
+                errorRecovery = true;
+
+		errors.add( ex ); 
+	}
+     	
+     	/** return the raw RecognitionException errors */
+     	public List getErrors() {
+     		return errors;
+     	}
+     	
+     	/** Return a list of pretty strings summarising the errors */
+     	public List getErrorMessages() {
+     		List messages = new ArrayList();
+ 		for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+     	     		messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+     	     	}
+     	     	return messages;
+     	}
+     	
+     	/** return true if any parser errors were accumulated */
+     	public boolean hasErrors() {
+  		return ! errors.isEmpty();
+     	}
+     	
+     	/** This will take a RecognitionException, and create a sensible error message out of it */
+     	public String createErrorMessage(RecognitionException e)
+        {
+		StringBuffer message = new StringBuffer();		
+                message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+                if ( e instanceof MismatchedTokenException ) {
+                        MismatchedTokenException mte = (MismatchedTokenException)e;
+                        message.append("mismatched token: "+
+                                                           e.token+
+                                                           "; expecting type "+
+                                                           tokenNames[mte.expecting]);
+                }
+                else if ( e instanceof MismatchedTreeNodeException ) {
+                        MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+                        message.append("mismatched tree node: "+
+                                                           mtne.node+
+                                                           "; expecting type "+
+                                                           tokenNames[mtne.expecting]);
+                }
+                else if ( e instanceof NoViableAltException ) {
+                        NoViableAltException nvae = (NoViableAltException)e;
+			message.append( "Unexpected token '" + e.token.getText() + "'" );
+                        /*
+                        message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+                                                           " state "+nvae.stateNumber+
+                                                           " (decision="+nvae.decisionNumber+
+                                                           ") no viable alt; token="+
+                                                           e.token);
+                                                           */
+                }
+                else if ( e instanceof EarlyExitException ) {
+                        EarlyExitException eee = (EarlyExitException)e;
+                        message.append("required (...)+ loop (decision="+
+                                                           eee.decisionNumber+
+                                                           ") did not match anything; token="+
+                                                           e.token);
+                }
+                else if ( e instanceof MismatchedSetException ) {
+                        MismatchedSetException mse = (MismatchedSetException)e;
+                        message.append("mismatched token '"+
+                                                           e.token+
+                                                           "' expecting set "+mse.expecting);
+                }
+                else if ( e instanceof MismatchedNotSetException ) {
+                        MismatchedNotSetException mse = (MismatchedNotSetException)e;
+                        message.append("mismatched token '"+
+                                                           e.token+
+                                                           "' expecting set "+mse.expecting);
+                }
+                else if ( e instanceof FailedPredicateException ) {
+                        FailedPredicateException fpe = (FailedPredicateException)e;
+                        message.append("rule "+fpe.ruleName+" failed predicate: {"+
+                                                           fpe.predicateText+"}?");
+		}
+               	return message.toString();
+        }   
+} 
+
+ at lexer::header {
+	package org.drools.rule.builder.dialect.java.parser;
+}
+
+ at lexer::members {
+	public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
+	protected boolean enumIsKeyword = true;
+}
+ 
+
+// starting point for parsing a java file
+compilationUnit
+	:	annotations?
+		packageDeclaration?
+        importDeclaration*
+        typeDeclaration*
+	;
+
+packageDeclaration
+	:	'package' qualifiedName ';'
+	;
+	
+importDeclaration
+	:	'import' 'static'? Identifier ('.' Identifier)* ('.' '*')? ';'
+	;
+	
+typeDeclaration
+	:	classOrInterfaceDeclaration
+    |   ';'
+	;
+	
+classOrInterfaceDeclaration
+	:	modifier* (classDeclaration | interfaceDeclaration)
+	;
+	
+classDeclaration
+	:	normalClassDeclaration
+    |   enumDeclaration
+	;
+	
+normalClassDeclaration
+	:	'class' Identifier (typeParameters)?
+        ('extends' type)?
+        ('implements' typeList)?
+        classBody
+	;
+	
+typeParameters
+	:	'<' typeParameter (',' typeParameter)* '>'
+	;
+
+typeParameter
+	:	Identifier ('extends' bound)?
+	;
+		
+bound
+	:	type ('&' type)*
+	;
+
+enumDeclaration
+	:	ENUM Identifier ('implements' typeList)? enumBody
+	;
+	
+enumBody
+	:	'{' enumConstants? ','? enumBodyDeclarations? '}'
+	;
+
+enumConstants
+	:	enumConstant (',' enumConstant)*
+	;
+	
+enumConstant
+	:	annotations? Identifier (arguments)? (classBody)?
+	;
+	
+enumBodyDeclarations
+	:	';' (classBodyDeclaration)*
+	;
+	
+interfaceDeclaration
+	:	normalInterfaceDeclaration
+		| annotationTypeDeclaration
+	;
+	
+normalInterfaceDeclaration
+	:	'interface' Identifier typeParameters? ('extends' typeList)? interfaceBody
+	;
+	
+typeList
+	:	type (',' type)*
+	;
+	
+classBody
+	:	'{' classBodyDeclaration* '}'
+	;
+	
+interfaceBody
+	:	'{' interfaceBodyDeclaration* '}'
+	;
+
+classBodyDeclaration
+	:	';'
+	|	'static'? block
+	|	modifier* memberDecl
+	;
+	
+memberDecl
+	:	genericMethodOrConstructorDecl
+	|	methodDeclaration
+	|	fieldDeclaration
+	|	'void' Identifier voidMethodDeclaratorRest
+	|	Identifier constructorDeclaratorRest
+	|	interfaceDeclaration
+	|	classDeclaration
+	;
+	
+genericMethodOrConstructorDecl
+	:	typeParameters genericMethodOrConstructorRest
+	;
+	
+genericMethodOrConstructorRest
+	:	(type | 'void') Identifier methodDeclaratorRest
+	|	Identifier constructorDeclaratorRest
+	;
+
+methodDeclaration
+	:	type Identifier methodDeclaratorRest
+	;
+
+fieldDeclaration
+	:	type variableDeclarators ';'
+	;
+		
+interfaceBodyDeclaration
+	:	modifier* interfaceMemberDecl
+	|   ';'
+	;
+
+interfaceMemberDecl
+	:	interfaceMethodOrFieldDecl
+	|   interfaceGenericMethodDecl
+    |   'void' Identifier voidInterfaceMethodDeclaratorRest
+    |   interfaceDeclaration
+    |   classDeclaration
+	;
+	
+interfaceMethodOrFieldDecl
+	:	type Identifier interfaceMethodOrFieldRest
+	;
+	
+interfaceMethodOrFieldRest
+	:	constantDeclaratorsRest ';'
+	|	interfaceMethodDeclaratorRest
+	;
+	
+methodDeclaratorRest
+	:	formalParameters ('[' ']')*
+        ('throws' qualifiedNameList)?
+        (   methodBody
+        |   ';'
+        )
+	;
+	
+voidMethodDeclaratorRest
+	:	formalParameters ('throws' qualifiedNameList)?
+        (   methodBody
+        |   ';'
+        )
+	;
+	
+interfaceMethodDeclaratorRest
+	:	formalParameters ('[' ']')* ('throws' qualifiedNameList)? ';'
+	;
+	
+interfaceGenericMethodDecl
+	:	typeParameters (type | 'void') Identifier
+        interfaceMethodDeclaratorRest
+	;
+	
+voidInterfaceMethodDeclaratorRest
+	:	formalParameters ('throws' qualifiedNameList)? ';'
+	;
+	
+constructorDeclaratorRest
+	:	formalParameters ('throws' qualifiedNameList)? methodBody
+	;
+
+constantDeclarator
+	:	Identifier constantDeclaratorRest
+	;
+	
+variableDeclarators
+	:	variableDeclarator (',' variableDeclarator)*
+	;
+
+variableDeclarator
+	scope {
+		JavaLocalDeclarationDescr.IdentifierDescr ident;
+	}
+	@init {
+		if( this.localVariableLevel == 1 ) { // we only want top level local vars
+			$variableDeclarator::ident = new JavaLocalDeclarationDescr.IdentifierDescr();
+		}
+	}
+	@after {
+	        if( this.localVariableLevel == 1 ) { // we only want top level local vars
+	        	$localVariableDeclaration::descr.addIdentifier( $variableDeclarator::ident );
+	        }
+	}
+	:	id=Identifier rest=variableDeclaratorRest 
+		{ 
+			if( this.localVariableLevel == 1 ) { // we only want top level local vars
+				$variableDeclarator::ident.setIdentifier( $id.text );
+				$variableDeclarator::ident.setStart( ((CommonToken)$id).getStartIndex() - 1 );
+				if( $rest.stop != null ) {
+   					$variableDeclarator::ident.setEnd( ((CommonToken)$rest.stop).getStopIndex() );
+				}
+			}
+		}
+	;
+	
+variableDeclaratorRest
+	:	('[' ']')+ ('=' variableInitializer)?
+	|	'=' variableInitializer
+	|
+	;
+	
+constantDeclaratorsRest
+    :   constantDeclaratorRest (',' constantDeclarator)*
+    ;
+
+constantDeclaratorRest
+	:	('[' ']')* '=' variableInitializer
+	;
+	
+variableDeclaratorId
+	:	Identifier ('[' ']')*
+	;
+
+variableInitializer
+	:	arrayInitializer
+    |   expression
+	;
+	
+arrayInitializer
+	:	'{' (variableInitializer (',' variableInitializer)* (',')? )? '}'
+	;
+
+modifier
+    :   annotation
+    |   'public'
+    |   'protected'
+    |   'private'
+    |   'static'
+    |   'abstract'
+    |   'final'
+    |   'native'
+    |   'synchronized'
+    |   'transient'
+    |   'volatile'
+    |   'strictfp'
+    ;
+
+packageOrTypeName
+	:	Identifier ('.' Identifier)*
+	;
+
+enumConstantName
+    :   Identifier
+    ;
+
+typeName
+	:   Identifier
+    |   packageOrTypeName '.' Identifier
+	;
+
+type
+	:	Identifier (typeArguments)? ('.' Identifier (typeArguments)? )* ('[' ']')*
+	|	primitiveType ('[' ']')*
+	;
+
+primitiveType
+    :   'boolean'
+    |	'char'
+    |	'byte'
+    |	'short'
+    |	'int'
+    |	'long'
+    |	'float'
+    |	'double'
+    ;
+
+variableModifier
+	:	'final'
+    |   annotation
+	;
+
+typeArguments
+	:	'<' typeArgument (',' typeArgument)* '>'
+	;
+	
+typeArgument
+	:	type
+	|	'?' (('extends' | 'super') type)?
+	;
+	
+qualifiedNameList
+	:	qualifiedName (',' qualifiedName)*
+	;
+	
+formalParameters
+	:	'(' formalParameterDecls? ')'
+	;
+	
+formalParameterDecls
+	:	variableModifier* type formalParameterDeclsRest?
+	;
+	
+formalParameterDeclsRest
+	:	variableDeclaratorId (',' formalParameterDecls)?
+	|   '...' variableDeclaratorId
+	;
+	
+methodBody
+	:	block
+	;
+
+qualifiedName
+	:	Identifier ('.' Identifier)*
+	;
+	
+literal	
+	:   integerLiteral
+    |   FloatingPointLiteral
+    |   CharacterLiteral
+    |   StringLiteral
+    |   booleanLiteral
+    |   'null'
+	;
+
+integerLiteral
+    :   HexLiteral
+    |   OctalLiteral
+    |   DecimalLiteral
+    ;
+
+booleanLiteral
+    :   'true'
+    |   'false'
+    ;
+
+// ANNOTATIONS
+
+annotations
+	:	annotation+
+	;
+
+annotation
+	:	'@' annotationName ('(' elementValuePairs? ')')?
+	;
+	
+annotationName
+	: Identifier ('.' Identifier)*
+	;
+	
+elementValuePairs
+	: elementValuePair (',' elementValuePair)*
+	;
+	
+elementValuePair
+	: (Identifier '=')? elementValue
+	;
+	
+elementValue
+	:	conditionalExpression
+	|   annotation
+	|   elementValueArrayInitializer
+	;
+	
+elementValueArrayInitializer
+	:	'{' (elementValue (',' elementValue )*)? '}'
+	;
+	
+annotationTypeDeclaration
+	:	'@' 'interface' Identifier annotationTypeBody
+	;
+	
+annotationTypeBody
+	:	'{' (annotationTypeElementDeclarations)? '}'
+	;
+	
+annotationTypeElementDeclarations
+	:	(annotationTypeElementDeclaration) (annotationTypeElementDeclaration)*
+	;
+	
+annotationTypeElementDeclaration
+	:	(modifier)* annotationTypeElementRest
+	;
+	
+annotationTypeElementRest
+	:	type annotationMethodOrConstantRest ';'
+	|   classDeclaration ';'?
+	|   interfaceDeclaration ';'?
+	|   enumDeclaration ';'?
+	|   annotationTypeDeclaration ';'?
+	;
+	
+annotationMethodOrConstantRest
+	:	annotationMethodRest
+	|   annotationConstantRest
+	;
+	
+annotationMethodRest
+ 	:	Identifier '(' ')' (defaultValue)?
+ 	;
+ 	
+annotationConstantRest
+ 	:	variableDeclarators
+ 	;
+ 	
+defaultValue
+ 	:	'default' elementValue
+ 	;
+
+// STATEMENTS / BLOCKS
+
+block
+        @init {
+            this.localVariableLevel++;
+        }
+        @after {
+            this.localVariableLevel--;
+        }
+	:	'{' blockStatement* '}'
+	;
+	
+blockStatement
+	:	localVariableDeclaration
+	|	classOrInterfaceDeclaration
+    	|	statement
+	;
+	
+localVariableDeclaration
+scope   {
+            JavaLocalDeclarationDescr descr;
+        }
+        @init {
+            $localVariableDeclaration::descr = new JavaLocalDeclarationDescr();
+        }
+        @after {
+            localDeclarations.add( $localVariableDeclaration::descr );
+        }
+	:	
+	( variableModifier 
+	    { 
+	        $localVariableDeclaration::descr.updateStart( ((CommonToken)$variableModifier.start).getStartIndex() - 1 ); 
+	        $localVariableDeclaration::descr.addModifier( $variableModifier.text ); 
+	    } 
+	)* 
+	type 
+	    { 
+	        $localVariableDeclaration::descr.updateStart( ((CommonToken)$type.start).getStartIndex() - 1 ); 
+	        $localVariableDeclaration::descr.setType( $type.text ); 
+	        $localVariableDeclaration::descr.setEnd( ((CommonToken)$type.stop).getStopIndex() ); 
+	    }
+	variableDeclarators ';'
+	;
+	
+statement
+	: block
+    | 'assert' expression (':' expression)? ';'
+    | 'if' parExpression statement (options {k=1;}:'else' statement)?
+    | 'for' '(' forControl ')' statement
+    | 'while' parExpression statement
+    | 'do' statement 'while' parExpression ';'
+    | 'try' block
+      (	catches 'finally' block
+      | catches
+      | 'finally' block
+      )
+    | 'switch' parExpression '{' switchBlockStatementGroups '}'
+    | 'synchronized' parExpression block
+    | 'return' expression? ';'
+    | 'throw' expression ';'
+    | 'break' Identifier? ';'
+    | 'continue' Identifier? ';'
+    // adding support to drools modify block
+    | modifyStatement
+    | ';'
+    | statementExpression ';'
+    | Identifier ':' statement
+	;
+	
+modifyStatement
+	@init {
+	    JavaModifyBlockDescr d = null;
+	}
+	: s='modify' parExpression 
+	{
+	    d = new JavaModifyBlockDescr( $parExpression.text );
+	    d.setStart( ((CommonToken)$s).getStartIndex() );
+	    this.modifyBlocks.add( d );
+	    
+	}
+	'{' ( e = expression { d.getExpressions().add( $e.text ); }
+	       (',' e=expression { d.getExpressions().add( $e.text ); } )*
+	    )? 
+	c='}' 
+        {
+            d.setEnd( ((CommonToken)$c).getStopIndex() ); 
+        }
+	;	
+	
+catches
+	:	catchClause (catchClause)*
+	;
+	
+catchClause
+	:	'catch' '(' formalParameter ')' block
+	;
+
+formalParameter
+	:	variableModifier* type variableDeclaratorId
+	;
+		
+switchBlockStatementGroups
+	:	(switchBlockStatementGroup)*
+	;
+	
+switchBlockStatementGroup
+	:	switchLabel blockStatement*
+	;
+	
+switchLabel
+	:	'case' constantExpression ':'
+	|   'case' enumConstantName ':'
+	|   'default' ':'
+	;
+	
+moreStatementExpressions
+	:	(',' statementExpression)*
+	;
+
+forControl
+options {k=3;} // be efficient for common case: for (ID ID : ID) ...
+	:	forVarControl
+	|	forInit? ';' expression? ';' forUpdate?
+	;
+
+forInit
+        @init {
+            this.localVariableLevel++;
+        }
+        @after {
+            this.localVariableLevel--;
+        }
+	:	variableModifier* type variableDeclarators
+	|	expressionList
+	;
+	
+forVarControl
+	:	variableModifier* type Identifier ':' expression
+	;
+
+forUpdate
+	:	expressionList
+	;
+
+// EXPRESSIONS
+
+parExpression
+	:	'(' expression ')'
+	;
+	
+expressionList
+    :   expression (',' expression)*
+    ;
+
+statementExpression
+	:	expression
+	;
+	
+constantExpression
+	:	expression
+	;
+	
+expression
+	:	conditionalExpression (assignmentOperator expression)?
+	;
+	
+assignmentOperator
+	:	'='
+    |   '+='
+    |   '-='
+    |   '*='
+    |   '/='
+    |   '&='
+    |   '|='
+    |   '^='
+    |   '%='
+    |   '<' '<' '='
+    |   '>' '>' '='
+    |   '>' '>' '>' '='
+	;
+
+conditionalExpression
+    :   conditionalOrExpression ( '?' expression ':' expression )?
+	;
+
+conditionalOrExpression
+    :   conditionalAndExpression ( '||' conditionalAndExpression )*
+	;
+
+conditionalAndExpression
+    :   inclusiveOrExpression ( '&&' inclusiveOrExpression )*
+	;
+
+inclusiveOrExpression
+    :   exclusiveOrExpression ( '|' exclusiveOrExpression )*
+	;
+
+exclusiveOrExpression
+    :   andExpression ( '^' andExpression )*
+	;
+
+andExpression
+    :   equalityExpression ( '&' equalityExpression )*
+	;
+
+equalityExpression
+    :   instanceOfExpression ( ('==' | '!=') instanceOfExpression )*
+	;
+
+instanceOfExpression
+    :   relationalExpression ('instanceof' type)?
+	;
+
+relationalExpression
+    :   shiftExpression ( relationalOp shiftExpression )*
+	;
+	
+relationalOp
+	:	('<' '=' | '>' '=' | '<' | '>')
+	;
+
+shiftExpression
+    :   additiveExpression ( shiftOp additiveExpression )*
+	;
+
+        // TODO: need a sem pred to check column on these >>>
+shiftOp
+	:	('<' '<' | '>' '>' '>' | '>' '>')
+	;
+
+
+additiveExpression
+    :   multiplicativeExpression ( ('+' | '-') multiplicativeExpression )*
+	;
+
+multiplicativeExpression
+    :   unaryExpression ( ( '*' | '/' | '%' ) unaryExpression )*
+	;
+	
+unaryExpression
+    :   '+' unaryExpression
+    |	'-' unaryExpression
+    |   '++' primary
+    |   '--' primary
+    |   unaryExpressionNotPlusMinus
+    ;
+
+unaryExpressionNotPlusMinus
+    :   '~' unaryExpression
+    | 	'!' unaryExpression
+    |   castExpression
+    |   primary selector* ('++'|'--')?
+    ;
+
+castExpression
+    :  '(' primitiveType ')' unaryExpression
+    |  '(' (type | expression) ')' unaryExpressionNotPlusMinus
+    ;
+
+primary
+    :	parExpression
+    |   nonWildcardTypeArguments
+        (explicitGenericInvocationSuffix | 'this' arguments)
+    |   'this' ('.' Identifier)* (identifierSuffix)?
+    |   'super' superSuffix
+    |   literal
+    |   'new' creator
+    |   i=Identifier { if( ! "(".equals( input.LT(1) == null ? "" : input.LT(1).getText() ) ) identifiers.add( $i.text );  } ('.' Identifier)* (identifierSuffix)?
+    |   primitiveType ('[' ']')* '.' 'class'
+    |   'void' '.' 'class'
+	;
+
+identifierSuffix
+	:	('[' ']')+ '.' 'class'
+	|	('[' expression ']')+ // can also be matched by selector, but do here
+    |   arguments
+    |   '.' 'class'
+    |   '.' explicitGenericInvocation
+    |   '.' 'this'
+    |   '.' 'super' arguments
+    |   '.' 'new' (nonWildcardTypeArguments)? innerCreator
+	;
+	
+creator
+	:	nonWildcardTypeArguments? createdName
+        (arrayCreatorRest | classCreatorRest)
+	;
+
+createdName
+	:	Identifier typeArguments?
+        ('.' Identifier typeArguments?)*
+    |	primitiveType
+	;
+	
+innerCreator
+	:	Identifier classCreatorRest
+	;
+
+arrayCreatorRest
+	:	'['
+        (   ']' ('[' ']')* arrayInitializer
+        |   expression ']' ('[' expression ']')* ('[' ']')*
+        )
+	;
+
+classCreatorRest
+	:	arguments classBody?
+	;
+	
+explicitGenericInvocation
+	:	nonWildcardTypeArguments explicitGenericInvocationSuffix
+	;
+	
+nonWildcardTypeArguments
+	:	'<' typeList '>'
+	;
+	
+explicitGenericInvocationSuffix
+	:	'super' superSuffix
+	|   Identifier arguments
+	;
+	
+selector
+	:	'.' Identifier (arguments)?
+	|   '.' 'this'
+	|   '.' 'super' superSuffix
+	|   '.' 'new' (nonWildcardTypeArguments)? innerCreator
+	|   '[' expression ']'
+	;
+	
+superSuffix
+	:	arguments
+	|   '.' Identifier (arguments)?
+    ;
+
+arguments
+	:	'(' expressionList? ')'
+	;
+
+// LEXER
+
+HexLiteral : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
+
+DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
+
+OctalLiteral : '0' ('0'..'7')+ IntegerTypeSuffix? ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+IntegerTypeSuffix : ('l'|'L') ;
+
+FloatingPointLiteral
+    :   ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
+    |   '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
+    |   ('0'..'9')+ Exponent FloatTypeSuffix?
+    |   ('0'..'9')+ Exponent? FloatTypeSuffix
+	;
+
+fragment
+Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
+
+fragment
+FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
+
+CharacterLiteral
+    :   '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
+    ;
+
+StringLiteral
+    :  '"' ( EscapeSequence | ~('\\'|'"') )* '"'
+    ;
+
+fragment
+EscapeSequence
+    :   '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
+    |   UnicodeEscape
+    |   OctalEscape
+    ;
+
+fragment
+OctalEscape
+    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7')
+    ;
+
+fragment
+UnicodeEscape
+    :   '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+    ;
+
+ENUM:	'enum' {if ( !enumIsKeyword ) $type=Identifier;}
+	;
+	
+Identifier 
+    :   Letter (Letter|JavaIDDigit)*
+    ;
+
+/**I found this char range in JavaCC's grammar, but Letter and Digit overlap.
+   Still works, but...
+ */
+fragment
+Letter
+    :  '\u0024' |
+       '\u0041'..'\u005a' |
+       '\u005f' |
+       '\u0061'..'\u007a' |
+       '\u00c0'..'\u00d6' |
+       '\u00d8'..'\u00f6' |
+       '\u00f8'..'\u00ff' |
+       '\u0100'..'\u1fff' |
+       '\u3040'..'\u318f' |
+       '\u3300'..'\u337f' |
+       '\u3400'..'\u3d2d' |
+       '\u4e00'..'\u9fff' |
+       '\uf900'..'\ufaff'
+    ;
+
+fragment
+JavaIDDigit
+    :  '\u0030'..'\u0039' |
+       '\u0660'..'\u0669' |
+       '\u06f0'..'\u06f9' |
+       '\u0966'..'\u096f' |
+       '\u09e6'..'\u09ef' |
+       '\u0a66'..'\u0a6f' |
+       '\u0ae6'..'\u0aef' |
+       '\u0b66'..'\u0b6f' |
+       '\u0be7'..'\u0bef' |
+       '\u0c66'..'\u0c6f' |
+       '\u0ce6'..'\u0cef' |
+       '\u0d66'..'\u0d6f' |
+       '\u0e50'..'\u0e59' |
+       '\u0ed0'..'\u0ed9' |
+       '\u1040'..'\u1049'
+   ;
+
+WS  :  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
+    ;
+
+COMMENT
+    :   '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
+    ;
+
+LINE_COMMENT
+    : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
+    ;

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/xml/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/xml/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/main/resources/org/drools/xml/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+<body>
+	This contains the parser and utilities for handling rules in XML format. 
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/log4j.properties
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/log4j.properties	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/log4j.properties	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+log4j.rootCategory=INFO, dest1
+log4j.appender.dest1=org.apache.log4j.ConsoleAppender
+log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Approve.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Approve.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Approve.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.acme.insurance;
+
+/**
+ * This is a simple fact class to mark something as approved.
+ * @author Michael Neale
+ *
+ */
+public class Approve {
+
+    private String reason;
+
+    public Approve(final String reason) {
+        this.reason = reason;
+    }
+
+    public String getReason() {
+        return this.reason;
+    }
+
+    public void setReason(final String reason) {
+        this.reason = reason;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Driver.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Driver.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Driver.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,47 @@
+package org.acme.insurance;
+
+/**
+ * This represents obviously a driver who is applying for an insurance Policy.
+ * @author Michael Neale
+ *
+ */
+public class Driver {
+
+    private String  name                = "Mr Joe Blogs";
+    private Integer age                 = new Integer( 30 );
+    private Integer priorClaims         = new Integer( 0 );
+    private String  locationRiskProfile = "LOW";
+
+    public Integer getAge() {
+        return this.age;
+    }
+
+    public void setAge(final Integer age) {
+        this.age = age;
+    }
+
+    public String getLocationRiskProfile() {
+        return this.locationRiskProfile;
+    }
+
+    public void setLocationRiskProfile(final String locationRiskProfile) {
+        this.locationRiskProfile = locationRiskProfile;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public Integer getPriorClaims() {
+        return this.priorClaims;
+    }
+
+    public void setPriorClaims(final Integer priorClaims) {
+        this.priorClaims = priorClaims;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Policy.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Policy.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Policy.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+package org.acme.insurance;
+
+/**
+ * This represents a policy that a driver is applying for. 
+ * 
+ * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
+ * some simple base price and discount that we can calculate with relatively simple rules !
+ * 
+ * @author Michael Neale
+ */
+public class Policy {
+
+    private String  type            = "COMPREHENSIVE";
+    private boolean approved        = false;
+    private int     discountPercent = 0;
+    private int     basePrice;
+
+    public boolean isApproved() {
+        return this.approved;
+    }
+
+    public void setApproved(final boolean approved) {
+        this.approved = approved;
+    }
+
+    public int getDiscountPercent() {
+        return this.discountPercent;
+    }
+
+    public void setDiscountPercent(final int discountPercent) {
+        this.discountPercent = discountPercent;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public void applyDiscount(final int discount) {
+        this.discountPercent += discount;
+    }
+
+    public int getBasePrice() {
+        return this.basePrice;
+    }
+
+    public void setBasePrice(final int basePrice) {
+        this.basePrice = basePrice;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Rejection.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Rejection.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/acme/insurance/Rejection.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.acme.insurance;
+
+/**
+ * 
+ * @author Michael Neale
+ */
+public class Rejection {
+
+    private String reason;
+
+    public Rejection(final String reason) {
+        this.reason = reason;
+    }
+
+    public String getReason() {
+        return this.reason;
+    }
+
+    public void setReason(final String reason) {
+        this.reason = reason;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Address.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Address.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Address.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+package org.drools;
+
+public class Address {
+
+    private String street;
+    private String suburb;
+    
+    public Address() {
+        
+    }
+    
+    public Address(String street) {
+        this.street = street;
+    }
+    
+    public String getStreet() {
+        return street;
+    }
+    public void setStreet(String street) {
+        this.street = street;
+    }
+    public String getSuburb() {
+        return suburb;
+    }
+    public void setSuburb(String suburb) {
+        this.suburb = suburb;
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Alarm.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Alarm.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Alarm.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,66 @@
+package org.drools;
+
+public class Alarm {
+    private String message;
+
+    public Alarm() {
+
+    }
+
+    public Alarm(final String message) {
+        this.message = message;
+    }
+
+    public String toString() {
+        return "[Alarm message=" + this.message + "]";
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((this.message == null) ? 0 : this.message.hashCode());
+        return result;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final Alarm other = (Alarm) obj;
+        if ( this.message == null ) {
+            if ( other.message != null ) {
+                return false;
+            }
+        } else if ( !this.message.equals( other.message ) ) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * @return the message
+     */
+    public String getMessage() {
+        return this.message;
+    }
+
+    /**
+     * @param message the message to set
+     */
+    public void setMessage(final String message) {
+        this.message = message;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Approach.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Approach.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Approach.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,81 @@
+package org.drools;
+
+public class Approach {
+
+    public String label;
+    public String label2;
+    public Float  time;
+    public Float  time2;
+    public Float  distance;
+    public Float  distance2;
+    public Float  bearing;
+    public Float  bearing2;
+
+    public Float getDistance2() {
+        return this.distance2;
+    }
+
+    public void setDistance2(final Float distance2) {
+        this.distance2 = distance2;
+    }
+
+    public Float getTime2() {
+        return this.time2;
+    }
+
+    public void setTime2(final Float time2) {
+        this.time2 = time2;
+    }
+
+    public Float getBearing() {
+        return this.bearing;
+    }
+
+    public void setBearing(final Float bearing) {
+        this.bearing = bearing;
+    }
+
+    public Float getDistance() {
+        return this.distance;
+    }
+
+    public void setDistance(final Float distance) {
+        this.distance = distance;
+    }
+
+    public String getLabel() {
+        return this.label;
+    }
+
+    public void setLabel(final String label) {
+        this.label = label;
+    }
+
+    public String getLabel2() {
+        return this.label2;
+    }
+
+    public void setLabel2(final String label2) {
+        this.label2 = label2;
+    }
+
+    public Float getTime() {
+        return this.time;
+    }
+
+    public void setTime(final Float time) {
+        this.time = time;
+    }
+
+    public Float getBearing2() {
+        return this.bearing2;
+    }
+
+    public void setBearing2(final Float bearing2) {
+        this.bearing2 = bearing2;
+    }
+
+    public String toString() {
+        return "Approach< label: " + this.label + " label2: " + this.label2 + " time: " + this.time + " time2: " + this.time2 + " distance: " + this.distance + " distance2: " + this.distance2 + " bearing: " + this.bearing + " bearing2: " + this.bearing2 + " >";
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Attribute.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Attribute.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Attribute.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+/**
+ * 
+ */
+package org.drools;
+
+public class Attribute
+{
+
+    public Integer getValue()
+    {
+        return null;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cell.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cell.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cell.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Cell {
+
+    int value = 0;
+
+    public Cell() {
+
+    }
+
+    public Cell(final int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    public void setValue(final int value) {
+        this.value = value;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheese.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheese.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheese.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,121 @@
+package org.drools;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Cheese
+    implements
+    Serializable {
+
+    public static final String STILTON = "stilton";
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 400L;
+    private String            type;
+    private int               price;
+    private int               oldPrice;
+    private Date              usedBy;
+
+    public Cheese() {
+
+    }
+    
+    public Cheese(final String type) {
+        super();
+        this.type = type;
+        this.price = 0;
+    }    
+
+    public Cheese(final String type,
+                  final int price) {
+        super();
+        this.type = type;
+        this.price = price;
+    }
+
+    public Cheese(final String type,
+                  final int price,
+                  final int oldPrice ) {
+        super();
+        this.type = type;
+        this.price = price;
+        this.oldPrice = oldPrice;
+    }
+
+    public int getPrice() {
+        return this.price;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public void setPrice(final int price) {
+        this.price = price;
+    }
+
+    public String toString() {
+        return "Cheese( type='" + this.type + "', price=" + this.price + " )";
+    }
+
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + price;
+        result = PRIME * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final Cheese other = (Cheese) obj;
+        if ( price != other.price ) return false;
+        if ( type == null ) {
+            if ( other.type != null ) return false;
+        } else if ( !type.equals( other.type ) ) return false;
+        return true;
+    }
+
+    public int getOldPrice() {
+        return oldPrice;
+    }
+
+    public void setOldPrice(int oldPrice) {
+        this.oldPrice = oldPrice;
+    }
+
+    public Date getUsedBy() {
+        return usedBy;
+    }
+
+    public void setUsedBy(Date usedBy) {
+        this.usedBy = usedBy;
+    }
+
+
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/CheeseEqual.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/CheeseEqual.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/CheeseEqual.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+package org.drools;
+
+import java.io.Serializable;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class CheeseEqual
+    implements
+    Serializable {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    protected String          type;
+    protected int             price;
+
+    public CheeseEqual() {
+
+    }
+
+    public CheeseEqual(final String type,
+                       final int price) {
+        super();
+        this.type = type;
+        this.price = price;
+    }
+
+    public int getPrice() {
+        return this.price;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setPrice(final int price) {
+        this.price = price;
+    }
+
+    public String toString() {
+        return "CheeseEqual( type='" + this.type + "', price=" + this.price + " )";
+    }
+
+    public boolean equals(final Object object) {
+        if ( this == object ) {
+            return true;
+        }
+
+        if ( (object == null) || (object.getClass() != this.getClass()) ) {
+            return false;
+        }
+
+        final CheeseEqual other = (CheeseEqual) object;
+
+        if ( !this.type.equals( other.type ) ) {
+            return false;
+        }
+
+        if ( this.price != other.price ) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public int hashCode() {
+        //like org.apache.commons.lang.builder.HashCodeBuilder
+        int hashCode = 17;
+        hashCode = hashCode * 37 + this.price;
+        hashCode = hashCode * 37 + (this.type == null ? 0 : this.type.hashCode());
+        return hashCode;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheesery.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheesery.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Cheesery.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,95 @@
+package org.drools;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class Cheesery
+    implements
+    Serializable {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    public final static int   MAKING_CHEESE    = 0;
+    public final static int   SELLING_CHEESE   = 1;
+
+    private final List        cheeses          = new ArrayList();
+
+    private int               status;
+    private int               totalAmount;
+    private Maturity          maturity;
+
+    public List getCheeses() {
+        return this.cheeses;
+    }
+
+    public void addCheese(final Cheese cheese) {
+        this.cheeses.add( cheese );
+        this.totalAmount += cheese.getPrice();
+    }
+
+    public void removeCheese(final Cheese cheese) {
+        this.cheeses.remove( cheese );
+        this.totalAmount = 0;
+        for( Iterator it = this.cheeses.iterator(); it.hasNext(); ) {
+            this.totalAmount += ((Cheese) it.next()).getPrice();
+        }
+    }
+
+    public void setStatus(final int status) {
+        this.status = status;
+    }
+
+    public int getStatus() {
+        return this.status;
+    }
+
+    public Maturity getMaturity() {
+        return this.maturity;
+    }
+
+    public void setMaturity(final Maturity maturity) {
+        this.maturity = maturity;
+    }
+
+    public int getTotalAmount() {
+        return this.totalAmount;
+    }
+
+    public void setTotalAmount(final int totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public static class Maturity {
+        public static final Maturity YOUNG = new Maturity( "young" );
+        public static final Maturity OLD   = new Maturity( "old" );
+
+        private String               age;
+
+        public Maturity(final String age) {
+            this.age = age;
+        }
+
+        public String toString() {
+            return "[Maturity age='" + this.age + "']";
+        }
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Child.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Child.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Child.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+public class Child extends Parent {
+
+    public Child() {
+    }
+
+    public Child(final String name) {
+        super( name );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Close.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Close.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Close.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+package org.drools;
+
+public class Close {
+
+    public String label;
+    public String label2;
+    public Float  time;
+    public Float  distance;
+    public Float  bearing;
+
+    public Float getBearing() {
+        return this.bearing;
+    }
+
+    public void setBearing(final Float bearing) {
+        this.bearing = bearing;
+    }
+
+    public Float getDistance() {
+        return this.distance;
+    }
+
+    public void setDistance(final Float distance) {
+        this.distance = distance;
+    }
+
+    public String getLabel() {
+        return this.label;
+    }
+
+    public void setLabel(final String label) {
+        this.label = label;
+    }
+
+    public String getLabel2() {
+        return this.label2;
+    }
+
+    public void setLabel2(final String label2) {
+        this.label2 = label2;
+    }
+
+    public Float getTime() {
+        return this.time;
+    }
+
+    public void setTime(final Float time) {
+        this.time = time;
+    }
+
+    public String toString() {
+        return "Close< label: " + this.label + " label2: " + this.label2 + " time: " + this.time + " distance: " + this.distance + " bearing: " + this.bearing + ">";
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/DroolsTestCase.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/DroolsTestCase.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/DroolsTestCase.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,64 @@
+package org.drools;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+public abstract class DroolsTestCase extends TestCase {
+    public DroolsTestCase() {
+        super();
+    }
+
+    public DroolsTestCase(final String name) {
+        super( name );
+    }
+
+    public void assertLength(final int len,
+                             final Object[] array) {
+        assertEquals( Arrays.asList( array ) + " does not have length of " + len,
+                      len,
+                      array.length );
+    }
+
+    public void assertLength(final int len,
+                             final Collection collection) {
+        assertEquals( collection + " does not have length of " + len,
+                      len,
+                      collection.size() );
+    }
+
+    public void assertContains(final Object obj,
+                               final Object[] array) {
+        for ( int i = 0; i < array.length; ++i ) {
+            if ( array[i] == obj ) {
+                return;
+            }
+        }
+
+        fail( Arrays.asList( array ) + " does not contain " + obj );
+    }
+
+    public void assertContains(final Object obj,
+                               final Collection collection) {
+        assertTrue( collection + " does not contain " + obj,
+                    collection.contains( obj ) );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/EmergencyTeam.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/EmergencyTeam.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/EmergencyTeam.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+public class EmergencyTeam {
+    public EmergencyTeam() {
+
+    }
+    
+    public String toString() {
+        return "[EmergencyTeam]";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactA.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactA.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactA.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+package org.drools;
+
+public class FactA {
+    String  field1;
+    Integer field2;
+    Float   field3;
+
+    public FactA() {
+    }
+
+    public FactA(final String f1,
+                 final Integer f2,
+                 final Float f3) {
+        this.field1 = f1;
+        this.field2 = f2;
+        this.field3 = f3;
+    }
+
+    public String getField1() {
+        return this.field1;
+    }
+
+    public void setField1(final String s) {
+        this.field1 = s;
+    }
+
+    public Integer getField2() {
+        return this.field2;
+    }
+
+    public void setField2(final Integer i) {
+        this.field2 = i;
+    }
+
+    public Float getField3() {
+        return this.field3;
+    }
+
+    public void setField3(final Float f) {
+        this.field3 = f;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactB.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactB.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactB.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+package org.drools;
+
+public class FactB {
+    String  f1;
+    Integer f2;
+    Float   f3;
+
+    public FactB() {
+    }
+
+    public FactB(final String a,
+                 final Integer b,
+                 final Float c) {
+        this.f1 = a;
+        this.f2 = b;
+        this.f3 = c;
+    }
+
+    public String getF1() {
+        return this.f1;
+    }
+
+    public void setF1(final String s) {
+        this.f1 = s;
+    }
+
+    public Integer getF2() {
+        return this.f2;
+    }
+
+    public void setF2(final Integer i) {
+        this.f2 = i;
+    }
+
+    public Float getF3() {
+        return this.f3;
+    }
+
+    public void setF3(final Float f) {
+        this.f3 = f;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactC.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactC.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FactC.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,44 @@
+package org.drools;
+
+public class FactC {
+    String  f1;
+    Integer f2;
+    Float   f3;
+
+    public FactC(final String a,
+                 final Integer b,
+                 final Float c) {
+        this.f1 = a;
+        this.f2 = b;
+        this.f3 = c;
+    }
+
+    public FactC() {
+
+    }
+
+    public String getF1() {
+        return this.f1;
+    }
+
+    public void setF1(final String s) {
+        this.f1 = s;
+    }
+
+    public Integer getF2() {
+        return this.f2;
+    }
+
+    public void setF2(final Integer i) {
+        this.f2 = i;
+    }
+
+    public Float getF3() {
+        return this.f3;
+    }
+
+    public void setF3(final Float f) {
+        this.f3 = f;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FirstClass.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FirstClass.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FirstClass.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,60 @@
+package org.drools;
+
+public class FirstClass {
+    private String item1;
+    private String item2;
+    private String item3;
+    private String item4;
+    private String item5;
+    
+    public FirstClass() {
+    }
+    
+    public FirstClass(String item1,
+                      String item2,
+                      String item3,
+                      String item4,
+                      String item5) {
+        super();
+        this.item1 = item1;
+        this.item2 = item2;
+        this.item3 = item3;
+        this.item4 = item4;
+        this.item5 = item5;
+    }
+    public String getItem1() {
+        return item1;
+    }
+    public void setItem1(String item1) {
+        this.item1 = item1;
+    }
+    public String getItem2() {
+        return item2;
+    }
+    public void setItem2(String item2) {
+        this.item2 = item2;
+    }
+    public String getItem3() {
+        return item3;
+    }
+    public void setItem3(String item3) {
+        this.item3 = item3;
+    }
+    public String getItem4() {
+        return item4;
+    }
+    public void setItem4(String item4) {
+        this.item4 = item4;
+    }
+    public String getItem5() {
+        return item5;
+    }
+    public void setItem5(String item5) {
+        this.item5 = item5;
+    }
+
+    public static class AlternativeKey {
+        
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FromTestClass.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FromTestClass.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/FromTestClass.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class FromTestClass {
+    public List toList(final Object object1,
+                       final Object object2,
+                       final String object3,
+                       final int integer,
+                       final Map map,
+                       final List inputList) {
+        final List list = new ArrayList();
+        list.add( object1 );
+        list.add( object2 );
+        list.add( object3 );
+        list.add( new Integer( integer ) );
+        list.add( map );
+        list.add( inputList );
+        return list;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Func.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Func.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Func.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+public class Func {
+    public static void func() {
+
+    }
+
+    public static void func(final String string) {
+
+    }
+
+    public static void func(final String x,
+                            final String y) {
+
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/GrandParent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/GrandParent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/GrandParent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+package org.drools;
+
+/**
+ * A grand parent class
+ * @author etirelli
+ */
+public class GrandParent {
+    private String name;
+
+    public GrandParent() {
+    }
+
+    public GrandParent(final String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Guess.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Guess.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Guess.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+public class Guess {
+
+    private Integer value;
+
+    public void setValue(final Integer guess) {
+        this.value = guess;
+    }
+
+    public Integer getValue() {
+        return this.value;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/IndexedNumber.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/IndexedNumber.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/IndexedNumber.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+/**
+ * IndexedNumber
+ *
+ * Created: 22/06/2006
+ * @author <a href="mailto:tirelli at post.com">Edson Tirelli</a> 
+ *
+ * @version $Id: IndexedNumber.java 13324 2007-07-10 23:07:58Z tirelli $
+ */
+
+public class IndexedNumber {
+
+    private int     number = 0;
+
+    private int     index  = 0;
+
+    private boolean printed;
+
+    public IndexedNumber() {
+    }
+
+    /**
+     * @param pNb
+     * @param pIndex
+     */
+    public IndexedNumber(final int pNb,
+                         final int pIndex) {
+        this.number = pNb;
+        this.index = pIndex;
+    }
+
+    /**
+     * @return le/la/les index.
+     */
+    public int getIndex() {
+        return this.index;
+    }
+
+    /**
+     * @param pIndex le/la/les index sauvegarder.
+     */
+    public void setIndex(final int pIndex) {
+        this.index = pIndex;
+    }
+
+    /**
+     * @return le/la/les nb.
+     */
+    public int getNumber() {
+        return this.number;
+    }
+
+    /**
+     * @param pNb le/la/les nb sauvegarder.
+     */
+    public void setNumber(final int pNb) {
+        this.number = pNb;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "IndexedNumber[ " + this.number + ", " + this.index + " ]";
+    }
+
+    public boolean isPrinted() {
+        return this.printed;
+    }
+
+    public void setPrinted(final boolean printed) {
+        this.printed = printed;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/InsertedObject.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/InsertedObject.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/InsertedObject.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+package org.drools;
+
+public class InsertedObject {
+    private String value;
+
+    public String getValue() {
+        return this.value;
+    }
+
+    public void setValue(final String value) {
+        this.value = value;
+    }
+
+    public InsertedObject(final String value) {
+        this.value = value;
+    }
+
+    public InsertedObject() {
+    }
+
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((value == null) ? 0 : value.hashCode());
+        return result;
+    }
+    
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final InsertedObject other = (InsertedObject) obj;
+        if ( value == null ) {
+            if ( other.value != null ) return false;
+        } else if ( !value.equals( other.value ) ) return false;
+        return true;
+    }
+    
+    
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Message.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Message.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Message.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,119 @@
+/**
+ * 
+ */
+package org.drools;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class Message {
+
+    private String          message1 = "One";
+    private String          message2 = "Two";
+    private String          message3 = "Three";
+    private String          message4 = "Four";
+
+    public static final int HELLO    = 0;
+    public static final int GOODBYE  = 1;
+
+    private String          message;
+
+    private int             status;
+
+    private List    list     = new ArrayList();
+    private int     number   = 0;
+    private Date    birthday = new Date();
+    private boolean fired    = false;    
+    
+    public Message() {
+    }
+    
+    public Message(final String msg) {
+        this.message = msg;
+    }    
+    
+    public String getMessage() {
+        return this.message;
+    }
+
+    public void setMessage(final String message) {
+        this.message = message;
+    }
+
+    public int getStatus() {
+        return this.status;
+    }
+
+    public void setStatus(final int status) {
+        this.status = status;
+    }
+
+    public String getMessage1() {
+        return this.message1;
+    }
+
+    public void setMessage1(final String message1) {
+        this.message1 = message1;
+    }
+
+    public String getMessage2() {
+        return this.message2;
+    }
+
+    public void setMessage2(final String message2) {
+        this.message2 = message2;
+    }
+
+    public String getMessage3() {
+        return this.message3;
+    }
+
+    public void setMessage3(final String message3) {
+        this.message3 = message3;
+    }
+
+    public String getMessage4() {
+        return this.message4;
+    }
+
+    public void setMessage4(final String message4) {
+        this.message4 = message4;
+    }
+    
+    public boolean isFired() {
+        return this.fired;
+    }
+
+    public void setFired(final boolean fired) {
+        this.fired = fired;
+    }
+
+    public Date getBirthday() {
+        return this.birthday;
+    }
+
+    public void setBirthday(final Date birthday) {
+        this.birthday = birthday;
+    }
+
+    public int getNumber() {
+        return this.number;
+    }
+
+    public void setNumber(final int number) {
+        this.number = number;
+    }
+
+    public List getList() {
+        return this.list;
+    }
+
+    public void setList(final List list) {
+        this.list = list;
+    }
+
+    public void addToList(final String s) {
+        this.list.add( s );
+    }    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Order.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Order.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Order.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author etirelli
+ *
+ */
+public class Order {
+
+    private int number;
+
+    private String customer;
+
+    private Map items;
+
+    private OrderStatus status;
+
+    public Order() {
+        this( 0, "Bob" );
+    }
+
+    public Order(final int number, String customer) {
+        this.number = number;
+        this.items = new HashMap();
+        this.customer = customer;
+    }
+
+    /**
+     * @return the number
+     */
+    public int getNumber() {
+        return this.number;
+    }
+
+    /**
+     * @param number the number to set
+     */
+    public void setNumber(final int number) {
+        this.number = number;
+    }
+
+    public Map getItems() {
+        return this.items;
+    }
+
+    public Collection getItemsValues() {
+        return this.items.values();
+    }
+
+    public Collection getItemsKeys() {
+        return this.items.keySet();
+    }
+
+    public void addItem( OrderItem item ) {
+        this.items.put( new Integer( item.getSeq() ), item );
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + this.number;
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final Order other = (Order) obj;
+        if ( this.number != other.number ) {
+            return false;
+        }
+        return true;
+    }
+
+    public String getCustomer() {
+        return customer;
+    }
+
+    public void setCustomer(String customer) {
+        this.customer = customer;
+    }
+
+    public String toString() {
+        return "Order( number="+this.getNumber()+" customer=\""+this.getCustomer()+"\" )";
+    }
+
+    public OrderStatus getStatus() {
+        if( status == null ) {
+            status = new OrderStatus();
+        }
+        return status;
+    }
+
+    public void setStatus(OrderStatus status) {
+        this.status = status;
+    }
+
+    public static class OrderStatus {
+        private boolean active;
+
+        public boolean isActive() {
+            return active;
+        }
+
+        public void setActive(boolean active) {
+            this.active = active;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Oct 17, 2007
+ */
+package org.drools;
+
+/**
+ * A simple order event POJO
+ * 
+ * @author etirelli
+ */
+public class OrderEvent {
+    
+    private String id;
+    private String customer;
+    private double total;
+    
+    public OrderEvent(String id,
+                      String customer,
+                      double total) {
+        super();
+        this.id = id;
+        this.customer = customer;
+        this.total = total;
+    }
+
+    public String getCustomer() {
+        return customer;
+    }
+
+    public void setCustomer(String customer) {
+        this.customer = customer;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public double getTotal() {
+        return total;
+    }
+
+    public void setTotal(double total) {
+        this.total = total;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderItem.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderItem.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OrderItem.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+/**
+ * @author etirelli
+ *
+ */
+public class OrderItem {
+    private int   seq;
+    private Order order;
+
+    public OrderItem() {
+        this( null,
+              0 );
+    }
+
+    public OrderItem(final Order order,
+                     final int seq) {
+        this.order = order;
+        this.seq = seq;
+    }
+
+    /**
+     * @return the order
+     */
+    public Order getOrder() {
+        return this.order;
+    }
+
+    /**
+     * @param order the order to set
+     */
+    public void setOrder(final Order order) {
+        this.order = order;
+    }
+
+    /**
+     * @return the seq
+     */
+    public int getSeq() {
+        return this.seq;
+    }
+
+    /**
+     * @param seq the seq to set
+     */
+    public void setSeq(final int seq) {
+        this.seq = seq;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((this.order == null) ? 0 : this.order.hashCode());
+        result = PRIME * result + this.seq;
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final OrderItem other = (OrderItem) obj;
+        if ( this.order == null ) {
+            if ( other.order != null ) {
+                return false;
+            }
+        } else if ( !this.order.equals( other.order ) ) {
+            return false;
+        }
+        if ( this.seq != other.seq ) {
+            return false;
+        }
+        return true;
+    }
+    
+    public String toString() {
+        return "OrderItem( order="+this.getOrder()+" seq="+this.getSeq()+")";
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OuterClass.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OuterClass.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/OuterClass.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools;
+
+public class OuterClass {
+    private String attr1;
+
+    public String getAttr1() {
+        return attr1;
+    }
+
+    public void setAttr1(String attr1) {
+        this.attr1 = attr1;
+    }
+
+    public static class InnerClass {
+        private int intAttr;
+
+        public InnerClass(int intAttr) {
+            super();
+            this.intAttr = intAttr;
+        }
+
+        public int getIntAttr() {
+            return intAttr;
+        }
+
+        public void setIntAttr(int intAttr) {
+            this.intAttr = intAttr;
+        }
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Parent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Parent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Parent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+/**
+ * @author etirelli
+ *
+ */
+public class Parent extends GrandParent {
+
+    public Parent() {
+    }
+
+    public Parent(final String name) {
+        super( name );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Person.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Person.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Person.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,243 @@
+package org.drools;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Person
+    implements
+    Serializable,
+    PersonInterface {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 400L;
+    private String            name;
+    private String            likes;
+    private int               age;
+    private BigDecimal        bigDecimal;
+    private BigInteger        bigInteger;
+    private String            hair;
+
+    private char              sex;
+
+    private boolean           alive;
+
+    private String            status;
+
+    private Cheese            cheese;
+
+    private List              addresses = new ArrayList();
+    
+    public List getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List addresses) {
+        this.addresses = addresses;
+    }
+
+    public Person() {
+
+    }
+
+    public Person(String name,
+                  int age) {
+        super();
+        this.name = name;
+        this.age = age;
+    }
+
+    public Person(final String name) {
+        this( name,
+              "",
+              0 );
+    }
+
+    public Person(final String name,
+                  final String likes) {
+        this( name,
+              likes,
+              0 );
+    }
+
+    public Person(final String name,
+                  final String likes,
+                  final int age) {
+        this.name = name;
+        this.likes = likes;
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getStatus()
+     */
+    public String getStatus() {
+        return this.status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setStatus(java.lang.String)
+     */
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getLikes()
+     */
+    public String getLikes() {
+        return this.likes;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getAge()
+     */
+    public int getAge() {
+        return this.age;
+    }
+
+    public void setAge(final int age) {
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#isAlive()
+     */
+    public boolean isAlive() {
+        return this.alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setAlive(boolean)
+     */
+    public void setAlive(final boolean alive) {
+        this.alive = alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getSex()
+     */
+    public char getSex() {
+        return this.sex;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setSex(char)
+     */
+    public void setSex(final char sex) {
+        this.sex = sex;
+    }
+
+    public String getHair() {
+        return this.hair;
+    }
+
+    public void setHair(final String hair) {
+        this.hair = hair;
+    }
+
+    public String toString() {
+        return "[Person name='" + this.name + "']";
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + this.age;
+        result = PRIME * result + (this.alive ? 1231 : 1237);
+        result = PRIME * result + ((this.name == null) ? 0 : this.name.hashCode());
+        result = PRIME * result + this.sex;
+        return result;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final Person other = (Person) obj;
+        if ( this.age != other.age ) {
+            return false;
+        }
+        if ( this.alive != other.alive ) {
+            return false;
+        }
+        if ( this.name == null ) {
+            if ( other.name != null ) {
+                return false;
+            }
+        } else if ( !this.name.equals( other.name ) ) {
+            return false;
+        }
+        if ( this.sex != other.sex ) {
+            return false;
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigDecimal()
+     */
+    public BigDecimal getBigDecimal() {
+        return this.bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigDecimal(java.math.BigDecimal)
+     */
+    public void setBigDecimal(final BigDecimal bigDecimal) {
+        this.bigDecimal = bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigInteger()
+     */
+    public BigInteger getBigInteger() {
+        return this.bigInteger;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigInteger(java.math.BigInteger)
+     */
+    public void setBigInteger(final BigInteger bigInteger) {
+        this.bigInteger = bigInteger;
+    }
+
+    public void setLikes(final String likes) {
+        this.likes = likes;
+    }
+
+    public Cheese getCheese() {
+        return this.cheese;
+    }
+
+    public void setCheese(final Cheese cheese) {
+        this.cheese = cheese;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonFinal.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonFinal.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonFinal.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+package org.drools;
+
+public final class PersonFinal extends Person {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonInterface.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonInterface.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonInterface.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface PersonInterface {
+
+    public abstract String getStatus();
+
+    public abstract void setStatus(String status);
+
+    public abstract String getLikes();
+
+    public abstract String getName();
+
+    public abstract int getAge();
+
+    public abstract boolean isAlive();
+
+    public abstract void setAlive(boolean alive);
+
+    public abstract char getSex();
+
+    public abstract void setSex(char sex);
+
+    public abstract BigDecimal getBigDecimal();
+
+    public abstract void setBigDecimal(BigDecimal bigDecimal);
+
+    public abstract BigInteger getBigInteger();
+
+    public abstract void setBigInteger(BigInteger bigInteger);
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonWithEquals.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonWithEquals.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PersonWithEquals.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+package org.drools;
+
+public class PersonWithEquals {
+    
+    private String name;
+    private int age;
+    
+    public PersonWithEquals() {
+    }
+    
+    public PersonWithEquals(String name,
+                            int age) {
+        super();
+        this.name = name;
+        this.age = age;
+    }
+    
+    public int getAge() {
+        return age;
+    }
+    
+    public void setAge(int age) {
+        this.age = age;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + age;
+        result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final PersonWithEquals other = (PersonWithEquals) obj;
+        if ( age != other.age ) return false;
+        if ( name == null ) {
+            if ( other.name != null ) return false;
+        } else if ( !name.equals( other.name ) ) return false;
+        return true;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PolymorphicFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PolymorphicFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/PolymorphicFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools;
+
+public class PolymorphicFact {
+    private Object data;
+
+    public PolymorphicFact() {
+        this( null );
+    }
+    
+    public PolymorphicFact(Object data) {
+        super();
+        this.data = data;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Precondition.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Precondition.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Precondition.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools;
+
+public class Precondition {
+    private String code;
+    private String value;
+
+    public Precondition() {
+
+    }
+
+    public Precondition(final String code,
+                        final String value) {
+        super();
+        this.code = code;
+        this.value = value;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+
+    public void setValue(final String value) {
+        this.value = value;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public void setCode(final String code) {
+        this.code = code;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Primitives.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Primitives.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Primitives.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,158 @@
+package org.drools;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Primitives {
+    private boolean  booleanPrimitive;
+
+    private char     charPrimitive;
+
+    private byte     bytePrimitive;
+    private short    shortPrimitive;
+    private int      intPrimitive;
+    private long     longPrimitive;
+
+    private float    floatPrimitive;
+    private float    doublePrimitive;
+    private String   stringAttribute;
+    private Object[] arrayAttribute;
+    private int[]    primitiveArrayAttribute;
+    private String[] stringArray;
+    
+    private Boolean  booleanWrapper;
+    
+    private Object   object;
+
+    public boolean isBooleanPrimitive() {
+        return this.booleanPrimitive;
+    }
+
+    public void setBooleanPrimitive(final boolean booleanPrimitive) {
+        this.booleanPrimitive = booleanPrimitive;
+    }
+
+    public byte getBytePrimitive() {
+        return this.bytePrimitive;
+    }
+
+    public void setBytePrimitive(final byte bytePrimitive) {
+        this.bytePrimitive = bytePrimitive;
+    }
+
+    public char getCharPrimitive() {
+        return this.charPrimitive;
+    }
+
+    public void setCharPrimitive(final char charPrimitive) {
+        this.charPrimitive = charPrimitive;
+    }
+
+    public float getDoublePrimitive() {
+        return this.doublePrimitive;
+    }
+
+    public void setDoublePrimitive(final float doublePrimitive) {
+        this.doublePrimitive = doublePrimitive;
+    }
+
+    public float getFloatPrimitive() {
+        return this.floatPrimitive;
+    }
+
+    public void setFloatPrimitive(final float floatPrimitive) {
+        this.floatPrimitive = floatPrimitive;
+    }
+
+    public int getIntPrimitive() {
+        return this.intPrimitive;
+    }
+
+    public void setIntPrimitive(final int intPrimitive) {
+        this.intPrimitive = intPrimitive;
+    }
+
+    public long getLongPrimitive() {
+        return this.longPrimitive;
+    }
+
+    public void setLongPrimitive(final long longPrimitive) {
+        this.longPrimitive = longPrimitive;
+    }
+
+    public short getShortPrimitive() {
+        return this.shortPrimitive;
+    }
+
+    public void setShortPrimitive(final short shortPrimitive) {
+        this.shortPrimitive = shortPrimitive;
+    }
+
+    public Object[] getArrayAttribute() {
+        return this.arrayAttribute;
+    }
+
+    public void setArrayAttribute(final Object[] arrayAttribute) {
+        this.arrayAttribute = arrayAttribute;
+    }
+
+    /**
+     * @return the primitiveArrayAttribute
+     */
+    public int[] getPrimitiveArrayAttribute() {
+        return this.primitiveArrayAttribute;
+    }
+
+    /**
+     * @param primitiveArrayAttribute the primitiveArrayAttribute to set
+     */
+    public void setPrimitiveArrayAttribute(final int[] primitiveArrayAttribute) {
+        this.primitiveArrayAttribute = primitiveArrayAttribute;
+    }
+
+    public String[] getStringArray() {
+        return stringArray;
+    }
+
+    public void setStringArray(String[] stringArray) {
+        this.stringArray = stringArray;
+    }
+
+    public String getStringAttribute() {
+        return stringAttribute;
+    }
+
+    public void setStringAttribute(String stringAttribute) {
+        this.stringAttribute = stringAttribute;
+    }
+
+    public Boolean getBooleanWrapper() {
+        return booleanWrapper;
+    }
+
+    public void setBooleanWrapper(Boolean booleanWrapper) {
+        this.booleanWrapper = booleanWrapper;
+    }
+
+    public Object getObject() {
+        return object;
+    }
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Process.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Process.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Process.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+/**
+ * @author etirelli
+ *
+ */
+public class Process {
+    private String name;
+
+    public Process() {
+    }
+
+    public Process(final String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Query.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Query.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Query.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools;
+
+public class Query {
+    public Query(String pattern, String column) {
+
+    } 
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/RandomNumber.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/RandomNumber.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/RandomNumber.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools;
+
+import java.util.Random;
+
+public class RandomNumber {
+    private int randomNumber;
+
+    public void begin() {
+        this.randomNumber = new Random().nextInt( 100 );
+    }
+
+    public void setValue(final int value) {
+        this.randomNumber = value;
+    }
+
+    public int getValue() {
+        return this.randomNumber;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Results.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Results.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Results.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools;
+
+public class Results {
+    public int getResultsCount() {
+        return 1;
+    } 
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SecondClass.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SecondClass.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SecondClass.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,61 @@
+package org.drools;
+
+public class SecondClass {
+    private String item1;
+    private String item2;
+    private String item3;
+    private String item4;
+    private String item5;
+    
+    public SecondClass() {
+    }
+    
+    public SecondClass(String item1,
+                      String item2,
+                      String item3,
+                      String item4,
+                      String item5) {
+        super();
+        this.item1 = item1;
+        this.item2 = item2;
+        this.item3 = item3;
+        this.item4 = item4;
+        this.item5 = item5;
+    }
+    public String getItem1() {
+        return item1;
+    }
+    public void setItem1(String item1) {
+        this.item1 = item1;
+    }
+    public String getItem2() {
+        return item2;
+    }
+    public void setItem2(String item2) {
+        this.item2 = item2;
+    }
+    public String getItem3() {
+        return item3;
+    }
+    public void setItem3(String item3) {
+        this.item3 = item3;
+    }
+    public String getItem4() {
+        return item4;
+    }
+    public void setItem4(String item4) {
+        this.item4 = item4;
+    }
+    public String getItem5() {
+        return item5;
+    }
+    public void setItem5(String item5) {
+        this.item5 = item5;
+    }
+
+    public static class AlternativeKey {
+        
+    }
+
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Sensor.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Sensor.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Sensor.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,49 @@
+package org.drools;
+
+public class Sensor {
+    private int temperature;
+    private int pressure;
+
+    public Sensor() {
+
+    }
+
+    public Sensor(final int temp,
+                  final int press) {
+        this.temperature = temp;
+        this.pressure = press;
+    }
+
+    /**
+     * @return the pressure
+     */
+    public int getPressure() {
+        return this.pressure;
+    }
+
+    /**
+     * @param pressure the pressure to set
+     */
+    public void setPressure(final int pressure) {
+        this.pressure = pressure;
+    }
+
+    /**
+     * @return the temperature
+     */
+    public int getTemperature() {
+        return this.temperature;
+    }
+
+    /**
+     * @param temperature the temperature to set
+     */
+    public void setTemperature(final int temperature) {
+        this.temperature = temperature;
+    }
+
+    public String toString() {
+        return "Sensor [ temperature = " + this.temperature + ", pressure = " + this.pressure + " ]";
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SpecialString.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SpecialString.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/SpecialString.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+public class SpecialString {
+    private String text;
+
+    public SpecialString(String text) {
+        this.text = text;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public String toString() {
+        return (getText() + "[" + super.toString() + "]");
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/State.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/State.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/State.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,51 @@
+package org.drools;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+public class State {
+    private final PropertyChangeSupport changes = new PropertyChangeSupport( this );
+
+    private String                      state;
+    private boolean                     flag;
+
+    public State() {
+
+    }
+
+    public State(final String state) {
+        this.state = state;
+    }
+
+    public String getState() {
+        return this.state;
+    }
+
+    public void setState(final String newState) {
+        final String oldState = this.state;
+        this.state = newState;
+        this.changes.firePropertyChange( "state",
+                                         oldState,
+                                         newState );
+    }
+
+    public void addPropertyChangeListener(final PropertyChangeListener l) {
+        this.changes.addPropertyChangeListener( l );
+    }
+
+    public void removePropertyChangeListener(final PropertyChangeListener l) {
+        this.changes.removePropertyChangeListener( l );
+    }
+
+    public boolean isFlag() {
+        return this.flag;
+    }
+
+    public void setFlag(final boolean flag) {
+        final boolean old = this.flag;
+        this.flag = flag;
+        this.changes.firePropertyChange( "flag",
+                                         old,
+                                         flag );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+public class StaticMethods {
+
+    public static String getString1(final String string) {
+        return string;
+    }
+
+    public static String getString2(final String string) {
+        return string;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods2.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods2.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StaticMethods2.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools;
+
+public class StaticMethods2 {
+    public static String getString3(final String string,
+                                    final Integer integer) {
+        return string + integer;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StockTick.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StockTick.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/StockTick.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,80 @@
+package org.drools;
+
+public class StockTick {
+    private long seq;
+    private String company;
+    private double price;
+    private long time;
+    private long duration;
+    
+    public StockTick() {
+    }
+
+    public StockTick(long seq,
+                     String company,
+                     double price,
+                     long time) {
+        super();
+        this.seq = seq;
+        this.company = company;
+        this.price = price;
+        this.time = time;
+    }
+
+    public StockTick(long seq,
+                     String company,
+                     double price,
+                     long time, 
+                     long duration ) {
+        super();
+        this.seq = seq;
+        this.company = company;
+        this.price = price;
+        this.time = time;
+        this.duration = duration;
+    }
+
+    public String getCompany() {
+        return company;
+    }
+    public void setCompany(String company) {
+        this.company = company;
+    }
+    public double getPrice() {
+        return price;
+    }
+    public void setPrice(double price) {
+        this.price = price;
+    }
+    public long getSeq() {
+        return seq;
+    }
+    public void setSeq(long seq) {
+        this.seq = seq;
+    }
+    public long getTime() {
+        return time;
+    }
+    public void setTime(long time) {
+        this.time = time;
+    }
+    
+    public String toString() {
+        return "StockTick( "+this.seq+" : " +this.company +" : "+ this.price +" )";
+    }
+
+    /**
+     * @return the duration
+     */
+    public long getDuration() {
+        return duration;
+    }
+
+    /**
+     * @param duration the duration to set
+     */
+    public void setDuration(long duration) {
+        this.duration = duration;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Storage.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Storage.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Storage.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools;
+
+public class Storage {
+    public Results search(Query query) {
+        return new Results();
+    } 
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Target.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Target.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/Target.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,63 @@
+package org.drools;
+
+public class Target {
+
+    public String label;
+    public Float  lat;
+    public Float  lon;
+    public Float  course;
+    public Float  speed;
+    public Float  time;
+
+    public Float getCourse() {
+        return this.course;
+    }
+
+    public void setCourse(final Float course) {
+        this.course = course;
+    }
+
+    public String getLabel() {
+        return this.label;
+    }
+
+    public void setLabel(final String label) {
+        this.label = label;
+    }
+
+    public Float getLat() {
+        return this.lat;
+    }
+
+    public void setLat(final Float lat) {
+        this.lat = lat;
+    }
+
+    public Float getLon() {
+        return this.lon;
+    }
+
+    public void setLon(final Float lon) {
+        this.lon = lon;
+    }
+
+    public Float getSpeed() {
+        return this.speed;
+    }
+
+    public void setSpeed(final Float speed) {
+        this.speed = speed;
+    }
+
+    public Float getTime() {
+        return this.time;
+    }
+
+    public void setTime(final Float time) {
+        this.time = time;
+    }
+
+    public String toString() {
+        return "Target< label: " + this.label + " lat: " + this.lat + " lon: " + this.lon + " course: " + this.course + " speed: " + this.speed + " time: " + this.time + ">";
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/TestParam.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/TestParam.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/TestParam.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools;
+
+public class TestParam {
+
+    private String value1;
+    private String value2;
+
+    public String getValue1() {
+        return this.value1;
+    }
+
+    public void setValue1(final String value1) {
+        this.value1 = value1;
+    }
+
+    public String getValue2() {
+        return this.value2;
+    }
+
+    public void setValue2(final String value2) {
+        this.value2 = value2;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELActivity.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELActivity.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELActivity.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.bpel.core;
+
+import org.drools.workflow.core.Node;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface BPELActivity extends Node {
+
+    String[] getSourceLinks();
+    
+    void setSourceLinks(String[] sourceLinks);
+    
+    String[] getTargetLinks();
+    
+    void setTargetLinks(String[] targetLinks);
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELAssign.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELAssign.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELAssign.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.bpel.core;
+
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.node.ActionNode;
+
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELAssign extends ActionNode implements BPELBasicActivity {
+
+    private static final long serialVersionUID = 400L;
+    
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    public void setAction(String assign) {
+        setAction(new DroolsConsequenceAction("mvel", assign));
+    }
+
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELBasicActivity.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELBasicActivity.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELBasicActivity.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.bpel.core;
+
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface BPELBasicActivity extends BPELActivity {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFaultHandlerContainer.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFaultHandlerContainer.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFaultHandlerContainer.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.bpel.core;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface BPELFaultHandlerContainer {
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFlow.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFlow.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELFlow.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,93 @@
+package org.drools.bpel.core;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.drools.workflow.core.node.CompositeNode;
+import org.drools.workflow.core.node.Join;
+import org.drools.workflow.core.node.Split;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELFlow extends CompositeNode implements BPELStructuredActivity {
+    
+    private static final long serialVersionUID = 400L;
+    
+    private Split split;
+    private Join join;
+    private String[] links;
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    public BPELFlow() {
+        split = new Split();
+        split.setType(Split.TYPE_AND);
+        addNode(split);
+        join = new Join();
+        join.setType(Join.TYPE_AND);
+        addNode(join);
+        linkIncomingConnections(
+            Node.CONNECTION_DEFAULT_TYPE,
+            new CompositeNode.NodeAndType(
+                split, Node.CONNECTION_DEFAULT_TYPE));
+        linkOutgoingConnections(
+            new CompositeNode.NodeAndType(
+                join, Node.CONNECTION_DEFAULT_TYPE),
+            Node.CONNECTION_DEFAULT_TYPE);
+    }
+    
+    public void setName(String name) {
+        super.setName(name);
+        split.setName(name + " split");
+        join.setName(name + " join");
+    }
+    
+    public void setActivities(List<BPELActivity> activities) {
+        if (activities == null || activities.size() < 2) {
+            throw new IllegalArgumentException(
+                "A BPEL flow must contain at least two sub activities!");
+        }
+        for (Iterator<BPELActivity> iterator = activities.iterator(); iterator.hasNext(); ) {
+            addActivity(iterator.next());
+        }
+    }
+    
+    private void addActivity(BPELActivity activity) {
+        addNode(activity);
+        new ConnectionImpl(
+            split, Node.CONNECTION_DEFAULT_TYPE,
+            activity, Node.CONNECTION_DEFAULT_TYPE);
+        new ConnectionImpl(
+            activity, Node.CONNECTION_DEFAULT_TYPE,
+            join, Node.CONNECTION_DEFAULT_TYPE);
+    }
+
+    public void setLinks(String[] links) {
+        this.links = links;
+    }
+    
+    public String[] getLinks() {
+        return links;
+    }
+    
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELInvoke.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELInvoke.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELInvoke.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,86 @@
+package org.drools.bpel.core;
+
+import org.drools.process.core.Work;
+import org.drools.process.core.impl.WorkImpl;
+import org.drools.workflow.core.node.WorkItemNode;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELInvoke extends WorkItemNode implements BPELBasicActivity, BPELFaultHandlerContainer {
+
+    private static final long serialVersionUID = 400L;
+    
+    private static final String PARTNER_LINK = "PartnerLink";
+    private static final String PORT_TYPE = "PortType";
+    private static final String OPERATION = "Operation";
+    private static final String INPUT = "Message";
+    private static final String OUTPUT = "Result";
+    
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    public BPELInvoke() {
+        Work work = new WorkImpl();
+        work.setName("WebServiceInvocation");
+        setWork(work);
+    }
+    
+    public String getPartnerLink() {
+        return (String) getWork().getParameter(PARTNER_LINK);
+    }
+
+    public void setPartnerLink(String partnerLink) {
+        getWork().setParameter(PARTNER_LINK, partnerLink);
+    }
+
+    public String getPortType() {
+        return (String) getWork().getParameter(PORT_TYPE);
+    }
+
+    public void setPortType(String porttype) {
+        getWork().setParameter(PORT_TYPE, porttype);
+    }
+
+    public String getOperation() {
+        return (String) getWork().getParameter(OPERATION);
+    }
+
+    public void setOperation(String operation) {
+        getWork().setParameter(OPERATION, operation);
+    }
+
+    public String getInputVariable() {
+        return getInMapping(INPUT);
+    }
+
+    public void setInputVariable(String inputVariable) {
+        addInMapping(INPUT, inputVariable);
+    }
+
+    public String getOutputVariable() {
+        return getOutMapping(OUTPUT);
+    }
+
+    public void setOutputVariable(String outputVariable) {
+        addOutMapping(OUTPUT, outputVariable);
+    }
+
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELProcess.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELProcess.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELProcess.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.bpel.core;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.EndNode;
+
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELProcess extends WorkflowProcessImpl implements BPELFaultHandlerContainer {
+
+    private static final long serialVersionUID = 400L;
+    
+    public static final String BPEL_TYPE = "BPEL";
+    
+    public BPELProcess() {
+        setType(BPEL_TYPE);
+    }
+    
+    public void setActivity(BPELActivity activity) {
+        if (activity == null) {
+            throw new IllegalArgumentException(
+                "The activity of a BPEL process may not be null!");
+        }
+        if (getActivity() != null) {
+            throw new IllegalArgumentException(
+                "The activity of this BPEL process has already been set!");
+        }
+        addNode(activity);
+        EndNode end = new EndNode();
+        addNode(end);
+        new ConnectionImpl(
+            activity, Node.CONNECTION_DEFAULT_TYPE,
+            end, Node.CONNECTION_DEFAULT_TYPE);
+    }
+    
+    public BPELActivity getActivity() {
+        Node[] nodes = getNodes();
+        if (nodes == null || nodes.length == 0) {
+            return null;
+        }
+        return (BPELActivity) nodes[0];
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReceive.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReceive.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReceive.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,94 @@
+package org.drools.bpel.core;
+
+import java.util.List;
+
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.NodeImpl;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELReceive extends NodeImpl implements BPELBasicActivity {
+
+    private static final long serialVersionUID = 400L;
+
+    private String partnerLink;
+    private String portType;
+    private String operation;
+    private String variable;
+    private boolean createInstance;
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    
+    public BPELReceive() {
+    }
+    
+    public String getPartnerLink() {
+        return partnerLink;
+    }
+
+    public void setPartnerLink(String partnerLink) {
+        this.partnerLink = partnerLink;
+    }
+
+    public String getPortType() {
+        return portType;
+    }
+
+    public void setPortType(String portType) {
+        this.portType = portType;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+
+    public String getVariable() {
+        return variable;
+    }
+
+    public void setVariable(String variable) {
+        this.variable = variable;
+    }
+
+    public boolean isCreateInstance() {
+        return createInstance;
+    }
+    
+    public void setCreateInstance(boolean createInstance) {
+        this.createInstance = createInstance;
+    }
+
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+    public Connection getTo() {
+        final List<Connection> list =
+            getOutgoingConnections(Node.CONNECTION_DEFAULT_TYPE);
+        if (list.size() > 0) {
+            return (Connection) list.get(0);
+        }
+        return null;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReply.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReply.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELReply.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+package org.drools.bpel.core;
+
+import org.drools.process.core.Work;
+import org.drools.process.core.impl.WorkImpl;
+import org.drools.workflow.core.node.WorkItemNode;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELReply extends WorkItemNode implements BPELBasicActivity {
+
+    private static final long serialVersionUID = 400L;
+    
+    private static final String PARTNER_LINK = "PartnerLink";
+    private static final String PORT_TYPE = "Porttype";
+    private static final String OPERATION = "Operation";
+    private static final String INPUT = "Message";
+    
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    public BPELReply() {
+        // TODO: a reply is not a simple web service invocation
+        Work work = new WorkImpl();
+        work.setName("WebServiceInvocation");
+        setWork(work);
+    }
+    
+    public String getPartnerLink() {
+        return (String) getWork().getParameter(PARTNER_LINK);
+    }
+
+    public void setPartnerLink(String partnerLink) {
+        getWork().setParameter(PARTNER_LINK, partnerLink);
+    }
+
+    public String getPortType() {
+        return (String) getWork().getParameter(PORT_TYPE);
+    }
+
+    public void setPortType(String porttype) {
+        getWork().setParameter(PORT_TYPE, porttype);
+    }
+
+    public String getOperation() {
+        return (String) getWork().getParameter(OPERATION);
+    }
+
+    public void setOperation(String operation) {
+        getWork().setParameter(OPERATION, operation);
+    }
+
+    public String getVariable() {
+        return getInMapping(INPUT);
+    }
+
+    public void setVariable(String variable) {
+        addInMapping(INPUT, variable);
+    }
+
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELScope.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELScope.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELScope.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,42 @@
+package org.drools.bpel.core;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.CompositeNode;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELScope extends CompositeNode implements BPELActivity, BPELFaultHandlerContainer {
+
+    private static final long serialVersionUID = 400L;
+
+    public void setActivity(BPELActivity activity) {
+        addNode(activity);
+        linkIncomingConnections(
+            Node.CONNECTION_DEFAULT_TYPE,
+            new CompositeNode.NodeAndType(
+                activity, Node.CONNECTION_DEFAULT_TYPE));
+        linkOutgoingConnections(
+            new CompositeNode.NodeAndType(
+                activity, Node.CONNECTION_DEFAULT_TYPE),
+            Node.CONNECTION_DEFAULT_TYPE);
+    }
+
+    public String[] getSourceLinks() {
+        throw new IllegalArgumentException("A scope does not support links!");
+    }
+
+    public String[] getTargetLinks() {
+        throw new IllegalArgumentException("A scope does not support links!");
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        throw new IllegalArgumentException("A scope does not support links!");
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        throw new IllegalArgumentException("A scope does not support links!");
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELSequence.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELSequence.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELSequence.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,61 @@
+package org.drools.bpel.core;
+
+import java.util.List;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.drools.workflow.core.node.CompositeNode;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELSequence extends CompositeNode implements BPELStructuredActivity {
+    
+    private static final long serialVersionUID = 400L;
+
+    private String[] sourceLinks;
+    private String[] targetLinks;
+    
+    public void setActivities(List<BPELActivity> activities) {
+        if (activities == null || activities.size() < 2) {
+            throw new IllegalArgumentException(
+                "A BPEL sequence must contain at least two sub activities!");
+        }
+        BPELActivity previous = activities.get(0);
+        addNode(previous);
+        linkIncomingConnections(
+            Node.CONNECTION_DEFAULT_TYPE,
+            new CompositeNode.NodeAndType(
+                    previous, Node.CONNECTION_DEFAULT_TYPE));
+        for (int i = 1; i < activities.size(); i++ ) {
+            BPELActivity next = activities.get(i);
+            addNode(next);
+            new ConnectionImpl(
+                previous, Node.CONNECTION_DEFAULT_TYPE,
+                next, Node.CONNECTION_DEFAULT_TYPE);
+            previous = next;
+        }
+        linkOutgoingConnections(
+            new CompositeNode.NodeAndType(
+                previous, Node.CONNECTION_DEFAULT_TYPE),
+            Node.CONNECTION_DEFAULT_TYPE);
+    }
+    
+    public String[] getSourceLinks() {
+        return sourceLinks;
+    }
+
+    public void setSourceLinks(String[] sourceLinks) {
+        this.sourceLinks = sourceLinks;
+    }
+
+    public String[] getTargetLinks() {
+        return targetLinks;
+    }
+
+    public void setTargetLinks(String[] targetLinks) {
+        this.targetLinks = targetLinks;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELStructuredActivity.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELStructuredActivity.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/core/BPELStructuredActivity.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.bpel.core;
+
+import java.util.List;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface BPELStructuredActivity extends BPELActivity {
+    
+    void setActivities(List<BPELActivity> activities);
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELAssignInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELAssignInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELAssignInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.bpel.instance;
+
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.ActionNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELAssignInstance extends ActionNodeInstance {
+    
+    private static final long serialVersionUID = 400L;
+
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted() {
+        super.triggerCompleted();
+        BPELLinkManager.activateTargetLinks(this);
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELFlowInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELFlowInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELFlowInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.bpel.instance;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.bpel.core.BPELFlow;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.CompositeNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELFlowInstance extends CompositeNodeInstance {
+
+    private static final long serialVersionUID = 400L;
+    
+    private List<String> activatedLinks = new ArrayList<String>();
+    private Map<String, NodeInstance> waitingActivityInstances = new HashMap<String, NodeInstance>();
+    
+    public BPELFlow getBPELFlow() {
+        return (BPELFlow) getNode();
+    }
+    
+    public void activateLink(String linkName) {
+        activatedLinks.add(linkName);
+        NodeInstance waitingActivityInstance = waitingActivityInstances.get(linkName);
+        if (waitingActivityInstance != null) {
+            waitingActivityInstance.trigger(null, null);
+        }
+    }
+    
+    public void addWaitingActivityInstance(NodeInstance nodeInstance, String linkName) {
+        waitingActivityInstances.put(linkName, nodeInstance);
+    }
+    
+    public boolean isLinkActive(String linkName) {
+        return activatedLinks.contains(linkName);
+    }
+    
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted(String outType) {
+        super.triggerCompleted(outType);
+        BPELLinkManager.activateTargetLinks(this);
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELActivity;
+import org.drools.process.instance.WorkItem;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.WorkItemNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELInvokeInstance extends WorkItemNodeInstance {
+    
+    private static final long serialVersionUID = 400L;
+
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted(WorkItem workItem) {
+        String faultName = (String) workItem.getResult("FaultName");
+        if (faultName == null) {
+            super.triggerCompleted(workItem);
+            BPELLinkManager.activateTargetLinks(this);
+        } else {
+            String faultMessage = (String) workItem.getResult("Message");
+            getFaultHandler(faultName, faultMessage);
+        }
+    }
+    
+    private BPELActivity getFaultHandler(String faultName, String faultMessage) {
+        // TODO check activity itself for fault handler
+//        NodeInstanceContainer parent = getNodeInstanceContainer();
+//        while (!(parent instanceof BPELFaultHandlerContainer)
+//                || ((BPELFaultHandlerContainer) parent).get)) {
+//             parent = ((NodeInstance) parent).getNodeInstanceContainer();     
+//        }
+        return null;
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELLinkManager.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELLinkManager.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELLinkManager.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,64 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELActivity;
+import org.drools.util.ArrayUtils;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.NodeInstanceContainer;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public final class BPELLinkManager {
+    
+    private BPELLinkManager() {
+    }
+    
+    private static String[] getSourceLinks(NodeInstance activityInstance) {
+        return ((BPELActivity) 
+            ((NodeInstanceImpl) activityInstance).getNode())
+                .getSourceLinks();
+    }
+    
+    private static String[] getTargetLinks(NodeInstance activityInstance) {
+        return ((BPELActivity) 
+            ((NodeInstanceImpl) activityInstance).getNode())
+                .getTargetLinks();
+    }
+    
+    public static boolean checkActivityEnabled(NodeInstance activityInstance) {
+        boolean enabled = true;
+        String[] incomingLinks = getTargetLinks(activityInstance);
+        if (incomingLinks != null) {
+            for (int i = 0; i < incomingLinks.length; i++) {
+                BPELFlowInstance flowInstance = getFlowInstance(activityInstance, incomingLinks[i]);
+                if (!flowInstance.isLinkActive(incomingLinks[i])) {
+                    enabled = false;
+                    flowInstance.addWaitingActivityInstance(activityInstance, incomingLinks[i]);
+                }
+            }
+        }
+        return enabled;
+    }
+    
+    public static void activateTargetLinks(NodeInstance activityInstance) {
+        String[] outgoingLinks = getSourceLinks(activityInstance);
+        if (outgoingLinks != null) {
+            for (int i = 0; i < outgoingLinks.length; i++) {
+                BPELFlowInstance flowInstance = getFlowInstance(activityInstance, outgoingLinks[i]);
+                flowInstance.activateLink(outgoingLinks[i]);
+            }
+        }
+    }
+
+    private static BPELFlowInstance getFlowInstance(NodeInstance activityInstance, String linkName) {
+        NodeInstanceContainer parent = activityInstance.getNodeInstanceContainer();
+        while (!(parent instanceof BPELFlowInstance)
+                || !ArrayUtils.contains(((BPELFlowInstance) parent).getBPELFlow().getLinks(), linkName)) {
+             parent = ((NodeInstance) parent).getNodeInstanceContainer();     
+        }
+        return (BPELFlowInstance) parent;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELNodeInstanceFactoryRegistry.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELNodeInstanceFactoryRegistry.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELNodeInstanceFactoryRegistry.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELAssign;
+import org.drools.bpel.core.BPELFlow;
+import org.drools.bpel.core.BPELInvoke;
+import org.drools.bpel.core.BPELReceive;
+import org.drools.bpel.core.BPELReply;
+import org.drools.bpel.core.BPELScope;
+import org.drools.bpel.core.BPELSequence;
+import org.drools.workflow.instance.impl.NodeInstanceFactoryRegistry;
+import org.drools.workflow.instance.impl.factory.CreateNewNodeFactory;
+
+public class BPELNodeInstanceFactoryRegistry extends NodeInstanceFactoryRegistry {
+    
+    public BPELNodeInstanceFactoryRegistry() {
+        register( BPELAssign.class,
+                  new CreateNewNodeFactory( BPELAssignInstance.class ) );
+        register( BPELFlow.class,
+                  new CreateNewNodeFactory( BPELFlowInstance.class ) );
+        register( BPELInvoke.class,
+                  new CreateNewNodeFactory( BPELInvokeInstance.class ) );
+        register( BPELReceive.class,
+                  new CreateNewNodeFactory( BPELReceiveInstance.class ) );
+        register( BPELReply.class,
+                  new CreateNewNodeFactory( BPELReplyInstance.class ) );
+        register( BPELScope.class,
+                  new CreateNewNodeFactory( BPELScopeInstance.class ) );
+        register( BPELSequence.class,
+                  new CreateNewNodeFactory( BPELSequenceInstance.class ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.bpel.instance;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.bpel.core.BPELActivity;
+import org.drools.bpel.core.BPELProcess;
+import org.drools.bpel.core.BPELReceive;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.NodeContainer;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.NodeInstanceContainer;
+import org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELProcessInstance extends WorkflowProcessInstanceImpl {
+    
+    private static final long serialVersionUID = 400L;
+
+    public BPELProcess getBPELProcess() {
+        return (BPELProcess) getProcess();
+    }
+    
+    public void acceptMessage(String partnerLink, String portType, String operation, String message) {
+        if (getState() == STATE_PENDING) {
+            setState(STATE_ACTIVE);
+        }
+        BPELReceive receive = findBPELReceive(partnerLink, portType, operation);
+        if (receive == null) {
+            throw new IllegalArgumentException(
+                "Could not find BPELReceive for " + partnerLink + ", " + portType + ", " + operation);
+        }
+        BPELActivity activity = receive;
+        List<BPELActivity> parents = new ArrayList<BPELActivity>(); 
+        while (!activity.getNodeContainer().equals(getBPELProcess())) {
+            activity = (BPELActivity) activity.getNodeContainer();
+            parents.add(0, activity);
+        }
+        NodeInstanceContainer nodeInstanceContainer = this;
+        for (Iterator<BPELActivity> iterator = parents.iterator(); iterator.hasNext(); ) {
+            BPELActivity parent = iterator.next();
+            NodeInstance nodeInstance = nodeInstanceContainer.getFirstNodeInstance(parent.getId());
+            if (nodeInstance != null) {
+                nodeInstanceContainer = (NodeInstanceContainer) nodeInstance;
+            } else if (receive.isCreateInstance()) {
+                nodeInstanceContainer = (NodeInstanceContainer) nodeInstanceContainer.getNodeInstance(parent);
+            } else {
+                // TODO: store message in cache of accepted messages
+                return;
+            }
+        }
+        ((BPELReceiveInstance) nodeInstanceContainer.getNodeInstance(receive)).triggerCompleted(message);
+    }
+    
+    private BPELReceive findBPELReceive(String partnerLink, String portType, String operation) {
+        return findBPELReceive(partnerLink, portType, operation, getBPELProcess().getActivity());
+    }
+    
+    private BPELReceive findBPELReceive(String partnerLink, String portType, String operation, Node node) {
+        if (node instanceof BPELReceive) {
+            BPELReceive receive = (BPELReceive) node;
+            if (receive.getPartnerLink().equals(partnerLink)
+                    && receive.getPortType().equals(portType)
+                    && receive.getOperation().equals(operation)) {
+                return receive;
+            }
+            return null;
+        }
+        if (node instanceof NodeContainer) {
+            Node[] nodes = ((NodeContainer) node).getNodes();
+            for (int i = 0; i < nodes.length; i++) {
+                BPELReceive result = findBPELReceive(partnerLink, portType, operation, nodes[i]);
+                if (result != null) {
+                    return result;
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    protected void internalStart() {
+        // do nothing, BPEL Processes are started by receiving a message
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstanceFactory.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstanceFactory.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELProcessInstanceFactory.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.bpel.instance;
+
+import java.io.Serializable;
+
+import org.drools.process.instance.ProcessInstance;
+import org.drools.process.instance.ProcessInstanceFactory;
+
+public class BPELProcessInstanceFactory implements ProcessInstanceFactory, Serializable {
+
+    private static final long serialVersionUID = 400L;
+
+    public ProcessInstance createProcessInstance() {
+        return new BPELProcessInstance();
+    }
+    
+    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELReceive;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELReceiveInstance extends NodeInstanceImpl {
+
+    private static final long serialVersionUID = 400L;
+
+    public BPELReceive getBPELReceive() {
+        return (BPELReceive) getNode();
+    }
+    
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            // TODO look in cache of already receive messages
+        }
+    }
+    
+    public void triggerCompleted(String message) {
+        String variable = getBPELReceive().getVariable();
+        if (variable != null) {
+            getProcessInstance().setVariable(variable, message);
+        }
+        Connection to = getBPELReceive().getTo();
+        getNodeInstanceContainer().removeNodeInstance(this);
+        getNodeInstanceContainer().getNodeInstance( to.getTo() ).trigger( this, to.getToType());
+        BPELLinkManager.activateTargetLinks(this);
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReplyInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReplyInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELReplyInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools.bpel.instance;
+
+import org.drools.process.instance.WorkItem;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.WorkItemNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELReplyInstance extends WorkItemNodeInstance {
+
+    private static final long serialVersionUID = 400L;
+
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted(WorkItem workItem) {
+        super.triggerCompleted(workItem);
+        BPELLinkManager.activateTargetLinks(this);
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELScopeInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELScopeInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELScopeInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.bpel.instance;
+
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.CompositeNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELScopeInstance extends CompositeNodeInstance {
+
+    private static final long serialVersionUID = 400L;
+
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted(String outType) {
+        super.triggerCompleted(outType);
+        BPELLinkManager.activateTargetLinks(this);
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELSequenceInstance.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELSequenceInstance.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/instance/BPELSequenceInstance.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.bpel.instance;
+
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.node.CompositeNodeInstance;
+
+/**
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELSequenceInstance extends CompositeNodeInstance {
+
+    private static final long serialVersionUID = 400L;
+
+    public void internalTrigger(NodeInstance from, String type) {
+        if (BPELLinkManager.checkActivityEnabled(this)) {
+            super.internalTrigger(from, type);
+        }
+    }
+    
+    public void triggerCompleted(String outType) {
+        super.triggerCompleted(outType);
+        BPELLinkManager.activateTargetLinks(this);
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/test/BPELTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/test/BPELTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/bpel/test/BPELTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,350 @@
+package org.drools.bpel.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.audit.WorkingMemoryFileLogger;
+import org.drools.bpel.core.BPELActivity;
+import org.drools.bpel.core.BPELAssign;
+import org.drools.bpel.core.BPELFlow;
+import org.drools.bpel.core.BPELInvoke;
+import org.drools.bpel.core.BPELProcess;
+import org.drools.bpel.core.BPELReceive;
+import org.drools.bpel.core.BPELReply;
+import org.drools.bpel.core.BPELSequence;
+import org.drools.bpel.instance.BPELProcessInstance;
+import org.drools.bpel.instance.BPELProcessInstanceFactory;
+import org.drools.common.AbstractRuleBase;
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ProcessBuilder;
+import org.drools.process.instance.WorkItem;
+import org.drools.process.instance.WorkItemHandler;
+import org.drools.process.instance.WorkItemManager;
+import org.drools.reteoo.ReteooWorkingMemory;
+
+public class BPELTest {
+
+    public static void main1(String[] args) {
+        BPELProcess process = new BPELProcess();
+        process.setName("TestProcess");
+        process.setId("1");
+        
+        // flow
+        BPELFlow flow = new BPELFlow();
+        flow.setName("flow");
+        process.setActivity(flow);
+        List<BPELActivity> flowActivities = new ArrayList<BPELActivity>();
+        
+        // invoke1
+        BPELInvoke invoke1 = new BPELInvoke();
+        invoke1.setName("invoke1");
+        flowActivities.add(invoke1);
+        
+        // invoke2
+        BPELInvoke invoke2 = new BPELInvoke();
+        invoke2.setName("invoke2");
+        flowActivities.add(invoke2);
+        
+        flow.setActivities(flowActivities);
+        
+        // execute
+        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, (InternalRuleBase) RuleBaseFactory.newRuleBase());
+        WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
+        BPELProcessInstance processInstance = new BPELProcessInstance();
+        processInstance.setProcess(process);
+        processInstance.setWorkingMemory(workingMemory);
+        processInstance.start();
+        logger.writeToDisk();
+    }
+     
+    public static void main2(String[] args) {
+        BPELProcess process = new BPELProcess();
+        process.setName("TestProcess");
+        process.setId("1");
+        
+        // sequence
+        BPELSequence sequence = new BPELSequence();
+        sequence.setName("sequence");
+        List<BPELActivity> sequenceActivities = new ArrayList<BPELActivity>();
+        
+        // invoke1
+        BPELInvoke invoke1 = new BPELInvoke();
+        invoke1.setName("invoke1");
+        sequenceActivities.add(invoke1);
+        
+        // invoke2
+        BPELInvoke invoke2 = new BPELInvoke();
+        invoke2.setName("invoke2");
+        sequenceActivities.add(invoke2);
+        
+        sequence.setActivities(sequenceActivities);
+        process.setActivity(sequence);
+        
+        // execute
+        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, (InternalRuleBase) RuleBaseFactory.newRuleBase());
+        WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
+        BPELProcessInstance processInstance = new BPELProcessInstance();
+        processInstance.setProcess(process);
+        processInstance.setWorkingMemory(workingMemory);
+        processInstance.start();
+        logger.writeToDisk();
+    }
+    
+    public static void main(String[] args) {
+        BPELProcess process = new BPELProcess();
+        process.setName("Purchase Order Process");
+        process.setId("1");
+        process.setVersion("1");
+        process.setPackageName("org.drools.bpel.test");
+        
+        // sequence
+        BPELSequence sequence = new BPELSequence();
+        sequence.setName("sequence");
+        List<BPELActivity> sequenceActivities = new ArrayList<BPELActivity>();
+        
+        // Receive purchase order
+        BPELReceive receive = new BPELReceive();
+        receive.setName("Receive Purchase Order");
+        receive.setPartnerLink("purchasing");
+        receive.setPortType("lns:purchaseOrderPT");
+        receive.setOperation("sendPurchaseOrder");
+        receive.setVariable("PO");
+        receive.setCreateInstance(true);
+        sequenceActivities.add(receive);
+        
+        // flow
+        BPELFlow flow = new BPELFlow();
+        flow.setName("flow");
+        flow.setLinks(new String[] { "ship-to-invoice", "ship-to-scheduling" });
+        List<BPELActivity> flowActivities = new ArrayList<BPELActivity>();
+        
+            /********** sequence1 **********/
+            BPELSequence sequence1 = new BPELSequence();
+            sequence1.setName("sequence1");
+            List<BPELActivity> sequence1Activities = new ArrayList<BPELActivity>();
+        
+            // assign1
+            BPELAssign assign1 = new BPELAssign();
+            // $shippingRequest.customerInfo <- $PO.customerInfo
+            assign1.setAction("");
+            sequence1Activities.add(assign1);
+            
+            // invoke1
+            BPELInvoke invoke1 = new BPELInvoke();
+            invoke1.setName("Decide On Shipper");
+            invoke1.setPartnerLink("shipping");
+            invoke1.setPortType("lns:shippingPT");
+            invoke1.setOperation("requestShipping");
+            invoke1.setInputVariable("shippingRequest");
+            invoke1.setOutputVariable("shippingInfo");
+            invoke1.setSourceLinks(new String[] { "ship-to-invoice" });
+            sequence1Activities.add(invoke1);
+        
+            // receive1
+            BPELReceive receive1 = new BPELReceive();
+            receive1.setName("Arrange Logistics");
+            receive1.setPartnerLink("shipping");
+            receive1.setPortType("lns:shippingCallbackPT");
+            receive1.setOperation("sendSchedule");
+            receive1.setVariable("shippingSchedule");
+            receive1.setCreateInstance(false);
+            receive1.setSourceLinks(new String[] { "ship-to-scheduling" });
+            sequence1Activities.add(receive1);
+            
+            sequence1.setActivities(sequence1Activities);
+            flowActivities.add(sequence1);
+            
+            /********** sequence2 **********/
+            BPELSequence sequence2 = new BPELSequence();
+            sequence2.setName("sequence2");
+            List<BPELActivity> sequence2Activities = new ArrayList<BPELActivity>();
+        
+            // invoke2a
+            BPELInvoke invoke2a = new BPELInvoke();
+            invoke2a.setName("Initial Price Calculation");
+            invoke2a.setPartnerLink("invoicing");
+            invoke2a.setPortType("lns:computePricePT");
+            invoke2a.setOperation("initiatePriceCalculation");
+            invoke2a.setInputVariable("PO");
+            sequence2Activities.add(invoke2a);
+            
+            // invoke2b
+            BPELInvoke invoke2b = new BPELInvoke();
+            invoke2b.setName("Complete Price Calculation");
+            invoke2b.setPartnerLink("invoicing");
+            invoke2b.setPortType("lns:computePricePT");
+            invoke2b.setOperation("sendShippingPrice");
+            invoke2b.setInputVariable("shippingInfo");
+            invoke2b.setTargetLinks(new String[] { "ship-to-invoice" });
+            sequence2Activities.add(invoke2b);
+        
+            // receive2
+            BPELReceive receive2 = new BPELReceive();
+            receive2.setName("Receive Invoice");
+            receive2.setPartnerLink("invoicing");
+            receive2.setPortType("lns:invoiceCallbackPT");
+            receive2.setOperation("sendInvoice");
+            receive2.setVariable("Invoice");
+            receive2.setCreateInstance(false);
+            sequence2Activities.add(receive2);
+            
+            sequence2.setActivities(sequence2Activities);
+            flowActivities.add(sequence2);
+            
+            /********** sequence3 **********/
+            BPELSequence sequence3 = new BPELSequence();
+            sequence3.setName("sequence3");
+            List<BPELActivity> sequence3Activities = new ArrayList<BPELActivity>();
+        
+            // invoke3a
+            BPELInvoke invoke3a = new BPELInvoke();
+            invoke3a.setName("Initiate Production Scheduling");
+            invoke3a.setPartnerLink("scheduling");
+            invoke3a.setPortType("lns:schedulingPT");
+            invoke3a.setOperation("requestProductionScheduling");
+            invoke3a.setInputVariable("PO");
+            sequence3Activities.add(invoke3a);
+            
+            // invoke2b
+            BPELInvoke invoke3b = new BPELInvoke();
+            invoke3b.setName("Complete Production Scheduling");
+            invoke3b.setPartnerLink("scheduling");
+            invoke3b.setPortType("lns:schedulingPT");
+            invoke3b.setOperation("sendShippingSchedule");
+            invoke3b.setInputVariable("shippingSchedule");
+            invoke3b.setTargetLinks(new String[] { "ship-to-scheduling" });
+            sequence3Activities.add(invoke3b);
+        
+            sequence3.setActivities(sequence3Activities);
+            flowActivities.add(sequence3);
+            
+        flow.setActivities(flowActivities);
+        sequenceActivities.add(flow);
+        
+        // reply
+        BPELReply reply = new BPELReply();
+        reply.setName("Invoice Processing");
+        reply.setPartnerLink("purchasing");
+        reply.setPortType("lns:purchaseOrderPT");
+        reply.setOperation("sendPurchaseOrder");
+        reply.setVariable("Invoice");
+        sequenceActivities.add(reply);
+        
+        sequence.setActivities(sequenceActivities);
+        process.setActivity(sequence);
+        
+        Properties properties = new Properties(); 
+        properties.put( "processNodeBuilderRegistry", "bpelNodeBuilderRegistry.conf" );
+        PackageBuilderConfiguration packageConf = new PackageBuilderConfiguration( properties );
+        PackageBuilder packageBuilder = new PackageBuilder(packageConf);
+        ProcessBuilder processBuilder = new ProcessBuilder(packageBuilder);
+        processBuilder.buildProcess(process);
+        
+        // execute
+        properties = new Properties(); 
+        properties.put( "processNodeInstanceFactoryRegistry", "bpelProcessNodeInstanceFactory.conf" );        
+        RuleBaseConfiguration ruleBaseConf = new RuleBaseConfiguration( properties );
+        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase(ruleBaseConf);
+        ruleBase.addProcess(process);
+        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
+        workingMemory.registerProcessInstanceFactory(
+            BPELProcess.BPEL_TYPE, new BPELProcessInstanceFactory());
+        WorkItemHandler handler = new WebServiceInvocationHandler();
+        workingMemory.getWorkItemManager().registerWorkItemHandler("WebServiceInvocation", handler);
+        WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
+        BPELProcessInstance processInstance = (BPELProcessInstance) workingMemory.startProcess("1");
+        
+        // start process
+        webServiceInvocation(processInstance, "purchasing", "lns:purchaseOrderPT", "sendPurchaseOrder", "PURCHASE ORDER");
+
+        // reply to web service invocations
+        WorkItem workItem = findWebServiceInvocation(workingMemory, "scheduling", "lns:schedulingPT", "requestProductionScheduling");
+        replyWebServiceInvocation(workingMemory, workItem, null);
+
+        workItem = findWebServiceInvocation(workingMemory, "invoicing", "lns:computePricePT", "initiatePriceCalculation");
+        replyWebServiceInvocation(workingMemory, workItem, null);
+        
+        workItem = findWebServiceInvocation(workingMemory, "shipping", "lns:shippingPT", "requestShipping");
+        replyWebServiceInvocation(workingMemory, workItem, "SHIPPING");
+        
+        workItem = findWebServiceInvocation(workingMemory, "invoicing", "lns:computePricePT", "sendShippingPrice");
+        replyWebServiceInvocation(workingMemory, workItem, null);
+        
+        // invoke web service callbacks
+        webServiceInvocation(processInstance, "shipping", "lns:shippingCallbackPT", "sendSchedule", "SCHEDULE");
+        webServiceInvocation(processInstance, "invoicing", "lns:invoiceCallbackPT", "sendInvoice", "INVOICE");
+
+        // reply to web service invocation
+        workItem = findWebServiceInvocation(workingMemory, "scheduling", "lns:schedulingPT", "sendShippingSchedule");
+        replyWebServiceInvocation(workingMemory, workItem, null);
+
+        logger.writeToDisk();
+    }
+    
+    private static WorkItem findWebServiceInvocation(WorkingMemory workingMemory, String partnerLink, String portType, String operation) {
+        Set<WorkItem> workItems = workingMemory.getWorkItemManager().getWorkItems();
+        for (Iterator<WorkItem> iterator = workItems.iterator(); iterator.hasNext(); ) {
+            WorkItem workItem = iterator.next();
+            if ("WebServiceInvocation".equals(workItem.getName())
+                    && workItem.getParameter("PartnerLink").equals(partnerLink)
+                    && workItem.getParameter("PortType").equals(portType)
+                    && workItem.getParameter("Operation").equals(operation)) {
+                return workItem;
+            }
+        }
+        return null;
+    }
+    
+    private static void replyWebServiceInvocation(WorkingMemory workingMemory, WorkItem workItem, String result) {
+        System.out.println("Replying to web service invocation "
+                + workItem.getParameter("PartnerLink") + " "
+                + workItem.getParameter("PortType") + " "
+                + workItem.getParameter("Operation") + ", message = "
+                + workItem.getParameter("Message") + ": "
+                + result);
+        Map<String, Object> results = new HashMap<String, Object>();
+        results.put("Result", result);
+        workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), results);
+    }
+    
+    private static void webServiceInvocation(BPELProcessInstance processInstance, String partnerLink, String portType, String operation, String result) {
+        System.out.println("Web service invocation "
+                + partnerLink + " "
+                + portType + " "
+                + operation + ": "
+                + result);
+        processInstance.acceptMessage(partnerLink, portType, operation, result);
+    }
+    
+    public static class WebServiceInvocationHandler implements WorkItemHandler {
+
+        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+            System.out.println("Web service invoked "
+                + workItem.getParameter("PartnerLink") + " "
+                + workItem.getParameter("PortType") + " "
+                + workItem.getParameter("Operation") + ", message = "
+                + workItem.getParameter("Message"));
+        }
+        
+        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+            System.out.println("Web service invocation aborted "
+                + workItem.getParameter("PartnerLink") + " "
+                + workItem.getParameter("PortType") + " "
+                + workItem.getParameter("Operation") + ", message = "
+                + workItem.getParameter("Message"));
+        }
+
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/Alert.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/Alert.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/Alert.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.brms.client.modeldriven;
+
+public class Alert {
+
+	public String message;
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngineTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngineTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/client/modeldriven/SuggestionCompletionEngineTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,319 @@
+package org.drools.brms.client.modeldriven;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+import org.drools.brms.server.rules.SuggestionCompletionLoader;
+
+public class SuggestionCompletionEngineTest extends TestCase {
+
+    public void testNestedImports() {
+        String pkg = "package org.test\n import org.drools.brms.client.modeldriven.SuggestionCompletionEngineTest.NestedClass";
+
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg, new ArrayList(), new ArrayList() );
+
+        assertEquals( "String", engine.getFieldType( "SuggestionCompletionEngineTest$NestedClass", "name" ) );
+    }
+
+    public void testStringNonNumeric() {
+        String pkg = "package org.test\n import org.drools.brms.client.modeldriven.Alert";
+
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg, new ArrayList(), new ArrayList() );
+
+        assertEquals( SuggestionCompletionEngine.TYPE_STRING, engine.getFieldType( "Alert", "message" ) );
+
+    }
+
+    public void testDataEnums() {
+        String pkg = "package org.test\n import org.drools.brms.client.modeldriven.SuggestionCompletionEngineTest.NestedClass";
+
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+
+        List enums = new ArrayList();
+
+        enums.add( "'Person.age' : [42, 43] \n 'Person.sex' : ['M', 'F']");
+        enums.add( "'Driver.sex' : ['M', 'F']" );
+
+
+        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg, new ArrayList(), new ArrayList() , enums);
+        assertEquals( "String", engine.getFieldType( "SuggestionCompletionEngineTest$NestedClass", "name" ) );
+
+        assertEquals(3, engine.dataEnumLists.size());
+        String[] items = (String[]) engine.dataEnumLists.get( "Person.age" );
+        assertEquals(2, items.length);
+        assertEquals("42", items[0]);
+        assertEquals("43", items[1]);
+
+        items = engine.getEnums(new FactPattern("Person"), "age");
+        assertEquals(2, items.length);
+        assertEquals("42", items[0]);
+        assertEquals("43", items[1]);
+
+        items = engine.getEnums(new FactPattern("Nothing"), "age");
+        assertNull(items);
+
+
+    }
+
+    public void testCompletions() {
+
+        final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
+
+        com.factTypes = new String[]{"Person", "Vehicle"};
+        com.fieldsForType = new HashMap() {
+            {
+                put( "Person",
+                     new String[]{"age", "name", "rank"} );
+                put( "Vehicle",
+                     new String[]{"type", "make"} );
+            }
+        };
+        com.fieldTypes = new HashMap() {
+            {
+                put( "Person.age",
+                     "Numeric" );
+                put( "Person.rank",
+                     "Comparable" );
+                put( "Person.name",
+                     "String" );
+                put( "Vehicle.make",
+                     "String" );
+                put( "Vehicle.type",
+                     "String" );
+            }
+        };
+        com.globalTypes = new HashMap() {
+            {
+                put( "bar",
+                     "Person" );
+                put( "baz",
+                     "Vehicle" );
+            }
+        };
+
+        String[] c = com.getConditionalElements();
+        assertEquals( "not",
+                      c[0] );
+        assertEquals( "exists",
+                      c[1] );
+        assertEquals( "or",
+                      c[2] );
+
+        c = com.getFactTypes();
+        assertEquals( 2,
+                      c.length );
+        assertContains( "Person",
+                        c );
+        assertContains( "Vehicle",
+                        c );
+
+        c = com.getFieldCompletions( "Person" );
+        assertEquals( "age",
+                      c[0] );
+        assertEquals( "name",
+                      c[1] );
+
+        c = com.getFieldCompletions( "Vehicle" );
+        assertEquals( "type",
+                      c[0] );
+        assertEquals( "make",
+                      c[1] );
+
+        c = com.getOperatorCompletions( "Person",
+                                        "name" );
+        assertEquals( 4,
+                      c.length );
+        assertEquals( "==",
+                      c[0] );
+        assertEquals( "!=",
+                      c[1] );
+        assertEquals( "matches",
+                      c[2] );
+
+        c = com.getOperatorCompletions( "Person",
+                                        "age" );
+        assertEquals( 6,
+                      c.length );
+        assertEquals( c[0],
+                      "==" );
+        assertEquals( c[1],
+                      "!=" );
+        assertEquals( c[2],
+                      "<" );
+        assertEquals( c[3],
+                      ">" );
+
+        c = com.getOperatorCompletions( "Person",
+                                        "rank" );
+        assertEquals( 6,
+                      c.length );
+        assertEquals( c[0],
+                      "==" );
+        assertEquals( c[1],
+                      "!=" );
+        assertEquals( c[2],
+                      "<" );
+        assertEquals( c[3],
+                      ">" );
+
+        c = com.getConnectiveOperatorCompletions( "Vehicle",
+                                                  "make" );
+        assertEquals( 5,
+                      c.length );
+        assertEquals( "|| ==",
+                      c[0] );
+
+        c = com.getGlobalVariables();
+        assertEquals( 2,
+                      c.length );
+        assertEquals( "baz",
+                      c[0] );
+        assertEquals( "bar",
+                      c[1] );
+
+        c = com.getFieldCompletionsForGlobalVariable( "bar" );
+        assertEquals( 3,
+                      c.length );
+        assertEquals( "age",
+                      c[0] );
+        assertEquals( "name",
+                      c[1] );
+
+        c = com.getFieldCompletionsForGlobalVariable( "baz" );
+        assertEquals( 2,
+                      c.length );
+        assertEquals( "type",
+                      c[0] );
+        assertEquals( "make",
+                      c[1] );
+
+        //check that it has default operators for general objects
+        c = com.getOperatorCompletions( "Person",
+                                        "wankle" );
+        assertEquals( 2,
+                      c.length );
+
+        assertEquals("Numeric", com.getFieldType( "Person", "age" ));
+
+    }
+
+    public void testAdd() {
+        final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
+        com.factTypes = new String[]{"Foo"};
+        com.fieldsForType = new HashMap() {
+            {
+                put( "Foo",
+                     new String[]{"a"} );
+            }
+        };
+
+        assertEquals( 1,
+                      com.getFactTypes().length );
+        assertEquals( "Foo",
+                      com.getFactTypes()[0] );
+
+        assertEquals( 1,
+                      com.getFieldCompletions( "Foo" ).length );
+        assertEquals( "a",
+                      com.getFieldCompletions( "Foo" )[0] );
+
+    }
+
+    public void testSmartEnums() {
+    	final SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
+    	sce.dataEnumLists = new HashMap();
+    	sce.dataEnumLists.put("Fact.type", new String[] {"sex", "colour"});
+    	sce.dataEnumLists.put("Fact.value[type=sex]", new String[] {"M", "F"});
+    	sce.dataEnumLists.put("Fact.value[type=colour]", new String[] {"RED", "WHITE", "BLUE"});
+
+    	FactPattern pat = new FactPattern("Fact");
+    	SingleFieldConstraint sfc = new SingleFieldConstraint("type");
+    	sfc.value = "sex";
+    	pat.addConstraint(sfc);
+    	String[] result = sce.getEnums(pat, "value");
+    	assertEquals(2, result.length);
+    	assertEquals("M", result[0]);
+    	assertEquals("F", result[1]);
+
+
+    	pat = new FactPattern("Fact");
+    	sfc = new SingleFieldConstraint("type");
+    	sfc.value = "colour";
+    	pat.addConstraint(sfc);
+
+    	result = sce.getEnums(pat, "value");
+    	assertEquals(3, result.length);
+    	assertEquals("RED", result[0]);
+    	assertEquals("WHITE", result[1]);
+    	assertEquals("BLUE", result[2]);
+
+    	result = sce.getEnums(pat, "type");
+    	assertEquals(2, result.length);
+    	assertEquals("sex", result[0]);
+    	assertEquals("colour", result[1]);
+
+
+    	ActionFieldValue[] vals = new ActionFieldValue[2];
+    	vals[0] = new ActionFieldValue("type", "sex", "blah");
+    	vals[1] = new ActionFieldValue("value", null, "blah");
+    	result = sce.getEnums("Fact", vals, "value");
+    	assertNotNull(result);
+    	assertEquals(2, result.length);
+    	assertEquals("M", result[0]);
+    	assertEquals("F", result[1]);
+
+
+    }
+
+    private void assertContains(final String string,
+                                final String[] c) {
+
+        for ( int i = 0; i < c.length; i++ ) {
+            if ( string.equals( c[i] ) ) {
+                return;
+            }
+        }
+        fail( "String array did not contain: " + string );
+
+    }
+
+    public void testGlobalAndFacts() {
+        final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
+
+        com.globalTypes = new HashMap() {
+            {
+                put( "y",
+                     "Foo" );
+            }
+        };
+        com.fieldsForType = new HashMap() {
+            {
+                put( "Foo",
+                     new String[]{"a"} );
+            }
+        };
+
+        assertFalse( com.isGlobalVariable( "x" ) );
+        assertTrue( com.isGlobalVariable( "y" ) );
+    }
+
+    public static class NestedClass {
+        private String name;
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionFieldValueTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionFieldValueTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionFieldValueTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+
+public class ActionFieldValueTest extends TestCase {
+
+    public void testFormula() {
+        ActionFieldValue val = new ActionFieldValue( "x",
+                                                     "y",
+                                                     SuggestionCompletionEngine.TYPE_NUMERIC );
+        assertFalse( val.isFormula() );
+        val = new ActionFieldValue( "x",
+                                    "=y * 20",
+                                    SuggestionCompletionEngine.TYPE_NUMERIC );
+        assertTrue( val.isFormula() );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionSetFieldTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionSetFieldTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ActionSetFieldTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,58 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+
+public class ActionSetFieldTest extends TestCase {
+
+    public void testRemove() {
+        final ActionSetField set = new ActionSetField();
+        set.fieldValues = new ActionFieldValue[2];
+        final ActionFieldValue v0 = new ActionFieldValue( "x",
+                                                          "42",
+                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
+        final ActionFieldValue v1 = new ActionFieldValue( "y",
+                                                          "43",
+                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
+        set.fieldValues[0] = v0;
+        set.fieldValues[1] = v1;
+
+        set.removeField( 1 );
+
+        assertEquals( 1,
+                      set.fieldValues.length );
+        assertEquals( v0,
+                      set.fieldValues[0] );
+
+    }
+
+    public void testAdd() {
+        final ActionSetField set = new ActionSetField();
+        set.fieldValues = new ActionFieldValue[2];
+        final ActionFieldValue v0 = new ActionFieldValue( "x",
+                                                          "42",
+                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
+        final ActionFieldValue v1 = new ActionFieldValue( "y",
+                                                          "43",
+                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
+        set.fieldValues[0] = v0;
+        set.fieldValues[1] = v1;
+
+        final ActionFieldValue q = new ActionFieldValue( "q",
+                                                         "q",
+                                                         SuggestionCompletionEngine.TYPE_NUMERIC );
+        set.addFieldValue( q );
+
+        assertEquals( 3,
+                      set.fieldValues.length );
+        assertEquals( q,
+                      set.fieldValues[2] );
+        assertEquals( v0,
+                      set.fieldValues[0] );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFactPatternTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFactPatternTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFactPatternTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,27 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+
+public class CompositeFactPatternTest extends TestCase {
+
+    public void testAddPattern() {
+        final CompositeFactPattern pat = new CompositeFactPattern();
+        final FactPattern x = new FactPattern();
+        pat.addFactPattern( x );
+        assertEquals( 1,
+                      pat.patterns.length );
+
+        final FactPattern y = new FactPattern();
+        pat.addFactPattern( y );
+        assertEquals( 2,
+                      pat.patterns.length );
+        assertEquals( x,
+                      pat.patterns[0] );
+        assertEquals( y,
+                      pat.patterns[1] );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFieldConstraintTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFieldConstraintTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/CompositeFieldConstraintTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,59 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+public class CompositeFieldConstraintTest extends TestCase {
+
+    public void testCompositeType() {
+        CompositeFieldConstraint con = new CompositeFieldConstraint();
+        assertEquals(null, con.compositeJunctionType);
+    }
+    
+    public void testAddConstraint() {
+        final CompositeFieldConstraint p = new CompositeFieldConstraint();
+        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
+        p.addConstraint( x );
+
+        assertEquals( 1,
+                      p.constraints.length );
+        assertEquals( x,
+                      p.constraints[0] );
+
+        final SingleFieldConstraint y = new SingleFieldConstraint( "y" );
+
+        p.addConstraint( y );
+        assertEquals( 2,
+                      p.constraints.length );
+        assertEquals( x,
+                      p.constraints[0] );
+        assertEquals( y,
+                      p.constraints[1] );
+
+    }
+
+    public void testRemoveConstraint() {
+        final CompositeFieldConstraint p = new CompositeFieldConstraint();
+        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
+        p.addConstraint( x );
+        final CompositeFieldConstraint y = new CompositeFieldConstraint(  );
+        p.addConstraint( y );
+
+        assertEquals( 2,
+                      p.constraints.length );
+
+        p.removeConstraint( 1 );
+
+        assertEquals( 1,
+                      p.constraints.length );
+
+        assertEquals( x,
+                      p.constraints[0] );
+
+    }
+    
+    
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ConstraintTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ConstraintTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/ConstraintTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+public class ConstraintTest extends TestCase {
+
+    public void testAdd() {
+        final SingleFieldConstraint con = new SingleFieldConstraint();
+        con.addNewConnective();
+
+        assertEquals( 1,
+                      con.connectives.length );
+        assertNotNull( con.connectives[0] );
+
+        con.addNewConnective();
+
+        assertEquals( 2,
+                      con.connectives.length );
+        assertNotNull( con.connectives[1] );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DSLSentenceTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DSLSentenceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DSLSentenceTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+
+public class DSLSentenceTest extends TestCase {
+
+    public void testSentence() {
+
+        final DSLSentence sen = new DSLSentence();
+        sen.sentence = "this is {something} here and {here}";
+        assertEquals( "this is something here and here",
+                      sen.toString() );
+
+        sen.sentence = "foo bar";
+        assertEquals( "foo bar",
+                      sen.toString() );
+
+        final DSLSentence newOne = sen.copy();
+        assertFalse( newOne == sen );
+        assertEquals( newOne.sentence,
+                      sen.sentence );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DataEnumLoaderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DataEnumLoaderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/DataEnumLoaderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,104 @@
+package org.drools.brms.modeldriven;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.server.util.DataEnumLoader;
+import org.mvel.MVEL;
+
+public class DataEnumLoaderTest extends TestCase {
+
+	public void testEnumGeneration() throws Exception {
+
+
+
+		Object result = MVEL.eval("[2, 3, 4, ]", new HashMap());
+		assertTrue(result instanceof List);
+		List l = (List) result;
+		assertEquals(3, l.size());
+
+		result = MVEL.eval("['Person.age' : [2, 3]\n 'Person.name' : ['qqq', \n'ccc']]", new HashMap());
+
+
+
+
+		DataEnumLoader loader = new DataEnumLoader(readLines().toString());
+
+        assertFalse(loader.getErrors().toString(), loader.hasErrors());
+
+		Map enumeration = (Map) loader.getData();
+		assertEquals(loader.getErrors().toString(), 0, loader.getErrors().size());
+		assertEquals(3, enumeration.size());
+
+		String[] list = (String[]) enumeration.get("Person.age");
+		assertEquals(4, list.length);
+		assertEquals("1", list[0]);
+		assertEquals("2", list[1]);
+
+		list = (String[]) enumeration.get("Person.rating");
+		assertEquals(2, list.length);
+		assertEquals("High", list[0]);
+		assertEquals("Low", list[1]);
+
+
+
+
+		loader = new DataEnumLoader("goober poo error");
+		assertEquals(0, loader.getData().size());
+		assertFalse(loader.getErrors().size() == 0);
+		assertTrue(loader.hasErrors());
+
+	}
+
+
+
+    public void testNoOp() {
+        DataEnumLoader loader = new DataEnumLoader(" ");
+        assertFalse(loader.hasErrors());
+        assertEquals(0, loader.getData().size());
+
+        loader = new DataEnumLoader("");
+        assertFalse(loader.hasErrors());
+        assertEquals(0, loader.getData().size());
+
+    }
+
+    public void testLiteralHelperUtilityClass() {
+    	//this shows how you can load it up with a class (which should return a map of keys to List.
+    	DataEnumLoader loader = new DataEnumLoader("=(new org.drools.brms.modeldriven.SampleDataSource2()).loadData()");
+
+    	assertFalse(loader.hasErrors());
+
+        assertEquals(1, loader.getData().size());
+        String[] res = (String[]) loader.getData().get("whee");
+    	assertEquals(2, res.length);
+    	assertEquals("hey", res[0]);
+    	assertEquals("ho", res[1]);
+
+    }
+
+
+    public void testNewLines() {
+        String s = "yeah yeah, \nyeah \nyeah";
+        assertEquals("yeah yeah,\nyeah,\nyeah", DataEnumLoader.addCommasForNewLines( s ));
+    }
+
+	private StringBuffer readLines() throws IOException {
+		BufferedReader r = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("Some.enumeration")));
+		String line = "";
+		StringBuffer buf = new StringBuffer();
+		while ((line = r.readLine()) != null) {
+			buf.append(line); buf.append('\n');
+		}
+		return buf;
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/FactPatternTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/FactPatternTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/FactPatternTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,101 @@
+package org.drools.brms.modeldriven;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+public class FactPatternTest extends TestCase {
+
+    public void testAddConstraint() {
+        final FactPattern p = new FactPattern();
+        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
+        p.addConstraint( x );
+
+        assertEquals( 1,
+                      p.constraintList.constraints.length );
+        assertEquals( x,
+                      p.constraintList.constraints[0] );
+
+        final SingleFieldConstraint y = new SingleFieldConstraint( "y" );
+
+        p.addConstraint( y );
+        assertEquals( 2,
+                      p.constraintList.constraints.length );
+        assertEquals( x,
+                      p.constraintList.constraints[0] );
+        assertEquals( y,
+                      p.constraintList.constraints[1] );
+
+    }
+    
+    public void testWithCompositeNesting() {
+        final FactPattern p = new FactPattern();
+        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
+        p.addConstraint( x );
+
+        assertEquals( 1,
+                      p.constraintList.constraints.length );
+        assertEquals( x,
+                      p.constraintList.constraints[0] );
+
+        final CompositeFieldConstraint y = new CompositeFieldConstraint();
+
+        y.addConstraint( new SingleFieldConstraint("y") );
+        y.addConstraint( new SingleFieldConstraint("z") );        
+        p.addConstraint( y );
+        
+        assertEquals( 2,
+                      p.constraintList.constraints.length );
+        assertEquals( x,
+                      p.constraintList.constraints[0] );
+        assertEquals( y,
+                      p.constraintList.constraints[1] );     
+        
+       
+        
+    }
+
+    public void testRemoveConstraint() {
+        final FactPattern p = new FactPattern();
+        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
+        p.addConstraint( x );
+        final SingleFieldConstraint y = new SingleFieldConstraint( "y" );
+        p.addConstraint( y );
+
+        assertEquals( 2,
+                      p.constraintList.constraints.length );
+
+        p.removeConstraint( 1 );
+
+        assertEquals( 1,
+                      p.constraintList.constraints.length );
+
+        assertEquals( x,
+                      p.constraintList.constraints[0] );
+
+        
+        
+    }
+    
+    public void testIsBound() {
+        FactPattern pat = new FactPattern();
+        pat.boundName = "x";
+        assertTrue(pat.isBound());
+        
+        pat = new FactPattern();
+        assertFalse(pat.isBound());
+    }
+    
+    public void testGetFieldConstraints() {
+        FactPattern pat = new FactPattern();
+        assertEquals(0, pat.getFieldConstraints().length);
+        assertNull(pat.constraintList);
+        
+        pat.addConstraint( new SingleFieldConstraint() );
+        assertNotNull(pat.constraintList);
+        assertEquals(1, pat.getFieldConstraints().length);
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/RuleModelTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/RuleModelTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/RuleModelTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,386 @@
+package org.drools.brms.modeldriven;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.ConnectiveConstraint;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.IAction;
+import org.drools.brms.client.modeldriven.brl.IPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+import com.thoughtworks.xstream.XStream;
+
+public class RuleModelTest extends TestCase {
+
+    public void testBoundFactFinder() {
+        final RuleModel model = new RuleModel();
+
+        assertNull( model.getBoundFact( "x" ) );
+        model.lhs = new IPattern[3];
+
+        final FactPattern x = new FactPattern( "Car" );
+        model.lhs[0] = x;
+        x.boundName = "x";
+
+        assertNotNull( model.getBoundFact( "x" ) );
+        assertEquals( x,
+                      model.getBoundFact( "x" ) );
+
+        final FactPattern y = new FactPattern( "Car" );
+        model.lhs[1] = y;
+        y.boundName = "y";
+
+        final FactPattern other = new FactPattern( "House" );
+        model.lhs[2] = other;
+
+        assertEquals( y,
+                      model.getBoundFact( "y" ) );
+        assertEquals( x,
+                      model.getBoundFact( "x" ) );
+
+        model.rhs = new IAction[1];
+        final ActionSetField set = new ActionSetField();
+        set.variable = "x";
+        model.rhs[0] = set;
+
+        assertTrue( model.isBoundFactUsed( "x" ) );
+        assertFalse( model.isBoundFactUsed( "y" ) );
+
+        assertEquals( 3,
+                      model.lhs.length );
+        assertFalse( model.removeLhsItem( 0 ) );
+        assertEquals( 3,
+                      model.lhs.length );
+
+        final ActionRetractFact fact = new ActionRetractFact( "q" );
+        model.rhs[0] = fact;
+        assertTrue( model.isBoundFactUsed( "q" ) );
+        assertFalse( model.isBoundFactUsed( "x" ) );
+
+        final XStream xt = new XStream();
+        xt.alias( "rule",
+                  RuleModel.class );
+        xt.alias( "fact",
+                  FactPattern.class );
+        xt.alias( "retract",
+                  ActionRetractFact.class );
+
+        final String brl = xt.toXML( model );
+
+        System.out.println( brl );
+    }
+
+    public void testScopedVariables() {
+
+        //setup the data...
+
+        final RuleModel model = new RuleModel();
+        model.lhs = new IPattern[3];
+        final FactPattern x = new FactPattern( "Car" );
+        model.lhs[0] = x;
+        x.boundName = "x";
+
+        final FactPattern y = new FactPattern( "Car" );
+        model.lhs[1] = y;
+        y.boundName = "y";
+        final SingleFieldConstraint[] cons = new SingleFieldConstraint[2];
+        y.constraintList = new CompositeFieldConstraint();
+        y.constraintList.constraints = cons;
+        cons[0] = new SingleFieldConstraint( "age" );
+        cons[1] = new SingleFieldConstraint( "make" );
+        cons[0].fieldBinding = "qbc";
+        cons[0].connectives = new ConnectiveConstraint[1];
+        cons[0].connectives[0] = new ConnectiveConstraint( "&",
+                                                           "x" );
+        cons[0].connectives[0].constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+
+        final FactPattern other = new FactPattern( "House" );
+        model.lhs[2] = other;
+        other.boundName = "q";
+        final SingleFieldConstraint[] cons2 = new SingleFieldConstraint[1];
+        cons2[0] = new SingleFieldConstraint();
+        other.constraintList = new CompositeFieldConstraint();
+        other.constraintList.constraints = cons2;
+
+        //check the results for correct scope
+        List vars = model.getBoundVariablesInScope( cons[0] );
+        assertEquals( 1,
+                      vars.size() );
+        assertEquals( "x",
+                      vars.get( 0 ) );
+
+        vars = model.getBoundVariablesInScope( cons[0].connectives[0] );
+        assertEquals( 1,
+                      vars.size() );
+        assertEquals( "x",
+                      vars.get( 0 ) );
+
+        vars = model.getBoundVariablesInScope( cons[1] );
+        assertEquals( 2,
+                      vars.size() );
+        assertEquals( "x",
+                      vars.get( 0 ) );
+        assertEquals( "qbc",
+                      vars.get( 1 ) );
+
+        vars = model.getBoundVariablesInScope( cons[0] );
+        assertEquals( 1,
+                      vars.size() );
+        assertEquals( "x",
+                      vars.get( 0 ) );
+
+        vars = model.getBoundVariablesInScope( cons2[0] );
+        assertEquals( 3,
+                      vars.size() );
+        assertEquals( "x",
+                      vars.get( 0 ) );
+        assertEquals( "qbc",
+                      vars.get( 1 ) );
+        assertEquals( "y",
+                      vars.get( 2 ) );
+    }
+    
+    public void testScopedVariablesWithCompositeFact() {
+        RuleModel m = new RuleModel();
+        FactPattern p = new FactPattern();
+        CompositeFieldConstraint cf = new CompositeFieldConstraint();
+        cf.addConstraint( new SingleFieldConstraint("x") );
+        p.addConstraint( cf );
+        SingleFieldConstraint sf = new SingleFieldConstraint("q");
+        sf.fieldBinding = "abc";
+
+        p.addConstraint( sf );
+        SingleFieldConstraint sf2 = new SingleFieldConstraint("q");
+        sf2.fieldBinding = "qed";
+        cf.addConstraint( sf2 );
+        m.addLhsItem( p );
+
+        List vars = m.getAllVariables();
+        assertEquals(1, vars.size());
+        assertEquals("abc", vars.get( 0 ));
+    }
+
+    public void testBindingList() {
+        final RuleModel model = new RuleModel();
+
+        model.lhs = new IPattern[3];
+        final FactPattern x = new FactPattern( "Car" );
+        model.lhs[0] = x;
+        x.boundName = "x";
+
+        final FactPattern y = new FactPattern( "Car" );
+        model.lhs[1] = y;
+        y.boundName = "y";
+
+        final FactPattern other = new FactPattern( "House" );
+        model.lhs[2] = other;
+
+        final List b = model.getBoundFacts();
+        assertEquals( 2,
+                      b.size() );
+
+        assertEquals( "x",
+                      b.get( 0 ) );
+        assertEquals( "y",
+                      b.get( 1 ) );
+
+    }
+    
+    public void testAllVariableBindings() {
+        final RuleModel model = new RuleModel();
+        model.lhs = new IPattern[2];
+        final FactPattern x = new FactPattern( "Car" );
+        model.lhs[0] = x;
+        x.boundName = "boundFact";        
+        
+        SingleFieldConstraint sfc = new SingleFieldConstraint("q"); 
+        x.addConstraint( sfc );
+        sfc.fieldBinding = "field1";
+        
+        SingleFieldConstraint sfc2 = new SingleFieldConstraint("q"); 
+        x.addConstraint( sfc2 );
+        sfc2.fieldBinding = "field2";
+        
+        
+        model.lhs[1] = new CompositeFactPattern();
+     
+        List vars = model.getAllVariables();
+        assertEquals(3, vars.size());
+        assertEquals("boundFact", vars.get( 0 ));
+        assertEquals("field1", vars.get( 1 ));
+        assertEquals("field2", vars.get( 2 ));
+        
+        assertTrue(model.isVariableNameUsed( "field2" ));
+        
+    }
+    
+    public void testGetVariableNameForRHS() {
+        RuleModel m = new RuleModel();
+        m.name = "blah";
+        
+        FactPattern pat = new FactPattern();
+        pat.boundName = "pat";
+        pat.factType = "Person";
+        
+        m.addLhsItem( pat );
+        
+        List l = m.getAllVariables();
+        assertEquals( 1, l.size() );
+        assertEquals("pat", l.get( 0 ));
+        
+    }
+
+    public void testRemoveItemLhs() {
+        final RuleModel model = new RuleModel();
+
+        model.lhs = new IPattern[3];
+        final FactPattern x = new FactPattern( "Car" );
+        model.lhs[0] = x;
+        x.boundName = "x";
+
+        final FactPattern y = new FactPattern( "Car" );
+        model.lhs[1] = y;
+        y.boundName = "y";
+
+        final FactPattern other = new FactPattern( "House" );
+        model.lhs[2] = other;
+
+        assertEquals( 3,
+                      model.lhs.length );
+        assertEquals( x,
+                      model.lhs[0] );
+
+        model.removeLhsItem( 0 );
+
+        assertEquals( 2,
+                      model.lhs.length );
+        assertEquals( y,
+                      model.lhs[0] );
+    }
+
+    public void testRemoveItemRhs() {
+        final RuleModel model = new RuleModel();
+
+        model.rhs = new IAction[3];
+        final ActionRetractFact r0 = new ActionRetractFact( "x" );
+        final ActionRetractFact r1 = new ActionRetractFact( "y" );
+        final ActionRetractFact r2 = new ActionRetractFact( "z" );
+
+        model.rhs[0] = r0;
+        model.rhs[1] = r1;
+        model.rhs[2] = r2;
+
+        model.removeRhsItem( 1 );
+
+        assertEquals( 2,
+                      model.rhs.length );
+        assertEquals( r0,
+                      model.rhs[0] );
+        assertEquals( r2,
+                      model.rhs[1] );
+    }
+
+    public void testAddItemLhs() {
+        final RuleModel model = new RuleModel();
+        final FactPattern x = new FactPattern();
+        model.addLhsItem( x );
+        assertEquals( 1,
+                      model.lhs.length );
+
+        final FactPattern y = new FactPattern();
+        model.addLhsItem( y );
+
+        assertEquals( 2,
+                      model.lhs.length );
+        assertEquals( x,
+                      model.lhs[0] );
+        assertEquals( y,
+                      model.lhs[1] );
+
+    }
+
+    public void testAddItemRhs() {
+        final RuleModel model = new RuleModel();
+        final IAction a0 = new ActionSetField();
+        final IAction a1 = new ActionSetField();
+
+        model.addRhsItem( a0 );
+
+        assertEquals( 1,
+                      model.rhs.length );
+        model.addRhsItem( a1 );
+
+        assertEquals( 2,
+                      model.rhs.length );
+
+        assertEquals( a0,
+                      model.rhs[0] );
+        assertEquals( a1,
+                      model.rhs[1] );
+    }
+
+    public void testAttributes() {
+        final RuleModel m = new RuleModel();
+        final RuleAttribute at = new RuleAttribute( "salience",
+                                              "42" );
+        m.addAttribute( at );
+        assertEquals( 1,
+                      m.attributes.length );
+        assertEquals( at,
+                      m.attributes[0] );
+
+        final RuleAttribute at2 = new RuleAttribute( "agenda-group",
+                                               "x" );
+        m.addAttribute( at2 );
+        assertEquals( 2,
+                      m.attributes.length );
+        assertEquals( at2,
+                      m.attributes[1] );
+
+        m.removeAttribute( 0 );
+        assertEquals( 1,
+                      m.attributes.length );
+        assertEquals( at2,
+                      m.attributes[0] );
+    }
+    
+    public void testIsDSLEnhanced() throws Exception {
+        RuleModel m = new RuleModel();
+        
+        assertFalse(m.hasDSLSentences());
+        
+        m.addLhsItem( new FactPattern() );
+        assertFalse(m.hasDSLSentences());
+        
+        m.addRhsItem( new ActionSetField("q") );
+        
+        assertFalse(m.hasDSLSentences());
+        
+        m.addLhsItem( new DSLSentence() );
+        assertTrue(m.hasDSLSentences());
+        
+        m.addRhsItem( new DSLSentence() );
+        assertTrue(m.hasDSLSentences());
+        
+        m = new RuleModel();
+        
+        m.addLhsItem( new DSLSentence() );
+        assertTrue(m.hasDSLSentences());
+        
+        m = new RuleModel();
+        m.addRhsItem( new DSLSentence() );
+        assertTrue(m.hasDSLSentences());
+        
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.brms.modeldriven;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SampleDataSource {
+
+	public static List getData() {
+		return new ArrayList() {{
+			add("Hello");
+			add("World");
+		}};
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource2.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource2.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/SampleDataSource2.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.brms.modeldriven;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SampleDataSource2 {
+
+	public Map loadData() {
+		Map data = new HashMap();
+
+		List d = new ArrayList();
+		d.add("hey");
+		d.add("ho");
+		data.put("whee", d);
+
+		return data;
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/package.html
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/package.html	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/modeldriven/package.html	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+<body>
+This contains utilities and widgets for the model driven/scorecard style way of
+editing a rule.
+
+This has the interesting feature of being able to work over standard DRL, no special markup needed.
+Its actually a subset of DRL, complex structures and semantics can not be supported.
+
+However, this can be augmented with DSLs which can express any construct needed.
+
+</body>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SomeFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SomeFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SomeFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,126 @@
+package org.drools.brms.server.rules;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+import org.drools.Cheese;
+
+public class SomeFact {
+    private static final long serialVersionUID = 400L;
+    private String            name;
+    private String            likes;
+    private int               age;
+    private BigDecimal        bigDecimal;
+    private BigInteger        bigInteger;
+    private String            hair;
+
+    private char              sex;
+
+    private boolean           alive;
+
+    private String            status;
+
+    private Cheese            cheese;
+
+    private Date              date;
+
+    private Boolean           dead;
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public boolean isAlive() {
+        return alive;
+    }
+
+    public void setAlive(boolean alive) {
+        this.alive = alive;
+    }
+
+    public BigDecimal getBigDecimal() {
+        return bigDecimal;
+    }
+
+    public void setBigDecimal(BigDecimal bigDecimal) {
+        this.bigDecimal = bigDecimal;
+    }
+
+    public BigInteger getBigInteger() {
+        return bigInteger;
+    }
+
+    public void setBigInteger(BigInteger bigInteger) {
+        this.bigInteger = bigInteger;
+    }
+
+    public Cheese getCheese() {
+        return cheese;
+    }
+
+    public void setCheese(Cheese cheese) {
+        this.cheese = cheese;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Boolean getDead() {
+        return dead;
+    }
+
+    public void setDead(Boolean dead) {
+        this.dead = dead;
+    }
+
+    public String getHair() {
+        return hair;
+    }
+
+    public void setHair(String hair) {
+        this.hair = hair;
+    }
+
+    public String getLikes() {
+        return likes;
+    }
+
+    public void setLikes(String likes) {
+        this.likes = likes;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public char getSex() {
+        return sex;
+    }
+
+    public void setSex(char sex) {
+        this.sex = sex;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SuggestionCompletionLoaderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SuggestionCompletionLoaderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/rules/SuggestionCompletionLoaderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,97 @@
+package org.drools.brms.server.rules;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+
+public class SuggestionCompletionLoaderTest extends TestCase {
+
+    public void testSuggestionCompLoader() throws Exception {
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.Person", new ArrayList(), new ArrayList() );
+        assertNotNull(eng);
+
+    }
+
+
+    public void testLoadDifferentFieldTypes() throws Exception {
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.brms.server.rules.SomeFact", new ArrayList(), new ArrayList() );
+        assertNotNull(eng);
+
+        assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, eng.getFieldType( "SomeFact", "age" ));
+        assertEquals(SuggestionCompletionEngine.TYPE_STRING, eng.getFieldType( "SomeFact", "likes"));
+        assertEquals(SuggestionCompletionEngine.TYPE_STRING, eng.getFieldType( "SomeFact","name"));
+        assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, eng.getFieldType("SomeFact", "bigDecimal"));
+        assertEquals(SuggestionCompletionEngine.TYPE_COMPARABLE, eng.getFieldType( "SomeFact", "date"));
+        assertEquals(SuggestionCompletionEngine.TYPE_OBJECT, eng.getFieldType( "SomeFact", "cheese"));
+        assertEquals(SuggestionCompletionEngine.TYPE_BOOLEAN, eng.getFieldType( "SomeFact", "dead"));
+        assertEquals(SuggestionCompletionEngine.TYPE_BOOLEAN, eng.getFieldType( "SomeFact", "alive"));
+
+    }
+
+    public void testGlobal() throws Exception {
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n global org.drools.Person p", new ArrayList(), new ArrayList() );
+        assertNotNull(eng);
+        assertFalse(loader.hasErrors());
+
+        assertEquals(1, eng.getGlobalVariables().length);
+        assertEquals("p", eng.getGlobalVariables()[0]);
+        assertEquals("Person", eng.globalTypes.get("p"));
+
+    }
+
+    public void testSortOrderOfFields() throws Exception {
+
+	    SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+	    SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.brms.server.rules.SomeFact", new ArrayList(), new ArrayList() );
+	    assertNotNull(eng);
+
+	    String[] fields = eng.getFieldCompletions("SomeFact");
+
+	    assertEquals("age", fields[0]);
+	    assertEquals("alive", fields[1]);
+	    assertEquals("bigDecimal", fields[2]);
+
+    }
+
+    public void testSortOrderOfFacts() throws Exception {
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
+        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.brms.server.rules.SomeFact\n import org.drools.Person", new ArrayList(), new ArrayList() );
+        assertNotNull(eng);
+        String[] facts  = eng.getFactTypes();
+        assertEquals(2, facts.length);
+
+        assertEquals("Person", facts[0]);
+        assertEquals("SomeFact", facts[1]);
+
+
+    }
+
+
+    public void testLoaderWithExistingClassloader() throws Exception {
+        MockClassLoader mcl = new MockClassLoader();
+        SuggestionCompletionLoader loader = new SuggestionCompletionLoader(mcl);
+        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.foo.Bar", new ArrayList(), new ArrayList() );
+        assertNotNull(eng);
+        assertNotNull(eng.dataEnumLists);
+        assertTrue(mcl.called);
+
+    }
+
+
+    static class MockClassLoader extends ClassLoader {
+
+        public boolean called = false;
+
+        public Class loadClass(String name) {
+            called = true;
+            return Object.class;
+        }
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRDRLPersistenceTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRDRLPersistenceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRDRLPersistenceTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,577 @@
+package org.drools.brms.server.util;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionInsertLogicalFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionUpdateField;
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.ConnectiveConstraint;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+public class BRDRLPersistenceTest extends TestCase {
+
+    private BRLPersistence p;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        p = BRDRLPersistence.getInstance();
+    }
+
+    public void testGenerateEmptyDRL() {
+        String expected = "rule \"null\"\n\tdialect \"mvel\"\n\twhen\n\tthen\nend\n";
+
+        final String drl = p.marshal( new RuleModel() );
+
+        assertNotNull( drl );
+        assertEquals( expected,
+                      drl );
+    }
+
+    public void testBasics() {
+        String expected = "rule \"my rule\"\n\tno-loop true\n\tdialect \"mvel\"\n\twhen\n\t\tPerson( )\n" +
+                          "\t\tAccident( )\n\tthen\n\t\tinsert( new Report() );\nend\n";
+        final RuleModel m = new RuleModel();
+        m.addLhsItem( new FactPattern( "Person" ) );
+        m.addLhsItem( new FactPattern( "Accident" ) );
+        m.addAttribute( new RuleAttribute( "no-loop",
+                                           "true" ) );
+
+        m.addRhsItem( new ActionInsertFact( "Report" ) );
+        m.name = "my rule";
+
+        final String drl = p.marshal( m );
+        assertEquals( expected,
+                      drl );
+    }
+
+    public void testMoreComplexRendering() {
+        final RuleModel m = getComplexModel();
+        String expected = "rule \"Complex Rule\"\n" +
+                          "\tno-loop true\n" +
+                          "\tsalience -10\n" +
+                          "\tagenda-group \"aGroup\"\n" +
+                          "\tdialect \"mvel\"\n" +
+                          "\twhen\n"+
+                          "\t\t>p1 : Person( f1 : age < 42 )\n"+
+                          "\t\t>not Cancel( )\n"+
+                          "\tthen\n"+
+                          "\t\t>p1.setStatus( \"rejected\" );\n"+
+                          "\t\t>update( p1 );\n"+
+                          "\t\t>retract( p1 );\n"+
+                          "\t\tSend an email to administrator\n"+
+                          "end\n";
+
+        final String drl = p.marshal( m );
+
+        assertEquals( expected, drl );
+
+    }
+
+
+    public void testFieldBindingWithNoConstraints() {
+        //to satisfy JBRULES-850
+        RuleModel m = getModelWithNoConstraints();
+        String s = BRDRLPersistence.getInstance().marshal( m );
+        //System.out.println(s);
+        assertTrue(s.indexOf( "Person( f1 : age)" ) != -1);
+    }
+
+    //
+    //    public void testRoundTrip() {
+    //        final RuleModel m = getComplexModel();
+    //
+    //        final String xml = BRXMLPersistence.getInstance().marshal( m );
+    //
+    //        final RuleModel m2 = BRXMLPersistence.getInstance().unmarshal( xml );
+    //        assertNotNull( m2 );
+    //        assertEquals( m.name,
+    //                      m2.name );
+    //        assertEquals( m.lhs.length,
+    //                      m2.lhs.length );
+    //        assertEquals( m.rhs.length,
+    //                      m2.rhs.length );
+    //        assertEquals( 1,
+    //                      m.attributes.length );
+    //
+    //        final RuleAttribute at = m.attributes[0];
+    //        assertEquals( "no-loop",
+    //                      at.attributeName );
+    //        assertEquals( "true",
+    //                      at.value );
+    //
+    //        final String newXML = BRXMLPersistence.getInstance().marshal( m2 );
+    //        assertEquals( xml,
+    //                      newXML );
+    //
+    //    }
+    //
+
+    private RuleModel getModelWithNoConstraints() {
+        final RuleModel m = new RuleModel();
+        m.name = "Complex Rule";
+        final FactPattern pat = new FactPattern();
+        pat.boundName = "p1";
+        pat.factType = "Person";
+        final SingleFieldConstraint con = new SingleFieldConstraint();
+        con.fieldBinding = "f1";
+        con.fieldName = "age";
+//        con.operator = "<";
+//        con.value = "42";
+        pat.addConstraint( con );
+
+        m.addLhsItem( pat );
+
+        return m;
+    }
+
+    private RuleModel getComplexModel() {
+        final RuleModel m = new RuleModel();
+        m.name = "Complex Rule";
+
+        m.addAttribute( new RuleAttribute( "no-loop",
+                                           "true" ) );
+        m.addAttribute( new RuleAttribute( "salience",
+                                           "-10" ) );
+        m.addAttribute( new RuleAttribute( "agenda-group",
+                                           "aGroup" ) );
+
+        final FactPattern pat = new FactPattern();
+        pat.boundName = "p1";
+        pat.factType = "Person";
+        final SingleFieldConstraint con = new SingleFieldConstraint();
+        con.fieldBinding = "f1";
+        con.fieldName = "age";
+        con.operator = "<";
+        con.value = "42";
+        pat.addConstraint( con );
+
+        m.addLhsItem( pat );
+
+        final CompositeFactPattern comp = new CompositeFactPattern( "not" );
+        comp.addFactPattern( new FactPattern( "Cancel" ) );
+        m.addLhsItem( comp );
+
+        final ActionUpdateField set = new ActionUpdateField();
+        set.variable = "p1";
+        set.addFieldValue( new ActionFieldValue( "status",
+                                                 "rejected",
+                                                 SuggestionCompletionEngine.TYPE_STRING ) );
+        m.addRhsItem( set );
+
+        final ActionRetractFact ret = new ActionRetractFact( "p1" );
+        m.addRhsItem( ret );
+
+        final DSLSentence sen = new DSLSentence();
+        sen.sentence = "Send an email to {administrator}";
+
+        m.addRhsItem( sen );
+        return m;
+    }
+
+    public void testOrComposite() throws Exception {
+    	RuleModel m  = new RuleModel();
+    	m.name = "or";
+    	CompositeFactPattern cp = new CompositeFactPattern(CompositeFactPattern.COMPOSITE_TYPE_OR);
+    	FactPattern p1 = new FactPattern("Person");
+    	SingleFieldConstraint sf1 = new SingleFieldConstraint("age");
+    	sf1.operator = "==";
+    	sf1.value = "42";
+    	p1.addConstraint(sf1);
+
+    	cp.addFactPattern(p1);
+
+    	FactPattern p2 = new FactPattern("Person");
+    	SingleFieldConstraint sf2 = new SingleFieldConstraint("age");
+    	sf2.operator = "==";
+    	sf2.value = "43";
+    	p2.addConstraint(sf2);
+
+    	cp.addFactPattern(p2);
+
+    	m.addLhsItem(cp);
+
+    	String result = BRDRLPersistence.getInstance().marshal(m);
+    	assertTrue(result.indexOf("( Person( age == 42 ) or Person( age == 43 ) )") > 0);
+
+
+    }
+
+    public void testExistsMultiPatterns() throws Exception {
+    	String result = getCompositeFOL(CompositeFactPattern.COMPOSITE_TYPE_EXISTS);
+    	assertTrue(result.indexOf("exists (Person( age == 42 ) and Person( age == 43 ))") > 0);
+    }
+
+    public void testNotMultiPatterns() throws Exception {
+    	String result = getCompositeFOL(CompositeFactPattern.COMPOSITE_TYPE_NOT);
+    	assertTrue(result.indexOf("not (Person( age == 42 ) and Person( age == 43 ))") > 0);
+    }
+
+    public void testSingleExists() throws Exception {
+		RuleModel m  = new RuleModel();
+    	m.name = "or";
+    	CompositeFactPattern cp = new CompositeFactPattern(CompositeFactPattern.COMPOSITE_TYPE_EXISTS);
+    	FactPattern p1 = new FactPattern("Person");
+    	SingleFieldConstraint sf1 = new SingleFieldConstraint("age");
+    	sf1.operator = "==";
+    	sf1.value = "42";
+    	p1.addConstraint(sf1);
+
+    	cp.addFactPattern(p1);
+
+
+    	m.addLhsItem(cp);
+
+    	String result = BRDRLPersistence.getInstance().marshal(m);
+
+    	assertTrue(result.indexOf("exists Person( age == 42 )") > 0);
+
+    }
+
+
+	private String getCompositeFOL(String type) {
+		RuleModel m  = new RuleModel();
+    	m.name = "or";
+    	CompositeFactPattern cp = new CompositeFactPattern(type);
+    	FactPattern p1 = new FactPattern("Person");
+    	SingleFieldConstraint sf1 = new SingleFieldConstraint("age");
+    	sf1.operator = "==";
+    	sf1.value = "42";
+    	p1.addConstraint(sf1);
+
+    	cp.addFactPattern(p1);
+
+    	FactPattern p2 = new FactPattern("Person");
+    	SingleFieldConstraint sf2 = new SingleFieldConstraint("age");
+    	sf2.operator = "==";
+    	sf2.value = "43";
+    	p2.addConstraint(sf2);
+
+    	cp.addFactPattern(p2);
+
+    	m.addLhsItem(cp);
+
+    	String result = BRDRLPersistence.getInstance().marshal(m);
+
+		return result;
+	}
+
+    //    public void testLoadEmpty() {
+    //        RuleModel m = BRXMLPersistence.getInstance().unmarshal( null );
+    //        assertNotNull( m );
+    //
+    //        m = BRXMLPersistence.getInstance().unmarshal( "" );
+    //        assertNotNull( m );
+    //    }
+
+    public void testCompositeConstraints() {
+        RuleModel m = new RuleModel();
+        m.name = "with composite";
+
+        FactPattern p1 = new FactPattern("Person");
+        p1.boundName = "p1";
+        m.addLhsItem( p1 );
+
+        FactPattern p = new FactPattern("Goober");
+        m.addLhsItem( p );
+        CompositeFieldConstraint comp = new CompositeFieldConstraint();
+        comp.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_OR;
+        p.addConstraint( comp );
+
+        final SingleFieldConstraint X = new SingleFieldConstraint();
+        X.fieldName = "goo";
+        X.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        X.value = "foo";
+        X.operator = "==";
+        X.connectives = new ConnectiveConstraint[1];
+        X.connectives[0] = new ConnectiveConstraint();
+        X.connectives[0].constraintValueType = ConnectiveConstraint.TYPE_LITERAL;
+        X.connectives[0].operator = "|| ==";
+        X.connectives[0].value = "bar";
+        comp.addConstraint( X );
+
+        final SingleFieldConstraint Y = new SingleFieldConstraint();
+        Y.fieldName = "goo2";
+        Y.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        Y.value = "foo";
+        Y.operator = "==";
+        comp.addConstraint( Y );
+
+        CompositeFieldConstraint comp2 = new CompositeFieldConstraint();
+        comp2.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_AND;
+        final SingleFieldConstraint Q1 = new SingleFieldConstraint();
+        Q1.fieldName = "goo";
+        Q1.operator = "==";
+        Q1.value = "whee";
+        Q1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+
+        comp2.addConstraint( Q1 );
+
+        final SingleFieldConstraint Q2 = new SingleFieldConstraint();
+        Q2.fieldName = "gabba";
+        Q2.operator = "==";
+        Q2.value = "whee";
+        Q2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+
+        comp2.addConstraint( Q2 );
+
+        //now nest it
+        comp.addConstraint( comp2 );
+
+
+
+        final SingleFieldConstraint Z = new SingleFieldConstraint();
+        Z.fieldName = "goo3";
+        Z.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        Z.value = "foo";
+        Z.operator = "==";
+
+        p.addConstraint( Z );
+
+        ActionInsertFact ass = new ActionInsertFact("Whee");
+        m.addRhsItem( ass );
+
+        String actual = BRDRLPersistence.getInstance().marshal( m );
+        String expected = "rule \"with composite\" " +
+            " \tdialect \"mvel\"\n when " +
+                "p1 : Person( ) " +
+                "Goober( goo == \"foo\"  || == \"bar\" || goo2 == \"foo\" || ( goo == \"whee\" && gabba == \"whee\" ), goo3 == \"foo\" )" +
+            " then " +
+                "insert( new Whee() );" +
+        "end";
+        assertEqualsIgnoreWhitespace( expected, actual );
+
+    }
+
+    public void testFieldsDeclaredButNoConstraints() {
+        RuleModel m = new RuleModel();
+        m.name = "boo";
+
+        FactPattern p = new FactPattern();
+        p.factType = "Person";
+
+        //this isn't an effective constraint, so it should be ignored.
+        p.addConstraint( new SingleFieldConstraint("field1") );
+
+        m.addLhsItem( p );
+
+        String actual = BRDRLPersistence.getInstance().marshal( m );
+
+        String expected = "rule \"boo\" \tdialect \"mvel\"\n when Person() then end";
+
+        assertEqualsIgnoreWhitespace( expected, actual );
+
+        SingleFieldConstraint con = (SingleFieldConstraint) p.constraintList.constraints[0];
+        con.fieldBinding = "q";
+
+        //now it should appear, as we are binding a var to it
+
+        actual = BRDRLPersistence.getInstance().marshal( m );
+
+        expected = "rule \"boo\" dialect \"mvel\" when Person(q : field1) then end";
+
+        assertEqualsIgnoreWhitespace( expected, actual );
+
+
+    }
+
+    public void testLiteralStrings() {
+
+        RuleModel m = new RuleModel();
+        m.name = "test literal strings";
+
+        FactPattern p = new FactPattern("Person");
+        SingleFieldConstraint con = new SingleFieldConstraint();
+        con.fieldName = "field1";
+        con.operator = "==";
+        con.value = "goo";
+        con.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        p.addConstraint( con );
+
+
+        SingleFieldConstraint con2 = new SingleFieldConstraint();
+        con2.fieldName = "field2";
+        con2.operator = "==";
+        con2.value = "variableHere";
+        con2.constraintValueType = SingleFieldConstraint.TYPE_VARIABLE;
+        p.addConstraint( con2 );
+
+
+
+        m.addLhsItem( p );
+
+        String result = BRDRLPersistence.getInstance().marshal( m );
+
+        assertEqualsIgnoreWhitespace( "rule \"test literal strings\"" +
+                                          "\tdialect \"mvel\"\n when " +
+                                          "     Person(field1 == \"goo\", field2 == variableHere)" +
+                                          " then " +
+                                          "end", result );
+
+
+
+
+    }
+
+    private void assertEqualsIgnoreWhitespace(final String expected,
+                                              final String actual) {
+        final String cleanExpected = expected.replaceAll( "\\s+",
+                                                          "" );
+        final String cleanActual = actual.replaceAll( "\\s+",
+                                                      "" );
+
+        assertEquals( cleanExpected,
+                      cleanActual );
+    }
+
+    public void testReturnValueConstraint() {
+        RuleModel m = new RuleModel();
+        m.name = "yeah";
+
+        FactPattern p = new FactPattern();
+
+        SingleFieldConstraint con = new SingleFieldConstraint();
+        con.constraintValueType = SingleFieldConstraint.TYPE_RET_VALUE;
+        con.value = "someFunc(x)";
+        con.operator = "==";
+        con.fieldName = "goo";
+        p.factType = "Goober";
+
+        p.addConstraint( con );
+        m.addLhsItem( p );
+
+        String actual = BRDRLPersistence.getInstance().marshal( m );
+        //System.err.println(actual);
+
+
+        String expected = "rule \"yeah\" " +
+                            "\tdialect \"mvel\"\n when " +
+                                    "Goober( goo == ( someFunc(x) ) )" +
+                            " then " +
+                            "end";
+        assertEqualsIgnoreWhitespace( expected, actual);
+    }
+
+    public void testPredicateConstraint() {
+        RuleModel m = new RuleModel();
+        m.name = "yeah";
+
+        FactPattern p = new FactPattern();
+
+        SingleFieldConstraint con = new SingleFieldConstraint();
+        con.constraintValueType = SingleFieldConstraint.TYPE_PREDICATE;
+        con.value = "field soundslike 'poo'";
+
+        p.factType = "Goober";
+
+        p.addConstraint( con );
+        m.addLhsItem( p );
+
+        String actual = BRDRLPersistence.getInstance().marshal( m );
+        //System.err.println(actual);
+
+
+        String expected = "rule \"yeah\" " +
+                            "\tdialect \"mvel\"\n when " +
+                                    "Goober( eval( field soundslike 'poo' ) )" +
+                            " then " +
+                            "end";
+        assertEqualsIgnoreWhitespace( expected, actual);
+    }
+
+
+    public void testConnective() {
+
+        RuleModel m = new RuleModel();
+        m.name = "test literal strings";
+
+        FactPattern p = new FactPattern("Person");
+        SingleFieldConstraint con = new SingleFieldConstraint();
+        con.fieldName = "field1";
+        con.operator = "==";
+        con.value = "goo";
+        con.constraintValueType = SingleFieldConstraint.TYPE_VARIABLE;
+        p.addConstraint( con );
+
+        ConnectiveConstraint connective = new ConnectiveConstraint();
+        connective.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        connective.operator = "|| ==";
+        connective.value = "blah";
+
+        con.connectives = new ConnectiveConstraint[1];
+        con.connectives[0] = connective;
+
+        m.addLhsItem( p );
+
+        String result = BRDRLPersistence.getInstance().marshal( m );
+
+        String expected = "rule \"test literal strings\" " +
+            "\tdialect \"mvel\"\n when " +
+                "Person( field1 == goo  || == \"blah\" )" +
+                " then " +
+                "end";
+        assertEqualsIgnoreWhitespace( expected, result );
+
+
+    }
+
+    public void testInvalidComposite() throws Exception {
+        RuleModel m = new RuleModel();
+        CompositeFactPattern com = new CompositeFactPattern("not");
+        m.addLhsItem( com );
+
+        String s = BRDRLPersistence.getInstance().marshal( m );
+        assertNotNull(s);
+
+        m.addLhsItem( new CompositeFactPattern("or") );
+        m.addLhsItem( new CompositeFactPattern("exists") );
+        s = BRDRLPersistence.getInstance().marshal( m );
+        assertNotNull(s);
+    }
+
+    public void testAssertWithDSL() throws Exception {
+        RuleModel m = new RuleModel();
+        DSLSentence sen = new DSLSentence();
+        sen.sentence = "I CAN HAS DSL";
+        m.addRhsItem( sen );
+        ActionInsertFact ins = new ActionInsertFact("Shizzle");
+        ActionFieldValue val = new ActionFieldValue("goo", "42", "Numeric");
+        ins.fieldValues = new ActionFieldValue[1];
+        ins.fieldValues[0] = val;
+        m.addRhsItem( ins );
+
+        ActionInsertLogicalFact insL = new ActionInsertLogicalFact("Shizzle");
+        ActionFieldValue valL = new ActionFieldValue("goo", "42", "Numeric");
+        insL.fieldValues = new ActionFieldValue[1];
+        insL.fieldValues[0] = valL;
+        m.addRhsItem( insL );
+
+        String result = BRDRLPersistence.getInstance().marshal( m );
+        assertTrue(result.indexOf( ">insert" ) > -1);
+
+        assertTrue(result.indexOf( ">insertLogical" ) > -1);
+    }
+
+    public void testDefaultMVEL() {
+        RuleModel m = new RuleModel();
+
+        String s = BRDRLPersistence.getInstance().marshal( m );
+        assertTrue(s.indexOf( "mvel" ) > -1);
+
+        m.addAttribute( new RuleAttribute("dialect", "goober") );
+        s = BRDRLPersistence.getInstance().marshal( m );
+        assertFalse(s.indexOf( "mvel" ) > -1);
+        assertTrue(s.indexOf( "goober" ) > -1);
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRLPersitenceTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRLPersitenceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/BRLPersitenceTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,257 @@
+package org.drools.brms.server.util;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionUpdateField;
+import org.drools.brms.client.modeldriven.brl.CompositeFactPattern;
+import org.drools.brms.client.modeldriven.brl.CompositeFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.ConnectiveConstraint;
+import org.drools.brms.client.modeldriven.brl.DSLSentence;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+
+public class BRLPersitenceTest extends TestCase {
+
+    public void testGenerateEmptyXML() {
+        final BRLPersistence p = BRXMLPersistence.getInstance();
+        final String xml = p.marshal( new RuleModel() );
+        assertNotNull( xml );
+        assertFalse( xml.equals( "" ) );
+
+        assertTrue( xml.startsWith( "<rule>" ) );
+        assertTrue( xml.endsWith( "</rule>" ) );
+    }
+
+    public void testBasics() {
+        final BRLPersistence p = BRXMLPersistence.getInstance();
+        final RuleModel m = new RuleModel();
+        m.addLhsItem( new FactPattern( "Person" ) );
+        m.addLhsItem( new FactPattern( "Accident" ) );
+        m.addAttribute( new RuleAttribute( "no-loop",
+                                           "true" ) );
+
+        m.addRhsItem( new ActionInsertFact( "Report" ) );
+        m.name = "my rule";
+        final String xml = p.marshal( m );
+        //System.out.println(xml);
+        assertTrue( xml.indexOf( "Person" ) > -1 );
+        assertTrue( xml.indexOf( "Accident" ) > -1 );
+        assertTrue( xml.indexOf( "no-loop" ) > -1 );
+        assertTrue( xml.indexOf( "org.drools" ) == -1 );
+
+    }
+
+    public void testMoreComplexRendering() {
+        final BRLPersistence p = BRXMLPersistence.getInstance();
+        final RuleModel m = getComplexModel();
+
+        final String xml = p.marshal( m );
+        System.out.println( xml );
+
+        assertTrue( xml.indexOf( "org.drools" ) == -1 );
+
+    }
+
+    public void testRoundTrip() {
+        final RuleModel m = getComplexModel();
+
+        final String xml = BRXMLPersistence.getInstance().marshal( m );
+
+        final RuleModel m2 = BRXMLPersistence.getInstance().unmarshal( xml );
+        assertNotNull( m2 );
+        assertEquals( m.name,
+                      m2.name );
+        assertEquals( m.lhs.length,
+                      m2.lhs.length );
+        assertEquals( m.rhs.length,
+                      m2.rhs.length );
+        assertEquals( 1,
+                      m.attributes.length );
+
+        final RuleAttribute at = m.attributes[0];
+        assertEquals( "no-loop",
+                      at.attributeName );
+        assertEquals( "true",
+                      at.value );
+
+        final String newXML = BRXMLPersistence.getInstance().marshal( m2 );
+        assertEquals( xml,
+                      newXML );
+
+    }
+    
+    public void testCompositeConstraintsRoundTrip() throws Exception {
+        RuleModel m = new RuleModel();
+        m.name = "with composite";
+    
+        FactPattern p1 = new FactPattern("Person");
+        p1.boundName = "p1";
+        m.addLhsItem( p1 );
+        
+        FactPattern p = new FactPattern("Goober");
+        m.addLhsItem( p );
+        CompositeFieldConstraint comp = new CompositeFieldConstraint();
+        comp.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_OR;
+        p.addConstraint( comp );
+        
+        final SingleFieldConstraint X = new SingleFieldConstraint();
+        X.fieldName = "goo";
+        X.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        X.value = "foo";
+        X.operator = "==";
+        X.connectives = new ConnectiveConstraint[1];
+        X.connectives[0] = new ConnectiveConstraint();
+        X.connectives[0].constraintValueType = ConnectiveConstraint.TYPE_LITERAL;
+        X.connectives[0].operator = "|| ==";
+        X.connectives[0].value = "bar";
+        comp.addConstraint( X );
+        
+        final SingleFieldConstraint Y = new SingleFieldConstraint();
+        Y.fieldName = "goo2";
+        Y.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        Y.value = "foo";
+        Y.operator = "==";
+        comp.addConstraint( Y );
+
+        CompositeFieldConstraint comp2 = new CompositeFieldConstraint();
+        comp2.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_AND;
+        final SingleFieldConstraint Q1 = new SingleFieldConstraint();
+        Q1.fieldName = "goo";
+        Q1.operator = "==";
+        Q1.value = "whee";
+        Q1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        
+        comp2.addConstraint( Q1 );
+        
+        final SingleFieldConstraint Q2 = new SingleFieldConstraint();
+        Q2.fieldName = "gabba";
+        Q2.operator = "==";
+        Q2.value = "whee";
+        Q2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        
+        comp2.addConstraint( Q2 );
+        
+        //now nest it
+        comp.addConstraint( comp2 );
+        
+        
+        
+        final SingleFieldConstraint Z = new SingleFieldConstraint();
+        Z.fieldName = "goo3";
+        Z.constraintValueType = SingleFieldConstraint.TYPE_LITERAL;
+        Z.value = "foo";
+        Z.operator = "==";
+        
+        p.addConstraint( Z );
+        
+        ActionInsertFact ass = new ActionInsertFact("Whee");
+        m.addRhsItem( ass );
+
+        
+        String xml = BRXMLPersistence.getInstance().marshal( m );
+        //System.err.println(xml);
+        
+        RuleModel m2 = BRXMLPersistence.getInstance().unmarshal( xml );
+        assertNotNull(m2);
+        assertEquals("with composite", m2.name);
+        
+        assertEquals(m2.lhs.length, m.lhs.length);
+        assertEquals(m2.rhs.length, m.rhs.length);
+        
+        
+        
+        
+    }
+
+    /**
+     * This will verify that we can load an old BRL change. If this fails,
+     * then backwards compatability is broken.
+     */
+    public void testBackwardsCompat() throws Exception {
+        RuleModel m2 = BRXMLPersistence.getInstance().unmarshal( loadResource( "existing_brl.xml" ) );
+        
+        assertNotNull(m2);
+        assertEquals(3, m2.rhs.length);
+    }
+    
+    private String loadResource(final String name) throws Exception {
+
+        //        System.err.println( getClass().getResource( name ) );
+        final InputStream in = getClass().getResourceAsStream( name );
+
+    
+        final Reader reader = new InputStreamReader( in );
+
+        final StringBuffer text = new StringBuffer();
+
+        final char[] buf = new char[1024];
+        int len = 0;
+
+        while ( (len = reader.read( buf )) >= 0 ) {
+            text.append( buf,
+                         0,
+                         len );
+        }
+
+        return text.toString();
+    }    
+
+    private RuleModel getComplexModel() {
+        final RuleModel m = new RuleModel();
+
+        m.addAttribute( new RuleAttribute( "no-loop",
+                                           "true" ) );
+
+        final FactPattern pat = new FactPattern();
+        pat.boundName = "p1";
+        pat.factType = "Person";
+        final SingleFieldConstraint con = new SingleFieldConstraint();
+        con.fieldBinding = "f1";
+        con.fieldName = "age";
+        con.operator = "<";
+        con.value = "42";
+        pat.addConstraint( con );
+
+        m.addLhsItem( pat );
+
+        final CompositeFactPattern comp = new CompositeFactPattern( "not" );
+        comp.addFactPattern( new FactPattern( "Cancel" ) );
+        m.addLhsItem( comp );
+
+        final ActionUpdateField set = new ActionUpdateField();
+        set.variable = "p1";
+        set.addFieldValue( new ActionFieldValue( "status",
+                                                 "rejected",
+                                                 SuggestionCompletionEngine.TYPE_STRING ) );
+        m.addRhsItem( set );
+
+        final ActionRetractFact ret = new ActionRetractFact( "p1" );
+        m.addRhsItem( ret );
+
+        final DSLSentence sen = new DSLSentence();
+        sen.sentence = "Send an email to {administrator}";
+
+        m.addRhsItem( sen );
+        return m;
+    }
+
+    public void testLoadEmpty() {
+        RuleModel m = BRXMLPersistence.getInstance().unmarshal( null );
+        assertNotNull( m );
+
+        m = BRXMLPersistence.getInstance().unmarshal( "" );
+        assertNotNull( m );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/ScenarioXMLPersistenceTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/ScenarioXMLPersistenceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/ScenarioXMLPersistenceTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,97 @@
+package org.drools.brms.server.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+
+import junit.framework.TestCase;
+
+public class ScenarioXMLPersistenceTest extends TestCase {
+
+	public void testToXML() {
+		ScenarioXMLPersistence p = ScenarioXMLPersistence.getInstance();
+
+		Scenario sc = new Scenario();
+
+		String s = p.marshal(sc);
+		assertNotNull(s);
+
+		sc = getDemo();
+
+		s = p.marshal(sc);
+
+	    assertTrue(s.indexOf("<ruleName>Life unverse and everything</ruleName>") > 0);
+
+	    Scenario sc_ = p.unmarshal(s);
+	    assertEquals(sc.globals.size(), sc_.globals.size());
+	    assertEquals(sc.fixtures.size(), sc_.fixtures.size());
+	    assertTrue(s.indexOf("org.drools") == -1); //check we have aliased all
+
+	}
+
+	private Scenario getDemo() {
+        //Sample data
+        FactData d1 = new FactData("Driver", "d1", ls(new FieldData[] {new FieldData("age", "42"), new FieldData("name", "david")}), false);
+        FactData d2 = new FactData("Driver", "d2", ls(new FieldData[] {new FieldData("name", "michael")}), false);
+        FactData d3 = new FactData("Driver", "d3", ls(new FieldData[] {new FieldData("name", "michael2")}), false);
+        FactData d4 = new FactData("Accident", "a1", ls(new FieldData[] {new FieldData("name", "michael2")}), false);
+        Scenario sc = new Scenario();
+        sc.fixtures.add(d1);
+        sc.fixtures.add(d2);
+        sc.globals.add(d3);
+        sc.globals.add(d4);
+        sc.rules.add("rule1");
+        sc.rules.add("rule2");
+
+        sc.fixtures.add(new ExecutionTrace());
+
+        List fields = new ArrayList();
+        VerifyField vfl = new VerifyField("age", "42", "==");
+        vfl.actualResult = "43";
+        vfl.successResult = new Boolean(false);
+        vfl.explanation = "Not cool jimmy.";
+
+        fields.add(vfl);
+
+        vfl = new VerifyField("name", "michael", "!=");
+        vfl.actualResult = "bob";
+        vfl.successResult = new Boolean(true);
+        vfl.explanation = "Yeah !";
+        fields.add(vfl);
+
+        VerifyFact vf = new VerifyFact("d1", fields);
+
+        sc.fixtures.add(vf);
+
+        VerifyRuleFired vf1 = new VerifyRuleFired("Life unverse and everything", new Integer(42), null);
+        vf1.actualResult = new Integer(42);
+        vf1.successResult = new Boolean(true);
+        vf1.explanation = "All good here.";
+
+        VerifyRuleFired vf2 = new VerifyRuleFired("Everything else", null, new Boolean(true));
+        vf2.actualResult = new Integer(0);
+        vf2.successResult = new Boolean(false);
+        vf2.explanation = "Not so good here.";
+        sc.fixtures.add(vf1);
+        sc.fixtures.add(vf2);
+
+		return sc;
+	}
+
+	private List ls(FieldData[] fieldDatas) {
+		List ls = new ArrayList();
+		for (int i = 0; i < fieldDatas.length; i++) {
+			ls.add(fieldDatas[i]);
+		}
+		return ls;
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/brms/server/util/SuggestionCompletionEngineBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+package org.drools.brms.server.util;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+
+public class SuggestionCompletionEngineBuilderTest extends TestCase {
+    SuggestionCompletionEngineBuilder builder = new SuggestionCompletionEngineBuilder();
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.builder.newCompletionEngine();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testAddDSLSentence() {
+        final String input = "{This} is a {pattern} considered pretty \\{{easy}\\} by most \\{people\\}. What do you {say}?";
+        this.builder.addDSLActionSentence( input );
+        this.builder.addDSLConditionSentence( "foo bar" );
+        final SuggestionCompletionEngine engine = this.builder.getInstance();
+
+        assertEquals( 1,
+                      engine.actionDSLSentences.length );
+        assertEquals( 1,
+                      engine.conditionDSLSentences.length );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/CompilerPerfProfileTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/CompilerPerfProfileTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/CompilerPerfProfileTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,48 @@
+package org.drools.compiler;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.drools.rule.Package;
+
+import junit.framework.TestCase;
+
+public class CompilerPerfProfileTest extends TestCase {
+
+    public void testProfileRuns() throws Exception {
+
+        //first run for warm up
+        build("JDT", "largeRuleNumber.drl", false);
+        build("MVEL", "largeRuleNumberMVEL.drl", false);
+
+        System.gc();
+        Thread.sleep( 100 );
+        
+        build("MVEL", "largeRuleNumberMVEL.drl", true);        
+
+        System.gc();
+        Thread.sleep( 100 );
+
+        
+        build("JDT", "largeRuleNumber.drl", true);
+        
+
+        
+        
+        
+    }
+
+    private void build(String msg, String resource, boolean showResults) throws DroolsParserException,
+                        IOException {
+        final PackageBuilder builder = new PackageBuilder();
+        long start = System.currentTimeMillis();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( resource ) ) );
+        final Package pkg = builder.getPackage();
+        assertFalse(builder.hasErrors());
+        assertNotNull(pkg);
+        if (showResults) {
+            System.out.print( "Time taken for " + msg + " : " + (System.currentTimeMillis() - start) );
+        }
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/DrlParserTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/DrlParserTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/DrlParserTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,56 @@
+package org.drools.compiler;
+
+import java.io.StringReader;
+
+import org.drools.RuntimeDroolsException;
+import org.drools.lang.Expander;
+import org.drools.lang.dsl.DSLMappingFile;
+import org.drools.lang.dsl.DefaultExpander;
+import org.drools.lang.dsl.DefaultExpanderResolver;
+
+import junit.framework.TestCase;
+
+public class DrlParserTest extends TestCase {
+
+    public void testExpandDRL() throws Exception {
+        String dsl = "[condition]Something=Something()\n[then]another=another();";
+        String drl = "rule 'foo' \n when \n Something \n then \n another \nend";
+        
+        DrlParser parser = new DrlParser();
+        String result = parser.getExpandedDRL( drl, new StringReader(dsl));
+        assertEqualsIgnoreWhitespace( "rule 'foo' \n when \n Something() \n then \n another(); \nend", result );
+    }
+    
+    public void testExpandDRLUsingInjectedExpander() throws Exception {
+        String dsl = "[condition]Something=Something()\n[then]another=another();";
+        String drl = "rule 'foo' \n when \n Something \n then \n another \nend";
+        
+        
+        DefaultExpanderResolver resolver = new DefaultExpanderResolver(new StringReader(dsl));
+        
+        
+        final DSLMappingFile file = new DSLMappingFile();
+        if ( file.parseAndLoad( new StringReader(dsl) ) ) {
+            final Expander expander = new DefaultExpander();
+            expander.addDSLMapping( file.getMapping() );
+            resolver.addExpander("*", expander);
+        } else {
+            throw new RuntimeDroolsException( "Error parsing and loading DSL file." + file.getErrors() );
+        }        
+
+        DrlParser parser = new DrlParser();
+        String result = parser.getExpandedDRL( drl, resolver);
+        assertEqualsIgnoreWhitespace( "rule 'foo' \n when \n Something() \n then \n another(); \nend", result );
+    }
+
+    private void assertEqualsIgnoreWhitespace(final String expected,
+                                              final String actual) {
+        final String cleanExpected = expected.replaceAll( "\\s+",
+                                                          "" );
+        final String cleanActual = actual.replaceAll( "\\s+",
+                                                      "" );
+
+        assertEquals( cleanExpected,
+                      cleanActual );
+    }    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/Java5Test.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/Java5Test.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/Java5Test.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+package org.drools.compiler;
+
+import java.io.InputStreamReader;
+
+import org.drools.DroolsTestCase;
+import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
+
+public class Java5Test extends DroolsTestCase {
+
+    public void testJava5Rule() throws Exception {
+        final String javaVersion = System.getProperty( "java.specification.version" );
+        //do not execute tests under JDK 1.4
+        //otherwise the compiled version cannot be interpreted
+        if ( javaVersion.equals( "1.4" ) ) {
+            System.out.println( "Skipping Java 1.5 tests - current JDK not compatible" );
+            return;
+        }
+        final PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = ( JavaDialectConfiguration ) conf.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.ECLIPSE );
+        javaConf.setJavaLanguageLevel( "1.5" );
+        
+        final PackageBuilder builder = new PackageBuilder( );
+        builder.addPackageFromDrl( new InputStreamReader( this.getClass().getResourceAsStream( "java5_rule.drl" ) ) );
+        assertFalse( builder.hasErrors() );
+    }
+
+    public void testJava14Defaults() throws Exception {
+        final PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = ( JavaDialectConfiguration ) conf.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
+        final PackageBuilder builder = new PackageBuilder( conf );
+        builder.addPackageFromDrl( new InputStreamReader( this.getClass().getResourceAsStream( "java5_rule.drl" ) ) );
+        assertTrue( builder.hasErrors() );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,475 @@
+package org.drools.compiler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.TypeResolver;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.AccumulateBuilder;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.EntryPointBuilder;
+import org.drools.rule.builder.FromBuilder;
+import org.drools.rule.builder.GroupElementBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.PatternBuilder;
+import org.drools.rule.builder.PredicateBuilder;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ProcessClassBuilder;
+import org.drools.rule.builder.QueryBuilder;
+import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleClassBuilder;
+import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.rule.builder.SalienceBuilder;
+import org.drools.rule.builder.TimeWindowBuilder;
+import org.drools.rule.builder.dialect.java.JavaDialect;
+import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.util.ChainedProperties;
+
+public class PackageBuilderConfigurationTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        System.getProperties().remove( "drools.dialect.java.compiler" );
+        System.getProperties().remove( "drools.dialect.default" );
+    }
+
+    protected void tearDown() throws Exception {
+        System.getProperties().remove( "drools.dialect.java.compiler" );
+        System.getProperties().remove( "drools.dialect.default" );
+    }
+
+    public void testIgnoreDetauls() {
+        // check standard chained properties, that includes defaults
+        ChainedProperties chainedProperties = new ChainedProperties( null,
+                                                                     "packagebuilder.conf",
+                                                                     true );
+        //System.out.println( chainedProperties.getProperty( "drools.dialect.java.compiler",
+        //                                                   null ) );
+        assertNotNull( chainedProperties.getProperty( "drools.dialect.java.compiler",
+                                                      null ) );
+
+
+        // now check that chained properties can ignore defaults
+        chainedProperties = new ChainedProperties( null,
+                                                   "packagebuilder.conf",
+                                                   false );
+        //System.out.println( chainedProperties.getProperty( "drools.dialect.java.compiler",
+        //                                                   null ) );
+        assertNull( chainedProperties.getProperty( "drools.dialect.java.compiler",
+                                                   null ) );
+
+
+        // now check it can find defaults again.
+        chainedProperties = new ChainedProperties( null,
+                                                   "packagebuilder.conf",
+                                                   true );
+        //System.out.println( chainedProperties.getProperty( "drools.dialect.java.compiler",
+        //                                                   null ) );
+        assertNotNull( chainedProperties.getProperty( "drools.dialect.java.compiler",
+                                                      null ) );
+    }
+
+    public void testSystemProperties() {
+        PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        assertEquals( JavaDialectConfiguration.ECLIPSE,
+                      javaConf.getCompiler() );
+
+        System.setProperty( "drools.dialect.java.compiler",
+                            "JANINO" );
+        cfg = new PackageBuilderConfiguration();
+        javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        assertEquals( JavaDialectConfiguration.JANINO,
+                      javaConf.getCompiler() );
+
+        PackageBuilderConfiguration cfg2 = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf2 = (JavaDialectConfiguration) cfg2.getDialectConfiguration( "java" );
+        assertEquals( javaConf.getCompiler(),
+                      javaConf2.getCompiler() );
+
+        System.setProperty( "drools.dialect.java.compiler",
+                            "ECLIPSE" );
+        cfg = new PackageBuilderConfiguration();
+        javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        assertEquals( JavaDialectConfiguration.ECLIPSE,
+                      javaConf.getCompiler() );
+
+        javaConf2.setCompiler( JavaDialectConfiguration.ECLIPSE );
+        assertEquals( JavaDialectConfiguration.ECLIPSE,
+                      javaConf2.getCompiler() );
+
+        javaConf2.setCompiler( JavaDialectConfiguration.JANINO );
+        assertEquals( JavaDialectConfiguration.JANINO,
+                      javaConf2.getCompiler() );
+
+        final PackageBuilderConfiguration cfg3 = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf3 = (JavaDialectConfiguration) cfg3.getDialectConfiguration( "java" );
+        assertEquals( javaConf.getCompiler(),
+                      javaConf3.getCompiler() );
+    }
+
+    public void testProgrammaticProperties() {
+        PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
+        assertTrue( cfg.getDefaultDialect().equals( "java") );
+
+        Properties properties = new Properties();
+        properties.setProperty( "drools.dialect.default",
+                                "mvel" );
+        PackageBuilderConfiguration cfg1 = new PackageBuilderConfiguration( properties );
+        assertEquals("mvel", cfg1.getDefaultDialect() );
+
+        final PackageBuilderConfiguration cfg2 = new PackageBuilderConfiguration( properties );
+        assertEquals( cfg1.getDefaultDialect().getClass(),
+                      cfg2.getDefaultDialect().getClass() );
+    }
+
+    public void testProgramaticProperties2() {
+        JavaDialectConfiguration javaConf =  new JavaDialectConfiguration();
+        javaConf.setCompiler( JavaDialectConfiguration.ECLIPSE );
+        PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
+        cfg.setDialectConfiguration( "java", javaConf );
+        JavaDialectConfiguration javaConf2 = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        assertSame( javaConf,
+                    javaConf2 );
+        assertEquals( JavaDialectConfiguration.ECLIPSE,
+                      javaConf2.getCompiler() );
+
+        javaConf =  new JavaDialectConfiguration();
+        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
+        cfg = new PackageBuilderConfiguration();
+        cfg.setDialectConfiguration( "java", javaConf );
+        javaConf2 = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        assertSame( javaConf,
+                    javaConf2 );
+        assertEquals( JavaDialectConfiguration.JANINO,
+                      javaConf2.getCompiler() );
+    }
+
+    public void testMockDialect() {
+        Package pkg = new Package( "org.pkg1" );
+
+        PackageBuilderConfiguration cfg1 = new PackageBuilderConfiguration();
+        MockDialectConfiguration mockConf = new MockDialectConfiguration();
+//        cfg1.buildDialectRegistry().addDialect( "mock",
+//                                                mockConf.getDialect() );
+        
+        cfg1.addDialect("mock", mockConf );
+        cfg1.setDefaultDialect( "mock" );
+
+        PackageBuilder builder = new PackageBuilder( pkg,
+                                                     cfg1 );
+
+        MockDialect mockDialect2 = (MockDialect) builder.getDialectRegistry().getDialect( cfg1.getDefaultDialect() );
+        assertSame( mockConf.getDialect(),
+                    mockDialect2 );
+
+        assertSame( builder,
+                    mockDialect2.getPackageBuilder() );
+        assertSame( pkg,
+                    mockDialect2.getPkg() );
+        assertNull( mockDialect2.getRuleDescr() );
+
+        RuleDescr ruleDescr = new RuleDescr( "test rule" );
+        ruleDescr.addAttribute( new AttributeDescr( "dialect",
+                                                    "mock" ) );
+        ruleDescr.setLhs( new AndDescr() );
+        EvalDescr evalDescr = new EvalDescr();
+        ruleDescr.getLhs().addDescr( evalDescr );
+
+        PackageDescr pkgDescr = new PackageDescr( "org.pkg1" );
+        pkgDescr.addImport( new ImportDescr( "java.util.HashMap" ) );
+        FunctionImportDescr functionImportDescr = new FunctionImportDescr();
+        functionImportDescr.setTarget( "System.out.println" );
+        pkgDescr.addFunctionImport( functionImportDescr );
+
+        pkgDescr.addRule( ruleDescr );
+
+        builder.addPackage( pkgDescr );
+
+        assertSame( ruleDescr,
+                    mockDialect2.getRuleDescr() );
+        assertTrue( mockDialect2.getImport().contains( "java.util.HashMap" ) );
+        assertTrue( mockDialect2.getStaticImport().contains( "System.out.println" ) );
+        assertEquals( "eval was built",
+                      evalDescr.getContent() );
+        assertEquals( "consequence was built",
+                      ruleDescr.getConsequence() );
+        assertTrue( mockDialect2.isCompileAll() );
+
+        assertNotNull( pkg.getRule( "test rule" ) );
+
+    }
+
+    public static class MockDialectConfiguration
+        implements
+        DialectConfiguration {
+        private MockDialect                 dialect = new MockDialect();
+        private PackageBuilderConfiguration conf;
+
+        public Dialect getDialect() {
+            return this.dialect;
+        }
+
+        public PackageBuilderConfiguration getPackageBuilderConfiguration() {
+            return this.conf;
+        }
+
+        public void init(PackageBuilderConfiguration configuration) {
+            this.conf = configuration;
+        }
+
+    }
+
+    public static class MockDialect
+        implements
+        Dialect {
+        private PackageBuilder builder;
+        private Package        pkg;
+        private RuleDescr      ruleDescr;
+        private Rule           rule;
+
+        private List           imports       = new ArrayList();
+        private List           staticImports = new ArrayList();
+
+        private boolean        compileAll    = false;
+
+        public void init(PackageBuilder builder) {
+            this.builder = builder;
+            this.pkg = builder.getPackage();
+
+        }
+
+        public void init(Package pkg) {
+            this.pkg = pkg;
+        }
+
+        public void init(RuleDescr ruleDescr) {
+            this.ruleDescr = ruleDescr;
+        }
+
+        public PackageBuilder getPackageBuilder() {
+            return builder;
+        }
+
+        public Package getPkg() {
+            return pkg;
+        }
+
+        public RuleDescr getRuleDescr() {
+            return ruleDescr;
+        }
+
+        public void addFunction(FunctionDescr functionDescr,
+                                TypeResolver typeResolver) {
+            // TODO Auto-generated method stub
+
+        }
+
+        public void addImport(String importEntry) {
+            this.imports.add( importEntry );
+        }
+
+        public List getImport() {
+            return this.imports;
+        }
+
+        public void addStaticImport(String importEntry) {
+            this.imports.add( importEntry );
+        }
+
+        public List getStaticImport() {
+            return this.imports;
+        }
+
+        public void addRule(RuleBuildContext context) {
+            this.rule = context.getRule();
+        }
+        
+        public void addProcess(final ProcessBuildContext context) {
+            
+        }
+
+        public Rule getRule() {
+            return this.rule;
+        }
+
+        public AnalysisResult analyzeBlock(PackageBuildContext context,
+                                           BaseDescr descr,
+                                           String text,
+                                           Set[] availableIdentifiers) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public AnalysisResult analyzeExpression(PackageBuildContext context,
+                                                BaseDescr descr,
+                                                Object content,
+                                                Set[] availableIdentifiers) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void compileAll() {
+            this.compileAll = true;
+        }
+
+        public boolean isCompileAll() {
+            return this.compileAll;
+        }
+
+        public AccumulateBuilder getAccumulateBuilder() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public RuleConditionBuilder getBuilder(Class clazz) {
+            if ( clazz == EvalDescr.class ) {
+                return getEvalBuilder();
+            } else if ( clazz == AndDescr.class ) {
+                return new GroupElementBuilder();
+            } else {
+                throw new RuntimeException( "clazz " + clazz + " is not yet configured " );
+            }
+        }
+
+        public Map getBuilders() {
+            return null;
+        }
+
+        public ClassFieldExtractorCache getClassFieldExtractorCache() {
+            return null;
+        }
+
+        public ConsequenceBuilder getConsequenceBuilder() {
+            return new MockConsequenceBuilder();
+        }
+
+        public RuleConditionBuilder getEvalBuilder() {
+            return new MockEvalBuilder();
+        }
+
+        public String getExpressionDialectName() {
+            return null;
+        }
+
+        public FromBuilder getFromBuilder() {
+            return null;
+        }
+
+        public PatternBuilder getPatternBuilder() {
+            return null;
+        }
+
+        public PredicateBuilder getPredicateBuilder() {
+            return null;
+        }
+
+        public QueryBuilder getQueryBuilder() {
+            return null;
+        }
+
+        public List getResults() {
+            return null;
+        }
+
+        public ReturnValueBuilder getReturnValueBuilder() {
+            return null;
+        }
+
+        public RuleClassBuilder getRuleClassBuilder() {
+            return null;
+        }
+        
+        public ProcessClassBuilder getProcessClassBuilder() {
+            return null;
+        }        
+
+        public SalienceBuilder getSalienceBuilder() {
+            return null;
+        }
+
+        public TypeResolver getTypeResolver() {
+            return null;
+        }
+        
+        public ActionBuilder getActionBuilder() {
+            return null;
+        }        
+
+        public String getId() {
+            return "mock";
+        }
+
+        public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void init(ProcessDescr processDescr) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public EntryPointBuilder getEntryPointBuilder() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+		@Override
+		public TimeWindowBuilder getTimeWindowBuilder() {
+			// TODO MockUp dialect for TimeWindowBuilder is not supported yet, only Java dialect is supported
+			return null;
+		}
+    }
+
+    public static class MockEvalBuilder
+        implements
+        RuleConditionBuilder {
+
+        public RuleConditionElement build(RuleBuildContext context,
+                                          BaseDescr descr) {
+            EvalDescr evalDescr = (EvalDescr) descr;
+            evalDescr.setContent( "eval was built" );
+            return null;
+        }
+
+        public RuleConditionElement build(RuleBuildContext context,
+                                          BaseDescr descr,
+                                          Pattern prefixPattern) {
+            return null;
+        }
+
+    }
+
+    public static class MockConsequenceBuilder
+        implements
+        ConsequenceBuilder {
+
+        public void build(RuleBuildContext context) {
+            context.getRuleDescr().setConsequence( "consequence was built" );
+        }
+
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/PackageBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,1490 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.StringReader;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.Cheese;
+import org.drools.DroolsTestCase;
+import org.drools.FactHandle;
+import org.drools.Primitives;
+import org.drools.QueryResults;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.StockTick;
+import org.drools.WorkingMemory;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.common.ActivationGroupNode;
+import org.drools.common.DroolsObjectInputStream;
+import org.drools.common.EventFactHandle;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.LogicalDependency;
+import org.drools.common.RuleFlowGroupNode;
+import org.drools.commons.jci.compilers.EclipseJavaCompiler;
+import org.drools.commons.jci.compilers.JaninoJavaCompiler;
+import org.drools.commons.jci.compilers.JavaCompiler;
+import org.drools.facttemplates.Fact;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.FieldTemplateDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.TypeDeclarationDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.process.core.Process;
+import org.drools.process.core.Variable;
+import org.drools.reteoo.ReteooRuleBase;
+import org.drools.rule.Declaration;
+import org.drools.rule.EvalCondition;
+import org.drools.rule.GroupElement;
+import org.drools.rule.LiteralConstraint;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.PredicateConstraint;
+import org.drools.rule.ReturnValueConstraint;
+import org.drools.rule.Rule;
+import org.drools.rule.TypeDeclaration;
+import org.drools.rule.builder.dialect.java.JavaDialect;
+import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaGroup;
+import org.drools.spi.CompiledInvoker;
+import org.drools.spi.PropagationContext;
+import org.drools.spi.Tuple;
+import org.drools.util.LinkedList;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+
+public class PackageBuilderTest extends DroolsTestCase {
+
+    public void testErrors() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                     "x" );
+        pattern.addConstraint( fieldBindingDescr );
+        fieldBindingDescr = new FieldBindingDescr( "price",
+                                                   "y" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final FieldConstraintDescr returnValue = new FieldConstraintDescr( "price" );
+        returnValue.addRestriction( new ReturnValueRestrictionDescr( "==",
+                                                                     "x" ) );
+
+        pattern.addConstraint( returnValue );
+
+        // There is no m this should produce errors.
+        ruleDescr.setConsequence( "update(m);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 1,
+                      builder.getErrors().getErrors() );
+    }
+
+    public void testErrorsInParser() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( this.getClass().getResourceAsStream( "bad_rule.drl" ) ) );
+        assertTrue( builder.hasErrors() );
+    }
+
+    public void testReload() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        ruleDescr.setConsequence( "map.put(\"value\", new Integer(1) );" );
+
+        builder.addPackage( packageDescr );
+
+        Package pkg = builder.getPackage();
+        Rule rule = pkg.getRule( "rule-1" );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
+        ruleBase.getGlobals().put( "map",
+                                   Map.class );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final HashMap map = new HashMap();
+        workingMemory.setGlobal( "map",
+                                 map );
+
+        final Tuple tuple = new MockTuple( new HashMap() );
+        final Activation activation = new MockActivation( rule,
+                                                          0,
+                                                          rule.getLhs(),
+                                                          tuple );
+
+        DefaultKnowledgeHelper knowledgeHelper = new org.drools.base.DefaultKnowledgeHelper( workingMemory );
+        knowledgeHelper.setActivation( activation );
+
+        rule.getConsequence().evaluate( knowledgeHelper,
+                                        workingMemory );
+        assertEquals( new Integer( 1 ),
+                      map.get( "value" ) );
+
+        ruleDescr.setConsequence( "map.put(\"value\", new Integer(2) );" );
+        pkg.removeRule( rule );
+
+        // Make sure the compiled classes are also removed
+        assertEquals( 0,
+                      pkg.getPackageCompilationData().list().length );
+
+        builder.addPackage( packageDescr );
+
+        pkg = builder.getPackage();
+
+        rule = pkg.getRule( "rule-1" );
+
+        knowledgeHelper = new org.drools.base.DefaultKnowledgeHelper( workingMemory );
+        knowledgeHelper.setActivation( activation );
+
+        rule.getConsequence().evaluate( knowledgeHelper,
+                                        workingMemory );
+        assertEquals( new Integer( 2 ),
+                      map.get( "value" ) );
+
+    }
+
+    public void testSerializable() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        ruleDescr.setConsequence( "map.put(\"value\", new Integer(1) );" );
+        //check that packageDescr is serializable
+        final byte[] ast = serializeOut( packageDescr );
+        final PackageDescr back = (PackageDescr) serializeIn( ast );
+        assertNotNull( back );
+        assertEquals( "p1",
+                      back.getName() );
+
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+        final Rule rule = pkg.getRule( "rule-1" );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        final byte[] bytes = serializeOut( pkg );
+
+        // Deserialize from a byte array
+
+        final Package newPkg = (Package) serializeIn( bytes );
+
+        final Rule newRule = newPkg.getRule( "rule-1" );
+
+        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
+        ruleBase.getGlobals().put( "map",
+                                   Map.class );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final HashMap map = new HashMap();
+
+        workingMemory.setGlobal( "map",
+                                 map );
+
+        final Tuple tuple = new MockTuple( new HashMap() );
+        final Activation activation = new MockActivation( newRule,
+                                                          0,
+                                                          newRule.getLhs(),
+                                                          tuple );
+
+        final DefaultKnowledgeHelper knowledgeHelper = new org.drools.base.DefaultKnowledgeHelper( workingMemory );
+        knowledgeHelper.setActivation( activation );
+
+        newRule.getConsequence().evaluate( knowledgeHelper,
+                                           workingMemory );
+        assertEquals( new Integer( 1 ),
+                      map.get( "value" ) );
+    }
+
+    private Object serializeIn(final byte[] bytes) throws IOException,
+                                                  ClassNotFoundException {
+        final ObjectInput in = new DroolsObjectInputStream( new ByteArrayInputStream( bytes ) );
+        final Object obj = in.readObject();
+        in.close();
+        return obj;
+    }
+
+    private byte[] serializeOut(final Object obj) throws IOException {
+        // Serialize to a byte array
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final ObjectOutput out = new ObjectOutputStream( bos );
+        out.writeObject( obj );
+        out.close();
+
+        // Get the bytes of the serialized object
+        final byte[] bytes = bos.toByteArray();
+        return bytes;
+    }
+
+    public void testNoPackageName() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        try {
+            builder.addPackage( new PackageDescr( null ) );
+            fail( "should have errored here." );
+        } catch ( final RuntimeException e ) {
+            assertNotNull( e.getMessage() );
+        }
+        try {
+            builder.addPackage( new PackageDescr( "" ) );
+            fail( "should have errored here." );
+        } catch ( final RuntimeException e ) {
+            assertNotNull( e.getMessage() );
+        }
+
+        builder.addPackageFromDrl( new StringReader( "package foo" ) );
+        builder.addPackageFromDrl( new StringReader( "rule x then end" ) );
+
+    }
+
+    public void testErrorReset() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        builder.addPackageFromDrl( new StringReader( "package foo \n rule ORB" ) );
+        assertTrue( builder.hasErrors() );
+
+        builder.resetErrors();
+        assertFalse( builder.hasErrors() );
+
+        builder.addPackageFromDrl( new StringReader( "package foo \n rule ORB" ) );
+        assertTrue( builder.hasErrors() );
+    }
+
+    public void testFactTemplate() {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final FactTemplateDescr cheese = new FactTemplateDescr( "Cheese" );
+        cheese.addFieldTemplate( new FieldTemplateDescr( "name",
+                                                         "String" ) );
+        cheese.addFieldTemplate( new FieldTemplateDescr( "price",
+                                                         "Integer" ) );
+
+        packageDescr.addFactTemplate( cheese );
+
+        final PatternDescr pattern = new PatternDescr( "Cheese",
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "name" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "stilton" ) );
+
+        pattern.addConstraint( literalDescr );
+
+        ruleDescr.setConsequence( "System.out.println( stilton.getFieldValue( \"name\" ) + \" \" + stilton.getFieldValue( \"price\" ) );" );
+
+        builder.addPackage( packageDescr );
+
+        //        assertFalse( Arrays.toString( builder.getErrors() ),
+        //                     builder.hasErrors() );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final Package pkg = builder.getPackage();
+        try {
+            ruleBase.addPackage( pkg );
+        } catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final Fact stilton = pkg.getFactTemplate( "Cheese" ).createFact( 1 );
+        stilton.setFieldValue( "name",
+                               "stilton" );
+        stilton.setFieldValue( "price",
+                               new Integer( 200 ) );
+        workingMemory.insert( stilton );
+        workingMemory.fireAllRules();
+
+    }
+
+    public void testLiteral() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "stilton" ) );
+
+        pattern.addConstraint( literalDescr );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+    }
+
+    public void testReturnValue() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                     "x" );
+        pattern.addConstraint( fieldBindingDescr );
+        fieldBindingDescr = new FieldBindingDescr( "price",
+                                                   "y" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final FieldConstraintDescr returnValue = new FieldConstraintDescr( "price" );
+        returnValue.addRestriction( new ReturnValueRestrictionDescr( "==",
+                                                                     "(( (Integer) map.get( new Integer( x )) ).intValue() * y)" ) );
+
+        pattern.addConstraint( returnValue );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertEquals( "Should not have any errors",
+                      0,
+                      builder.getErrors().getErrors().length );
+    }
+
+    public void testReturnValueMethodCompare() {
+        final PackageBuilder builder1 = new PackageBuilder();
+        final PackageDescr packageDescr1 = new PackageDescr( "package1" );
+        createReturnValueRule( packageDescr1,
+                               " x + y " );
+        builder1.addPackage( packageDescr1 );
+        final Pattern pattern1 = (Pattern) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final ReturnValueConstraint returnValue1 = (ReturnValueConstraint) pattern1.getConstraints().get( 2 );
+
+        final PackageBuilder builder2 = new PackageBuilder();
+        final PackageDescr packageDescr2 = new PackageDescr( "package2" );
+        createReturnValueRule( packageDescr2,
+                               " x + y " );
+        builder2.addPackage( packageDescr2 );
+        final Pattern pattern2 = (Pattern) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final ReturnValueConstraint returnValue2 = (ReturnValueConstraint) pattern2.getConstraints().get( 2 );
+
+        final PackageBuilder builder3 = new PackageBuilder();
+        final PackageDescr packageDescr3 = new PackageDescr( "package3" );
+        createReturnValueRule( packageDescr3,
+                               " x - y " );
+        builder3.addPackage( packageDescr3 );
+        final Pattern pattern3 = (Pattern) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final ReturnValueConstraint returnValue3 = (ReturnValueConstraint) pattern3.getConstraints().get( 2 );
+
+        assertEquals( returnValue1,
+                      returnValue2 );
+        assertFalse( returnValue1.equals( returnValue3 ) );
+        assertFalse( returnValue2.equals( returnValue3 ) );
+    }
+
+    public void testPredicate() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                           "x" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        final FieldBindingDescr fieldBindingDescr2 = new FieldBindingDescr( "price",
+                                                                            "y" );
+        pattern.addConstraint( fieldBindingDescr2 );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final PredicateDescr predicate = new PredicateDescr( "( ( Integer )map.get( new Integer(x) ) ).intValue() == y" );
+        pattern.addConstraint( predicate );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+    }
+
+    public void testPredicateMethodCompare() {
+        final PackageBuilder builder1 = new PackageBuilder();
+        final PackageDescr packageDescr1 = new PackageDescr( "package1" );
+        createPredicateRule( packageDescr1,
+                             "x==y" );
+        builder1.addPackage( packageDescr1 );
+        final Pattern pattern1 = (Pattern) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final PredicateConstraint predicate1 = (PredicateConstraint) pattern1.getConstraints().get( 2 );
+
+        final PackageBuilder builder2 = new PackageBuilder();
+        final PackageDescr packageDescr2 = new PackageDescr( "package2" );
+        createPredicateRule( packageDescr2,
+                             "x==y" );
+        builder2.addPackage( packageDescr2 );
+        final Pattern pattern2 = (Pattern) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final PredicateConstraint predicate2 = (PredicateConstraint) pattern2.getConstraints().get( 2 );
+
+        final PackageBuilder builder3 = new PackageBuilder();
+        final PackageDescr packageDescr3 = new PackageDescr( "package3" );
+        createPredicateRule( packageDescr3,
+                             "x!=y" );
+        builder3.addPackage( packageDescr3 );
+        final Pattern pattern3 = (Pattern) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+        final PredicateConstraint predicate3 = (PredicateConstraint) pattern3.getConstraints().get( 2 );
+
+        assertEquals( predicate1,
+                      predicate2 );
+        assertFalse( predicate1.equals( predicate3 ) );
+        assertFalse( predicate2.equals( predicate3 ) );
+    }
+
+    public void testEval() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                     "x" );
+        pattern.addConstraint( fieldBindingDescr );
+        fieldBindingDescr = new FieldBindingDescr( "price",
+                                                   "y" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final EvalDescr evalDescr = new EvalDescr( "( ( Integer )map.get( new Integer(x) ) ).intValue() == y" );
+        lhs.addDescr( evalDescr );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        final Package pkg = builder.getPackage();
+        final Rule rule = pkg.getRule( "rule-1" );
+        final EvalCondition eval = (EvalCondition) rule.getLhs().getChildren().get( 1 );
+        final CompiledInvoker invoker = (CompiledInvoker) eval.getEvalExpression();
+        final List list = invoker.getMethodBytecode();
+    }
+
+    public void testEvalMethodCompare() {
+        final PackageBuilder builder1 = new PackageBuilder();
+        final PackageDescr packageDescr1 = new PackageDescr( "package1" );
+        createEvalRule( packageDescr1,
+                        "1==1" );
+        builder1.addPackage( packageDescr1 );
+        final EvalCondition eval1 = (EvalCondition) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+
+        final PackageBuilder builder2 = new PackageBuilder();
+        final PackageDescr packageDescr2 = new PackageDescr( "package2" );
+        createEvalRule( packageDescr2,
+                        "1==1" );
+        builder2.addPackage( packageDescr2 );
+        final EvalCondition eval2 = (EvalCondition) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+
+        final PackageBuilder builder3 = new PackageBuilder();
+        final PackageDescr packageDescr3 = new PackageDescr( "package3" );
+        createEvalRule( packageDescr3,
+                        "1==3" );
+        builder3.addPackage( packageDescr3 );
+        final EvalCondition eval3 = (EvalCondition) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
+
+        assertEquals( eval1,
+                      eval2 );
+        assertFalse( eval1.equals( eval3 ) );
+        assertFalse( eval2.equals( eval3 ) );
+    }
+
+    public void testOr() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        final Rule rule = createRule( new OrDescr(),
+                                      builder,
+                                      "update(stilton);" );
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        final GroupElement lhs = rule.getLhs();
+        assertLength( 1,
+                      lhs.getChildren() );
+
+        final GroupElement or = (GroupElement) lhs.getChildren().get( 0 );
+        assertLength( 1,
+                      or.getChildren() );
+        final Pattern pattern = (Pattern) or.getChildren().get( 0 );
+
+        final LiteralConstraint literalConstarint = (LiteralConstraint) pattern.getConstraints().get( 0 );
+    }
+
+    public void testAnd() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        final Rule rule = createRule( new AndDescr(),
+                                      builder,
+                                      "update(stilton);" );
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        final GroupElement lhs = rule.getLhs();
+        assertLength( 1,
+                      lhs.getChildren() );
+
+        final GroupElement and = (GroupElement) lhs.getChildren().get( 0 );
+        assertLength( 1,
+                      and.getChildren() );
+        final Pattern pattern = (Pattern) and.getChildren().get( 0 );
+
+        final LiteralConstraint literalConstraint = (LiteralConstraint) pattern.getConstraints().get( 0 );
+    }
+
+    public void testNot() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+
+        // Make sure we can't accessa  variable bound inside the not node
+        Rule rule = createRule( new NotDescr(),
+                                builder,
+                                "update(stilton);" );
+        assertEquals( 1,
+                      builder.getErrors().getErrors().length );
+
+        builder = new PackageBuilder();
+        rule = createRule( new NotDescr(),
+                           builder,
+                           "" );
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        final GroupElement lhs = rule.getLhs();
+        assertLength( 1,
+                      lhs.getChildren() );
+
+        final GroupElement not = (GroupElement) lhs.getChildren().get( 0 );
+        assertLength( 1,
+                      not.getChildren() );
+        final Pattern pattern = (Pattern) not.getChildren().get( 0 );
+
+        final LiteralConstraint literalConstarint = (LiteralConstraint) pattern.getConstraints().get( 0 );
+    }
+
+    public void testExists() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+
+        // Make sure we can't accessa  variable bound inside the not node
+        Rule rule = createRule( new ExistsDescr(),
+                                builder,
+                                "update(stilton);" );
+        assertEquals( 1,
+                      builder.getErrors().getErrors().length );
+
+        builder = new PackageBuilder();
+        rule = createRule( new ExistsDescr(),
+                           builder,
+                           "" );
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        final GroupElement lhs = rule.getLhs();
+        assertLength( 1,
+                      lhs.getChildren() );
+
+        final GroupElement exists = (GroupElement) lhs.getChildren().get( 0 );
+        assertLength( 1,
+                      exists.getChildren() );
+        final Pattern pattern = (Pattern) exists.getChildren().get( 0 );
+
+        final LiteralConstraint literalConstarint = (LiteralConstraint) pattern.getConstraints().get( 0 );
+    }
+
+    public void testNumbers() throws Exception {
+        // test boolean
+        FieldConstraintDescr literalDescr = new FieldConstraintDescr( "booleanPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "true" ) );
+        createLiteralRule( literalDescr );
+
+        // test boolean
+        literalDescr = new FieldConstraintDescr( "booleanPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "false" ) );
+        createLiteralRule( literalDescr );
+
+        // test char
+        literalDescr = new FieldConstraintDescr( "charPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "a" ) );
+        createLiteralRule( literalDescr );
+
+        // test byte
+        literalDescr = new FieldConstraintDescr( "bytePrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "bytePrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "bytePrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "-1" ) );
+        createLiteralRule( literalDescr );
+
+        // test short
+        literalDescr = new FieldConstraintDescr( "shortPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "shortPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "shortPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "-1" ) );
+        createLiteralRule( literalDescr );
+
+        // test int
+        literalDescr = new FieldConstraintDescr( "intPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "intPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "intPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "-1" ) );
+        createLiteralRule( literalDescr );
+
+        // test long
+        literalDescr = new FieldConstraintDescr( "longPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "longPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "longPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        // test float
+        literalDescr = new FieldConstraintDescr( "floatPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1.1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "floatPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "floatPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "-1.1" ) );
+        createLiteralRule( literalDescr );
+
+        // test double
+        literalDescr = new FieldConstraintDescr( "doublePrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "1.1" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "doublePrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "0" ) );
+        createLiteralRule( literalDescr );
+
+        literalDescr = new FieldConstraintDescr( "floatPrimitive" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "-1.1" ) );
+        createLiteralRule( literalDescr );
+    }
+
+    public void testNull() {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr patternDescr = new PatternDescr( Cheese.class.getName(),
+                                                            "stilton" );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  null ) );
+
+        patternDescr.addConstraint( literalDescr );
+
+        ruleDescr.setConsequence( "" );
+
+        builder.addPackage( packageDescr );
+
+        final Package pkg = (Package) builder.getPackage();
+        final Rule rule = pkg.getRule( "rule-1" );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+    }
+
+    public void testQuery() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final QueryDescr queryDescr = new QueryDescr( "query1" );
+        queryDescr.setParameters( new String[]{"$type"} );
+        queryDescr.setParameterTypes( new String[]{"String"} );
+
+        packageDescr.addRule( queryDescr );
+
+        final AndDescr lhs = new AndDescr();
+        queryDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new VariableRestrictionDescr( "==",
+                                                                   "$type" ) );
+
+        pattern.addConstraint( literalDescr );
+
+        queryDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        StatefulSession session = ruleBase.newStatefulSession();
+
+        session.insert( new Cheese( "stilton",
+                                    15 ) );
+
+        QueryResults results = session.getQueryResults( "query1",
+                                                        new Object[]{"stilton"} );
+        assertEquals( 1,
+                      results.size() );
+        Object object = results.get( 0 ).get( 0 );
+        assertEquals( new Cheese( "stilton",
+                                  15 ),
+                      object );
+
+        results = session.getQueryResults( "query1",
+                                           new Object[]{"cheddar"} );
+    }
+
+    public void testDuplicateRuleNames() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+
+        RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+        AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+        PatternDescr patternDescr = new PatternDescr( Cheese.class.getName(),
+                                                      "stilton" );
+        FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  null ) );
+        patternDescr.addConstraint( literalDescr );
+        ruleDescr.setConsequence( "" );
+
+        ruleDescr = new RuleDescr( "rule-1" );
+        ruleDescr.setLocation( 42,
+                               43 );
+        packageDescr.addRule( ruleDescr );
+        lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+        patternDescr = new PatternDescr( Cheese.class.getName(),
+                                         "stilton" );
+        literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "!=",
+                                                                  null ) );
+        patternDescr.addConstraint( literalDescr );
+        ruleDescr.setConsequence( "" );
+
+        ruleDescr = new RuleDescr( "rule-2" );
+        ruleDescr.setLocation( 42,
+                               43 );
+        packageDescr.addRule( ruleDescr );
+        lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+        patternDescr = new PatternDescr( Cheese.class.getName(),
+                                         "stilton" );
+
+        literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "!=",
+                                                                  null ) );
+
+        patternDescr.addConstraint( literalDescr );
+        ruleDescr.setConsequence( "" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 1,
+                      builder.getErrors().getErrors() );
+        final ParserError err = (ParserError) builder.getErrors().getErrors()[0];
+        assertEquals( 42,
+                      err.getRow() );
+        assertEquals( 43,
+                      err.getCol() );
+
+    }
+
+    public void testDuplicateDeclaration() {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern1 = new PatternDescr( Cheese.class.getName() );
+        lhs.addDescr( pattern1 );
+
+        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "type",
+                                                                           "$type" );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "stilton" ) );
+
+        pattern1.addConstraint( fieldBindingDescr );
+        pattern1.addConstraint( literalDescr );
+
+        final PatternDescr pattern2 = new PatternDescr( Cheese.class.getName() );
+        lhs.addDescr( pattern2 );
+        pattern2.addConstraint( fieldBindingDescr );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 2,
+                      builder.getErrors().getErrors() );
+    }
+
+    public void testCompilerConfiguration() throws Exception {
+        // test default is eclipse jdt core
+        PackageBuilder builder = new PackageBuilder();
+        PackageDescr pkgDescr = new PackageDescr( "org.test" );
+        builder.addPackage( pkgDescr );
+
+        final Field dialectField = builder.getClass().getDeclaredField( "dialect" );
+        dialectField.setAccessible( true );
+        JavaDialect dialect = (JavaDialect) dialectField.get( builder );
+
+        final Field compilerField = dialect.getClass().getDeclaredField( "compiler" );
+        compilerField.setAccessible( true );
+        JavaCompiler compiler = (JavaCompiler) compilerField.get( dialect );
+        assertSame( EclipseJavaCompiler.class,
+                    compiler.getClass() );
+
+        // test JANINO with property settings
+        PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = (JavaDialectConfiguration) conf.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
+        builder = new PackageBuilder( conf );
+        builder.addPackage( pkgDescr );
+
+        dialect = (JavaDialect) dialectField.get( builder );
+        compiler = (JavaCompiler) compilerField.get( dialect );
+        assertSame( JaninoJavaCompiler.class,
+                    compiler.getClass() );
+
+        // test eclipse jdt core with property settings and default source level
+        conf = new PackageBuilderConfiguration();
+        javaConf = (JavaDialectConfiguration) conf.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.ECLIPSE );
+        builder = new PackageBuilder( conf );
+        builder.addPackage( pkgDescr );
+
+        dialect = (JavaDialect) dialectField.get( builder );
+        compiler = (JavaCompiler) compilerField.get( dialect );
+        assertSame( EclipseJavaCompiler.class,
+                    compiler.getClass() );
+    }
+
+    public void testTypeDeclaration() throws Exception {
+        PackageDescr pkgDescr = new PackageDescr( "org.test" );
+        TypeDeclarationDescr typeDescr = new TypeDeclarationDescr( "StockTick" );
+        typeDescr.addAttribute( TypeDeclarationDescr.ATTR_ROLE,
+                                "event" );
+        typeDescr.addAttribute( TypeDeclarationDescr.ATTR_CLASS,
+                                "org.drools.StockTick" );
+        pkgDescr.addTypeDeclaration( typeDescr );
+
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( pkgDescr );
+
+        Package pkg = builder.getPackage();
+        assertEquals( 1,
+                      pkg.getTypeDeclarations().size() );
+
+        TypeDeclaration type = pkg.getTypeDeclaration( "StockTick" );
+        assertEquals( "StockTick",
+                      type.getTypeName() );
+        assertEquals( TypeDeclaration.Role.EVENT,
+                      type.getRole() );
+        assertEquals( StockTick.class,
+                      type.getTypeClass() );
+    }
+
+    public void testPackageMerge() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        try {
+            builder.addPackage( new PackageDescr( "org.drools" ) );
+
+            builder.addPackageFromDrl( new StringReader( "package org.drools\n" + "function boolean testIt() {\n" + "  return true;\n" + "}\n" ) );
+        } catch ( RuntimeException e ) {
+            fail( "Should not raise any exception: " + e.getMessage() );
+        }
+    }
+
+    private void createReturnValueRule(final PackageDescr packageDescr,
+                                       final String expression) {
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                     "x" );
+        pattern.addConstraint( fieldBindingDescr );
+        fieldBindingDescr = new FieldBindingDescr( "price",
+                                                   "y" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final FieldConstraintDescr returnValue = new FieldConstraintDescr( "price" );
+        returnValue.addRestriction( new ReturnValueRestrictionDescr( "==",
+                                                                     expression ) );
+
+        pattern.addConstraint( returnValue );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+    }
+
+    private void createPredicateRule(final PackageDescr packageDescr,
+                                     final String expression) {
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
+                                                       "stilton" );
+        lhs.addDescr( pattern );
+
+        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
+                                                                           "x" );
+        pattern.addConstraint( fieldBindingDescr );
+
+        final FieldBindingDescr fieldBindingDescr2 = new FieldBindingDescr( "price",
+                                                                            "y" );
+        pattern.addConstraint( fieldBindingDescr2 );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final PredicateDescr predicate = new PredicateDescr( expression );
+        pattern.addConstraint( predicate );
+
+        ruleDescr.setConsequence( "update(stilton);" );
+    }
+
+    private void createEvalRule(final PackageDescr packageDescr,
+                                final String expression) {
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        packageDescr.addGlobal( new GlobalDescr( "map",
+                                                 "java.util.Map" ) );
+
+        final EvalDescr evalDescr = new EvalDescr( expression );
+        lhs.addDescr( evalDescr );
+
+        ruleDescr.setConsequence( "" );
+    }
+
+    private void createLiteralRule(final FieldConstraintDescr literalDescr) {
+        final PackageBuilder builder = new PackageBuilder();
+
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        final PatternDescr pattern = new PatternDescr( Primitives.class.getName() );
+        lhs.addDescr( pattern );
+
+        pattern.addConstraint( literalDescr );
+
+        ruleDescr.setConsequence( "" );
+
+        builder.addPackage( packageDescr );
+
+        assertLength( 0,
+                      builder.getErrors().getErrors() );
+    }
+
+    private Rule createRule(final ConditionalElementDescr ceDescr,
+                            final PackageBuilder builder,
+                            final String consequence) throws Exception {
+        final PackageDescr packageDescr = new PackageDescr( "p1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule-1" );
+        packageDescr.addRule( ruleDescr );
+
+        final AndDescr lhs = new AndDescr();
+        ruleDescr.setLhs( lhs );
+
+        lhs.addDescr( (BaseDescr) ceDescr );
+
+        final PatternDescr patternDescr = new PatternDescr( Cheese.class.getName(),
+                                                            "stilton" );
+
+        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
+        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
+                                                                  "stilton" ) );
+
+        patternDescr.addConstraint( literalDescr );
+
+        ceDescr.addDescr( patternDescr );
+
+        ruleDescr.setConsequence( consequence );
+
+        builder.addPackage( packageDescr );
+
+        final Package pkg = (Package) builder.getPackage();
+        final Rule rule = pkg.getRule( "rule-1" );
+
+        assertEquals( "rule-1",
+                      rule.getName() );
+
+        return rule;
+    }
+
+    public void testRuleFlow() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+
+        InputStream in = this.getClass().getResourceAsStream( "/org/drools/integrationtests/ruleflow.rfm" );
+        assertNotNull( in );
+
+        builder.addPackage( new PackageDescr( "com.sample" ) );
+
+        builder.addRuleFlow( new InputStreamReader( in ) );
+        Package pkg = builder.getPackage();
+        assertNotNull( pkg );
+
+        Map flows = pkg.getRuleFlows();
+        assertNotNull( flows );
+        assertEquals( 1,
+                      flows.size() );
+
+        assertTrue( flows.containsKey( "0" ) );
+
+        Process p = (Process) flows.get( "0" );
+        assertTrue( p instanceof WorkflowProcessImpl );
+
+        //now serialization
+        ByteArrayOutputStream data = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream( data );
+        out.writeObject( pkg );
+
+        ObjectInputStream objIn = new DroolsObjectInputStream( new ByteArrayInputStream( data.toByteArray() ) );
+        Package pkg2 = (Package) objIn.readObject();
+        assertNotNull( pkg2 );
+
+        flows = pkg2.getRuleFlows();
+        assertNotNull( flows );
+        assertEquals( 1,
+                      flows.size() );
+        assertTrue( flows.containsKey( "0" ) );
+        p = (Process) flows.get( "0" );
+        assertTrue( p instanceof WorkflowProcessImpl );
+    }
+
+    public void testPackageRuleFlows() throws Exception {
+        Package pkg = new Package( "boo" );
+        Process rf = new MockRuleFlow( "1" );
+        pkg.addRuleFlow( rf );
+        assertTrue( pkg.getRuleFlows().containsKey( "1" ) );
+        assertSame( rf,
+                    pkg.getRuleFlows().get( "1" ) );
+
+        Process rf2 = new MockRuleFlow( "2" );
+        pkg.addRuleFlow( rf2 );
+        assertTrue( pkg.getRuleFlows().containsKey( "1" ) );
+        assertSame( rf,
+                    pkg.getRuleFlows().get( "1" ) );
+        assertTrue( pkg.getRuleFlows().containsKey( "2" ) );
+        assertSame( rf2,
+                    pkg.getRuleFlows().get( "2" ) );
+
+        pkg.removeRuleFlow( "1" );
+        assertTrue( pkg.getRuleFlows().containsKey( "2" ) );
+        assertSame( rf2,
+                    pkg.getRuleFlows().get( "2" ) );
+        assertFalse( pkg.getRuleFlows().containsKey( "1" ) );
+
+    }
+
+    public void testJaninoWithStaticImports() throws Exception {
+        PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
+
+        PackageBuilder bldr = new PackageBuilder( cfg );
+        bldr.addPackageFromDrl( new StringReader( "package testBuilderPackageConfig \n import java.util.List" ) );
+        bldr.addPackageFromDrl( new StringReader( "function void doSomething() {\n System.err.println(List.class.toString()); }" ) );
+
+        assertFalse( bldr.hasErrors() );
+
+    }
+
+    class MockRuleFlow
+        implements
+        Process {
+
+        private String id;
+
+        MockRuleFlow(String id) {
+            this.id = id;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getName() {
+            return null;
+        }
+
+        public String getType() {
+            return null;
+        }
+
+        public String getVersion() {
+            return null;
+        }
+
+        public String getPackageName() {
+            return null;
+        }
+
+        public void setId(String id) {
+        }
+
+        public void setName(String name) {
+        }
+
+        public void setType(String type) {
+        }
+
+        public void setVersion(String version) {
+        }
+
+        public void setPackageName(String packageName) {
+        }
+
+        public String[] getVariableNames() {
+            return null;
+        }
+
+        public List<Variable> getVariables() {
+            return null;
+        }
+
+        public void setVariables(List<Variable> variables) {
+        }
+
+    }
+
+    class MockActivation
+        implements
+        Activation {
+        private Rule               rule;
+        private int                salience;
+        private final GroupElement subrule;
+        private Tuple              tuple;
+
+        public MockActivation(final Rule rule,
+                              int salience,
+                              final GroupElement subrule,
+                              final Tuple tuple) {
+            this.rule = rule;
+            this.salience = salience;
+            this.tuple = tuple;
+            this.subrule = subrule;
+        }
+
+        public Rule getRule() {
+            return this.rule;
+        }
+
+        public int getSalience() {
+            return this.salience;
+        }
+
+        public Tuple getTuple() {
+            return this.tuple;
+        }
+
+        public PropagationContext getPropagationContext() {
+            return null;
+        }
+
+        public long getActivationNumber() {
+            return 0;
+        }
+
+        public void remove() {
+        }
+
+        public void addLogicalDependency(final LogicalDependency node) {
+        }
+
+        public LinkedList getLogicalDependencies() {
+            return null;
+        }
+
+        public boolean isActivated() {
+            return false;
+        }
+
+        public void setActivated(final boolean activated) {
+        }
+
+        public ActivationGroupNode getActivationGroupNode() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void setActivationGroupNode(final ActivationGroupNode activationGroupNode) {
+            // TODO Auto-generated method stub
+
+        }
+
+        public GroupElement getSubRule() {
+            return this.subrule;
+        }
+
+        public AgendaGroup getAgendaGroup() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public RuleFlowGroupNode getRuleFlowGroupNode() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void setRuleFlowGroupNode(final RuleFlowGroupNode ruleFlowGroupNode) {
+            // TODO Auto-generated method stub
+
+        }
+
+        public void setLogicalDependencies(LinkedList justified) {
+            // TODO Auto-generated method stub
+
+        }
+    }
+
+    class MockTuple
+        implements
+        Tuple {
+        private Map declarations;
+
+        public MockTuple(final Map declarations) {
+            this.declarations = declarations;
+        }
+
+        public InternalFactHandle get(final int patern) {
+            return null;
+        }
+
+        public InternalFactHandle get(final Declaration declaration) {
+            return (InternalFactHandle) this.declarations.get( declaration );
+        }
+
+        public InternalFactHandle[] getFactHandles() {
+            return (InternalFactHandle[]) this.declarations.values().toArray( new FactHandle[0] );
+        }
+
+        public boolean dependsOn(final FactHandle handle) {
+            return false;
+        }
+
+        public void setActivation(final Activation activation) {
+        }
+
+        public long getRecency() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+        public int size() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+		@Override
+		public boolean containsEvents() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleBaseLoaderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleBaseLoaderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleBaseLoaderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.compiler;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.integrationtests.DslTest;
+
+public class RuleBaseLoaderTest extends TestCase {
+
+    public void testLoadRuleBase() throws Exception {
+        final InputStream in = DslTest.class.getResourceAsStream( "HelloWorld.drl" );
+        final RuleBase rb = RuleBaseLoader.getInstance().loadFromReader( new InputStreamReader( in ) );
+        assertNotNull( rb );
+    }
+
+    public void testLoadRuleBaseWithDSL() throws Exception {
+        final InputStream in = DslTest.class.getResourceAsStream( "rule_with_expander_dsl.dslr" );
+        final InputStream inDSL = DslTest.class.getResourceAsStream( "test_expander.dsl" );
+        final RuleBase rb = RuleBaseLoader.getInstance().loadFromReader( new InputStreamReader( in ),
+                                                                         new InputStreamReader( inDSL ) );
+        assertNotNull( rb );
+    }
+
+    // todo: fix for LEAPS
+    //    public void testEngineType() throws Exception {
+    //        final InputStream in = IntegrationCases.class.getResourceAsStream( "HelloWorld.drl" );
+    //        final RuleBaseLoader loader = RuleBaseLoader.getInstance();
+    //        loader.setDefaultEngineType( RuleBase.LEAPS );
+    //        final RuleBase rb = loader.loadFromReader( new InputStreamReader( in ) );
+    //        assertNotNull( rb );
+    //        assertTrue( rb instanceof LeapsRuleBase );
+    //
+    //    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleErrorTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleErrorTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleErrorTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,66 @@
+package org.drools.compiler;
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Rule;
+
+import junit.framework.TestCase;
+
+public class RuleErrorTest extends TestCase {
+
+    public void testNewLineInMessage() {
+        CompilationProblem[] probs = new CompilationProblem[3];
+        probs[0] = new MockCompilationProblem();
+        probs[1] = new MockCompilationProblem();
+        probs[2] = new MockCompilationProblem();
+
+        DescrBuildError err = new DescrBuildError( new RuleDescr( "ruleName" ),
+                                                   new AndDescr(),
+                                                   probs,
+                                                   "IM IN YR EROR" );
+        assertNotNull( err.toString() );
+        String msg = err.getMessage();
+
+        assertTrue( msg.indexOf( "IM IN YR EROR" ) != -1 );
+        System.err.println( msg );
+        assertEquals( "IM IN YR EROR problem\nproblem\nproblem",
+                      msg );
+
+    }
+
+    class MockCompilationProblem
+        implements
+        CompilationProblem {
+
+        public int getEndColumn() {
+            return 0;
+        }
+
+        public int getEndLine() {
+            return 0;
+        }
+
+        public String getFileName() {
+            return "X";
+        }
+
+        public String getMessage() {
+            return "problem";
+        }
+
+        public int getStartColumn() {
+            return 0;
+        }
+
+        public int getStartLine() {
+            return 0;
+        }
+
+        public boolean isError() {
+            return true;
+        }
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleFlowErrorTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleFlowErrorTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/RuleFlowErrorTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.compiler;
+
+import junit.framework.TestCase;
+
+
+public class RuleFlowErrorTest extends TestCase {
+
+    public void testError() {
+        RuleFlowLoadError err = new RuleFlowLoadError("XXX", null);
+        assertEquals("XXX", err.getMessage());
+        
+        Exception e = new RuntimeException("Q");
+        err = new RuleFlowLoadError("X", e);
+        
+        assertNotNull(err.getMessage());
+        
+        assertTrue(err instanceof DroolsError);
+        
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/SourcePackageProviderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/SourcePackageProviderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/compiler/SourcePackageProviderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,91 @@
+package org.drools.compiler;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.agent.RuleAgent;
+
+public class SourcePackageProviderTest extends TestCase {
+
+	public void testSourceProvider() throws Exception {
+		new SourcePackageProvider();
+
+	    File dir = getTempDirectory();
+
+	    InputStreamReader reader = new InputStreamReader(this.getClass().getResourceAsStream("/org/drools/integrationtests/HelloWorld.drl"));
+	    assertNotNull(reader);
+
+
+	    File target = new File(dir, "Something.drl");
+
+
+	    OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(target));
+
+        BufferedReader in = new BufferedReader(reader);
+        BufferedWriter out = new BufferedWriter(writer);
+        String str;
+        while ((str = in.readLine()) != null) {
+
+            out.write(str + "\n");
+        }
+        in.close();
+        out.flush();
+        out.close();
+
+
+
+        Properties config = new Properties();
+        config.setProperty(RuleAgent.FILES, target.getPath());
+
+
+
+		RuleAgent ag = RuleAgent.newRuleAgent(config);
+		RuleBase rb = ag.getRuleBase();
+		assertNotNull(rb);
+	}
+
+    public static File getTempDirectory() {
+        File f = tempDir();
+        if (f.exists()) {
+            if (f.isFile()) {
+                throw new IllegalStateException("The temp directory exists as a file. Nuke it now !");
+            }
+            deleteDir( f );
+            f.mkdir();
+        } else {
+            f.mkdir();
+        }
+        return f;
+    }
+
+    private static File tempDir() {
+        File tmp = new File(System.getProperty( "java.io.tmpdir" ));
+
+        return new File(tmp, "__temp_test_drools_packages");
+    }
+
+    public static boolean deleteDir(File dir) {
+
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i=0; i<children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    //throw new RuntimeException("Unable to delete !");
+                    return false;
+                }
+            }
+        }
+
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_pseudoClock.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_pseudoClock.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_pseudoClock.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,1209 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.drools.ClockType;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.TemporalSession;
+import org.drools.WorkingMemory;
+import org.drools.audit.WorkingMemoryFileLogger;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.integrationtests.eventgenerator.EVENT_TYPE;
+import org.drools.integrationtests.eventgenerator.SimpleEventGenerator;
+import org.drools.integrationtests.eventgenerator.SimpleEventListener;
+import org.drools.integrationtests.eventgenerator.example.CheeseEvent;
+import org.drools.integrationtests.eventgenerator.example.PersonEvent;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.temporal.AbstractSessionClock;
+import org.drools.temporal.SessionPseudoClock;
+
+public class AccumulateEventTest_pseudoClock extends TestCase {
+	
+	private final static Logger myLogger = Logger.getLogger(AccumulateEventTest_pseudoClock.class.getName());;
+	
+    protected static RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    private static RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+    
+    public static void main(String[] args) throws DroolsParserException, IOException, Exception {
+    	
+    	// read in the source
+        final Reader reader = new InputStreamReader( AccumulateEventTest_pseudoClock.class.getResourceAsStream( "eventGenerator/test_AccumulateEvent.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession(ClockType.PSEUDO_CLOCK);
+        
+       /* WorkingMemoryFileLogger wmLogger = new WorkingMemoryFileLogger(wm);
+	    // an event.log file is created in the log dir (which must exist)
+	    // in the working directory
+	    wmLogger.setFileName("log/event");*/
+        
+        SessionPseudoClock myClock = (SessionPseudoClock)((TemporalSession)(wm)).getSessionClock();	
+        
+        /*final List results = new ArrayList();
+        wm.setGlobal( "results",
+                      results );*/
+        
+        wm.setGlobal( "logger",
+                      myLogger );
+        
+        ////////// start manual creation //////////
+        
+        /*myClock.advanceTime(SessionPseudoClock.timeInMinutes(1));
+        wm.insert( new PersonEvent( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(4));
+        wm.insert( new PersonEvent( "Mark",
+                               "provolone" ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(5));
+        wm.insert( new CheeseEvent( "stilton",
+                               13 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(2));
+        wm.insert( new CheeseEvent( "brie",
+                               6 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(10));
+        wm.insert( new CheeseEvent( "provolone",
+                               151 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(20));
+        wm.insert( new CheeseEvent( "provolone",
+                36 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(20));
+        wm.insert( new PersonEvent( "Matze",
+        						"provolone" ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(5));
+        wm.insert( new CheeseEvent( "stilton",
+                500 ) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(10));
+        wm.insert( new CheeseEvent(	"provolone",
+        		1000) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(20));
+        wm.insert( new CheeseEvent( "provolone",
+                700 ) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(SessionPseudoClock.timeInMinutes(21));
+        wm.insert( new PersonEvent( "Juve",
+		"brie" ) );
+        
+        wm.fireAllRules();*/
+        
+        ////////// end manual creation //////////
+        
+        ////////// start automatic generation //////////
+        
+        final SimpleEventGenerator myGenerator = new SimpleEventGenerator(myClock,  new SimpleEventListener(wm), AbstractSessionClock.timeInHours(3));
+		// generate person events (ca. every 45 minutes) and cheese events (ca. every 10 minutes) for a simulated time of 3 hrs (see above)
+		myGenerator.addEventSource("PersonPool", EVENT_TYPE.PERSON_EVENT, AbstractSessionClock.timeInMinutes(1), AbstractSessionClock.timeInMinutes(30));
+		myGenerator.addEventSource("CheesePool", EVENT_TYPE.CHEESE_EVENT, AbstractSessionClock.timeInMinutes(1), AbstractSessionClock.timeInMinutes(6));
+		myGenerator.generate();
+        
+        
+        ////////// end automatic generation //////////
+        
+        //wmLogger.writeToDisk();
+        
+        myLogger.info("\nSystem stopped");
+        
+        System.exit(0);
+
+	}
+
+   /* public void testAccumulateModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Accumulate.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testMVELAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testAccumulateModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateWithFromChaining() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateWithFromChaining.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+
+        Cheesery cheesery = new Cheesery();
+
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheesery.addCheese( cheese[i] );
+        }
+
+        FactHandle cheeseryHandle = wm.insert( cheesery );
+
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // one fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setType( "brie" );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // no fire
+        Assert.assertEquals( 1,
+                             results.size() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 4th scenario
+        cheesery.getCheeses().remove( cheese[3] );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testMVELAccumulate2WM() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm1 = ruleBase.newStatefulSession();
+        final List results1 = new ArrayList();
+
+        wm1.setGlobal( "results",
+                       results1 );
+
+        final WorkingMemory wm2 = ruleBase.newStatefulSession();
+        final List results2 = new ArrayList();
+
+        wm2.setGlobal( "results",
+                       results2 );
+
+        wm1.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm1.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm2.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm2.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm1.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "provolone",
+                                150 ) );
+        wm2.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "provolone",
+                                150 ) );
+        wm1.fireAllRules();
+
+        wm2.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results1.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results1.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results1.get( 4 ) );
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results2.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results2.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results2.get( 4 ) );
+    }
+
+    public void testAccumulateInnerClass() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateInnerClass.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new OuterClass.InnerClass( 10 ) );
+        wm.insert( new OuterClass.InnerClass( 5 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 15 ),
+                             results.get( 0 ) );
+    }
+
+    public void testAccumulateReturningNull() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNull.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateReturningNullMVEL() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNullMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateSumJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSum.drl" );
+    }
+
+    public void testAccumulateSumMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSumMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionJava.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionMVEL.drl" );
+    }
+
+    public void testAccumulateCountJava() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCount.drl" );
+    }
+
+    public void testAccumulateCountMVEL() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCountMVEL.drl" );
+    }
+
+    public void testAccumulateAverageJava() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverage.drl" );
+    }
+
+    public void testAccumulateAverageMVEL() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverageMVEL.drl" );
+    }
+
+    public void testAccumulateMinJava() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMin.drl" );
+    }
+
+    public void testAccumulateMinMVEL() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMinMVEL.drl" );
+    }
+
+    public void testAccumulateMaxJava() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMax.drl" );
+    }
+
+    public void testAccumulateMaxMVEL() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMaxMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternJava() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPattern.drl" );
+    }
+
+    public void testAccumulateMultiPatternMVEL() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPatternMVEL.drl" );
+    }
+    
+    public void execTestAccumulateSum(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             11 ), new Cheese( "brie",
+                                                                                                                               4 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 27,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 20,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 15,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateCount(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 2,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateAverage(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            11 ), new Cheese( "brie",
+                                                                                                              15 ), new Cheese( "brie",
+                                                                                                                                17 ), new Cheese( "provolone",
+                                                                                                                                                  8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 10,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 16,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMin(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 1,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMax(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         4 ), new Cheese( "stilton",
+                                                                          2 ), new Cheese( "stilton",
+                                                                                           3 ), new Cheese( "brie",
+                                                                                                            15 ), new Cheese( "brie",
+                                                                                                                              17 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 9,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 17,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+        final Person mark = new Person( "Mark",
+                                        "provolone" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+        final FactHandle markHandle = wm.insert( mark );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 32,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 39,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+*/
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_systemClock.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_systemClock.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateEventTest_systemClock.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,1231 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.drools.ClockType;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.TemporalSession;
+import org.drools.WorkingMemory;
+import org.drools.audit.WorkingMemoryFileLogger;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.integrationtests.eventgenerator.EVENT_TYPE;
+import org.drools.integrationtests.eventgenerator.SimpleEventGenerator;
+import org.drools.integrationtests.eventgenerator.SimpleEventListener;
+import org.drools.integrationtests.eventgenerator.example.CheeseEvent;
+import org.drools.integrationtests.eventgenerator.example.PersonEvent;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.temporal.AbstractSessionClock;
+import org.drools.temporal.SessionSystemClock;
+
+class EventSender extends Thread {
+	
+	private final Logger myLogger = Logger.getLogger(AccumulateEventTest_systemClock.class.getName());;
+	private final WorkingMemory wm;
+	
+	public EventSender (final WorkingMemory wm){
+		this.wm = wm;
+	}
+	
+	@Override
+	public void run(){
+		
+		//SessionPseudoClock myClock = (SessionPseudoClock)((TemporalSession)(wm)).getSessionClock();	
+	    SessionSystemClock myClock = (SessionSystemClock)((TemporalSession)(wm)).getSessionClock();
+		
+	   /* WorkingMemoryFileLogger wmLogger = new WorkingMemoryFileLogger(wm);
+	    // an event.log file is created in the log dir (which must exist)
+	    // in the working directory
+	    wmLogger.setFileName("log/event");*/
+        
+        
+	    /*myClock.setTime(WINDOWSIZE);
+        System.out.println ("Start time: " + myClock.toString() + " (= window size)");*/
+        
+        /*final List results = new ArrayList();
+        wm.setGlobal( "results",
+                      results );*/
+        
+        wm.setGlobal( "logger",
+                      myLogger );
+        
+        //////////start manual creation //////////
+	    
+		/*myClock.advanceTime(AbstractSessionClock.timeInMinutes(1));
+        wm.insert( new PersonEvent( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(4));
+        wm.insert( new PersonEvent( "Mark",
+                               "provolone" ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(5));
+        wm.insert( new CheeseEvent( "stilton",
+                               13 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(2));
+        wm.insert( new CheeseEvent( "brie",
+                               6 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(10));
+        wm.insert( new CheeseEvent( "provolone",
+                               151 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(20));
+        wm.insert( new CheeseEvent( "provolone",
+                36 ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(20));
+        wm.insert( new PersonEvent( "Matze",
+        						"provolone" ) );
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(5));
+        wm.insert( new CheeseEvent( "stilton",
+                500 ) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(10));
+        wm.insert( new CheeseEvent(	"provolone",
+        		1000) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(20));
+        wm.insert( new CheeseEvent( "provolone",
+                700 ) );
+        
+        wm.fireAllRules();
+        
+        myClock.advanceTime(AbstractSessionClock.timeInMinutes(21));
+        wm.insert( new PersonEvent( "Juve",
+		"brie" ) );
+        
+        wm.fireAllRules();*/
+
+        ////////// end manual creation //////////
+        
+        ////////// start automatic generation //////////
+        
+        final SimpleEventGenerator myGenerator = new SimpleEventGenerator(myClock,  new SimpleEventListener(wm), AbstractSessionClock.timeInHours(3));
+		// generate person events (ca. every 45 minutes) and cheese events (ca. every 10 minutes) for a simulated time of 3 hrs (see above)
+		myGenerator.addEventSource("PersonPool", EVENT_TYPE.PERSON_EVENT, AbstractSessionClock.timeInMinutes(1), AbstractSessionClock.timeInMinutes(30));
+		myGenerator.addEventSource("CheesePool", EVENT_TYPE.CHEESE_EVENT, AbstractSessionClock.timeInMinutes(1), AbstractSessionClock.timeInMinutes(6));
+		myGenerator.generate();
+        
+        
+        ////////// end automatic generation //////////
+        
+        //wmLogger.writeToDisk();
+        
+        myLogger.info ("\nSystem stopped");
+        
+        System.exit(0);
+	}
+	
+}
+
+public class AccumulateEventTest_systemClock extends TestCase {
+    protected static RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    private static RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+    
+    public static void main(String[] args) throws DroolsParserException, IOException, Exception {
+    	
+    	//final long WINDOWSIZE = AbstractSessionClock.timeInHours(1);
+    	
+    	// read in the source
+        final Reader reader = new InputStreamReader( AccumulateEventTest_systemClock.class.getResourceAsStream( "eventGenerator/test_AccumulateEvent.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession(ClockType.SYSTEM_CLOCK);
+        
+        EventSender evSender = new EventSender(wm);
+        evSender.start();
+
+	}
+
+   /* public void testAccumulateModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Accumulate.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testMVELAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testAccumulateModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateWithFromChaining() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateWithFromChaining.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+
+        Cheesery cheesery = new Cheesery();
+
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheesery.addCheese( cheese[i] );
+        }
+
+        FactHandle cheeseryHandle = wm.insert( cheesery );
+
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // one fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setType( "brie" );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // no fire
+        Assert.assertEquals( 1,
+                             results.size() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 4th scenario
+        cheesery.getCheeses().remove( cheese[3] );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testMVELAccumulate2WM() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm1 = ruleBase.newStatefulSession();
+        final List results1 = new ArrayList();
+
+        wm1.setGlobal( "results",
+                       results1 );
+
+        final WorkingMemory wm2 = ruleBase.newStatefulSession();
+        final List results2 = new ArrayList();
+
+        wm2.setGlobal( "results",
+                       results2 );
+
+        wm1.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm1.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm2.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm2.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm1.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "provolone",
+                                150 ) );
+        wm2.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "provolone",
+                                150 ) );
+        wm1.fireAllRules();
+
+        wm2.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results1.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results1.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results1.get( 4 ) );
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results2.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results2.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results2.get( 4 ) );
+    }
+
+    public void testAccumulateInnerClass() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateInnerClass.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new OuterClass.InnerClass( 10 ) );
+        wm.insert( new OuterClass.InnerClass( 5 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 15 ),
+                             results.get( 0 ) );
+    }
+
+    public void testAccumulateReturningNull() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNull.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateReturningNullMVEL() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNullMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateSumJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSum.drl" );
+    }
+
+    public void testAccumulateSumMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSumMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionJava.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionMVEL.drl" );
+    }
+
+    public void testAccumulateCountJava() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCount.drl" );
+    }
+
+    public void testAccumulateCountMVEL() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCountMVEL.drl" );
+    }
+
+    public void testAccumulateAverageJava() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverage.drl" );
+    }
+
+    public void testAccumulateAverageMVEL() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverageMVEL.drl" );
+    }
+
+    public void testAccumulateMinJava() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMin.drl" );
+    }
+
+    public void testAccumulateMinMVEL() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMinMVEL.drl" );
+    }
+
+    public void testAccumulateMaxJava() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMax.drl" );
+    }
+
+    public void testAccumulateMaxMVEL() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMaxMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternJava() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPattern.drl" );
+    }
+
+    public void testAccumulateMultiPatternMVEL() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPatternMVEL.drl" );
+    }
+    
+    public void execTestAccumulateSum(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             11 ), new Cheese( "brie",
+                                                                                                                               4 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 27,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 20,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 15,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateCount(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 2,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateAverage(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            11 ), new Cheese( "brie",
+                                                                                                              15 ), new Cheese( "brie",
+                                                                                                                                17 ), new Cheese( "provolone",
+                                                                                                                                                  8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 10,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 16,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMin(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 1,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMax(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         4 ), new Cheese( "stilton",
+                                                                          2 ), new Cheese( "stilton",
+                                                                                           3 ), new Cheese( "brie",
+                                                                                                            15 ), new Cheese( "brie",
+                                                                                                                              17 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 9,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 17,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+        final Person mark = new Person( "Mark",
+                                        "provolone" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+        final FactHandle markHandle = wm.insert( mark );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 32,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 39,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+*/
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/AccumulateTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,1127 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.FactHandle;
+import org.drools.OuterClass;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.RuntimeDroolsException;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+
+public class AccumulateTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testAccumulateModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Accumulate.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testMVELAccumulate() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Person( "Bob",
+                               "stilton",
+                               20 ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results.get( 4 ) );
+    }
+
+    public void testAccumulateModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModify.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateReverseModifyMVEL() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReverseModifyMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 24,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 31,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateWithFromChaining() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateWithFromChaining.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+
+        Cheesery cheesery = new Cheesery();
+
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheesery.addCheese( cheese[i] );
+        }
+
+        FactHandle cheeseryHandle = wm.insert( cheesery );
+
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // one fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setType( "brie" );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // no fire
+        Assert.assertEquals( 1,
+                             results.size() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((List) results.get( results.size() - 1 )).size() );
+
+        // ---------------- 4th scenario
+        cheesery.getCheeses().remove( cheese[3] );
+        wm.update( cheeseryHandle,
+                   cheesery );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testMVELAccumulate2WM() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm1 = ruleBase.newStatefulSession();
+        final List results1 = new ArrayList();
+
+        wm1.setGlobal( "results",
+                       results1 );
+
+        final WorkingMemory wm2 = ruleBase.newStatefulSession();
+        final List results2 = new ArrayList();
+
+        wm2.setGlobal( "results",
+                       results2 );
+
+        wm1.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm1.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm2.insert( new Person( "Bob",
+                                "stilton",
+                                20 ) );
+        wm2.insert( new Person( "Mark",
+                                "provolone" ) );
+
+        wm1.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "stilton",
+                                10 ) );
+        wm1.insert( new Cheese( "provolone",
+                                150 ) );
+        wm2.insert( new Cheese( "brie",
+                                5 ) );
+        wm2.insert( new Cheese( "provolone",
+                                150 ) );
+        wm1.fireAllRules();
+
+        wm2.fireAllRules();
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results1.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results1.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results1.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results1.get( 4 ) );
+
+        Assert.assertEquals( new Integer( 165 ),
+                             results2.get( 0 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 1 ) );
+        Assert.assertEquals( new Integer( 150 ),
+                             results2.get( 2 ) );
+        Assert.assertEquals( new Integer( 10 ),
+                             results2.get( 3 ) );
+        Assert.assertEquals( new Integer( 210 ),
+                             results2.get( 4 ) );
+    }
+
+    public void testAccumulateInnerClass() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateInnerClass.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new OuterClass.InnerClass( 10 ) );
+        wm.insert( new OuterClass.InnerClass( 5 ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( new Integer( 15 ),
+                             results.get( 0 ) );
+    }
+
+    public void testAccumulateReturningNull() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNull.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateReturningNullMVEL() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateReturningNullMVEL.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        try {
+            wm.insert( new Cheese( "stilton",
+                                   10 ) );
+
+            fail( "Should have raised an exception because accumulate is returning null" );
+        } catch ( RuntimeDroolsException rde ) {
+            // success, working fine
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should have raised a DroolsRuntimeException instead of " + e );
+        }
+
+    }
+
+    public void testAccumulateSumJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSum.drl" );
+    }
+
+    public void testAccumulateSumMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateSumMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionJava() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionJava.drl" );
+    }
+
+    public void testAccumulateMultiPatternWithFunctionMVEL() throws Exception {
+        execTestAccumulateSum( "test_AccumulateMultiPatternFunctionMVEL.drl" );
+    }
+
+    public void testAccumulateCountJava() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCount.drl" );
+    }
+
+    public void testAccumulateCountMVEL() throws Exception {
+        execTestAccumulateCount( "test_AccumulateCountMVEL.drl" );
+    }
+
+    public void testAccumulateAverageJava() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverage.drl" );
+    }
+
+    public void testAccumulateAverageMVEL() throws Exception {
+        execTestAccumulateAverage( "test_AccumulateAverageMVEL.drl" );
+    }
+
+    public void testAccumulateMinJava() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMin.drl" );
+    }
+
+    public void testAccumulateMinMVEL() throws Exception {
+        execTestAccumulateMin( "test_AccumulateMinMVEL.drl" );
+    }
+
+    public void testAccumulateMaxJava() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMax.drl" );
+    }
+
+    public void testAccumulateMaxMVEL() throws Exception {
+        execTestAccumulateMax( "test_AccumulateMaxMVEL.drl" );
+    }
+
+    public void testAccumulateMultiPatternJava() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPattern.drl" );
+    }
+
+    public void testAccumulateMultiPatternMVEL() throws Exception {
+        execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPatternMVEL.drl" );
+    }
+
+    public void execTestAccumulateSum(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             11 ), new Cheese( "brie",
+                                                                                                                               4 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 27,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 20,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 15,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateCount(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 3,
+                             results.size() );
+        Assert.assertEquals( 2,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 3,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateAverage(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            11 ), new Cheese( "brie",
+                                                                                                              15 ), new Cheese( "brie",
+                                                                                                                                17 ), new Cheese( "provolone",
+                                                                                                                                                  8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 10,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 16,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMin(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         8 ), new Cheese( "stilton",
+                                                                          10 ), new Cheese( "stilton",
+                                                                                            9 ), new Cheese( "brie",
+                                                                                                             4 ), new Cheese( "brie",
+                                                                                                                              1 ), new Cheese( "provolone",
+                                                                                                                                               8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 3 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 1,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateMax(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         4 ), new Cheese( "stilton",
+                                                                          2 ), new Cheese( "stilton",
+                                                                                           3 ), new Cheese( "brie",
+                                                                                                            15 ), new Cheese( "brie",
+                                                                                                                              17 ), new Cheese( "provolone",
+                                                                                                                                                8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 9,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 17,
+                             ((Number) results.get( results.size() - 1 )).intValue() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.retract( cheeseHandles[4] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void execTestAccumulateReverseModifyMultiPattern(String fileName) throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( fileName ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+        final Person mark = new Person( "Mark",
+                                        "provolone" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+        final FactHandle markHandle = wm.insert( mark );
+
+        // ---------------- 1st scenario
+        wm.fireAllRules();
+        // no fire, as per rule constraints
+        Assert.assertEquals( 0,
+                             results.size() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        // 1 fire
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 32,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        // 2 fires
+        Assert.assertEquals( 2,
+                             results.size() );
+        Assert.assertEquals( 39,
+                             ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( 2,
+                             results.size() );
+
+    }
+
+    public void testAccumulateWithPreviouslyBoundVariables() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulatePreviousBinds.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+        wm.insert( new Cheese( "brie",
+                               20 ) );
+
+        wm.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( new Integer( 45 ),
+                      results.get( 0 ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/CepEspTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/CepEspTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/CepEspTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,470 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.ClockType;
+import org.drools.OrderEvent;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.TemporalSession;
+import org.drools.StockTick;
+import org.drools.WorkingMemory;
+import org.drools.common.EventFactHandle;
+import org.drools.common.InternalFactHandle;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.temporal.SessionPseudoClock;
+
+public class CepEspTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testEventAssertion() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertion.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        StockTick tick1 = new StockTick( 1,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+        StockTick tick2 = new StockTick( 2,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis() );
+        StockTick tick3 = new StockTick( 3,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis() );
+        StockTick tick4 = new StockTick( 4,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+
+        assertNotNull( handle1 );
+        assertNotNull( handle2 );
+        assertNotNull( handle3 );
+        assertNotNull( handle4 );
+
+        assertTrue( handle1.isEvent() );
+        assertTrue( handle2.isEvent() );
+        assertTrue( handle3.isEvent() );
+        assertTrue( handle4.isEvent() );
+
+        wm.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+
+    }
+
+    public void FIXME_testEventAssertionWithDuration() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertionWithDuration.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        StockTick tick1 = new StockTick( 1,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         5 );
+        StockTick tick2 = new StockTick( 2,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(),
+                                         10 );
+        StockTick tick3 = new StockTick( 3,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(), 
+                                         8 );
+        StockTick tick4 = new StockTick( 4,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         7);
+
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+
+        assertNotNull( handle1 );
+        assertNotNull( handle2 );
+        assertNotNull( handle3 );
+        assertNotNull( handle4 );
+
+        assertTrue( handle1.isEvent() );
+        assertTrue( handle2.isEvent() );
+        assertTrue( handle3.isEvent() );
+        assertTrue( handle4.isEvent() );
+        
+        EventFactHandle eh1 = (EventFactHandle) handle1;
+        EventFactHandle eh2 = (EventFactHandle) handle2;
+        EventFactHandle eh3 = (EventFactHandle) handle3;
+        EventFactHandle eh4 = (EventFactHandle) handle4;
+        
+        assertEquals( tick1.getDuration(), eh1.getDuration() );
+        assertEquals( tick2.getDuration(), eh2.getDuration() );
+        assertEquals( tick3.getDuration(), eh3.getDuration() );
+        assertEquals( tick4.getDuration(), eh4.getDuration() );
+
+        wm.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+
+    }
+
+    public void FIXME_testTimeRelationalOperators() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_TimeRelationalOperators.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final SessionPseudoClock clock = wm.getSessionClock();
+
+        clock.jumpTo( 1000 );
+        final List results_coincides = new ArrayList();
+        final List results_before = new ArrayList();
+        final List results_after = new ArrayList();
+        final List results_meets = new ArrayList();
+        final List results_met_by = new ArrayList();
+        final List results_overlaps = new ArrayList();
+        final List results_overlapped_by = new ArrayList();
+        final List results_during = new ArrayList();
+        final List results_includes = new ArrayList();
+        final List results_starts = new ArrayList();
+        final List results_started_by = new ArrayList();
+        final List results_finishes = new ArrayList();
+        final List results_finished_by = new ArrayList();
+
+        wm.setGlobal( "results_coincides",
+                results_coincides );
+        wm.setGlobal( "results_before",
+                results_before );
+        wm.setGlobal( "results_after",
+                      results_after );
+        wm.setGlobal( "results_meets",
+                results_meets );
+        wm.setGlobal( "results_met_by",
+                      results_met_by );
+        wm.setGlobal( "results_overlaps",
+                	  results_overlaps );
+        wm.setGlobal( "results_overlapped_by",
+                      results_overlapped_by );
+        wm.setGlobal( "results_during",
+          	  results_during );
+        wm.setGlobal( "results_includes",
+                results_includes );
+        wm.setGlobal( "results_starts",
+          	  results_starts );
+        wm.setGlobal( "results_started_by",
+                results_started_by );
+        wm.setGlobal( "results_finishes",
+            	  results_finishes );
+        wm.setGlobal( "results_finished_by",
+                  results_finished_by );
+
+        StockTick tick1 = new StockTick( 1,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         3 );
+        StockTick tick2 = new StockTick( 2,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(),
+                                         3 );
+        StockTick tick3 = new StockTick( 3,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(),
+                                         3 );
+        StockTick tick4 = new StockTick( 4,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         5 );
+        StockTick tick5 = new StockTick( 5,
+                						 "ACME",
+                						 10,
+                                         System.currentTimeMillis(),
+                                         5 );
+        StockTick tick6 = new StockTick( 6,
+										 "ACME",
+										 10,
+                                         System.currentTimeMillis(),
+                                         3 );
+        StockTick tick7 = new StockTick( 7,
+				 						 "ACME",
+				 						 10,
+                                         System.currentTimeMillis(),
+                                         5 );
+        StockTick tick8 = new StockTick( 8,
+										 "ACME",
+										 10,
+                                         System.currentTimeMillis(),
+                                         3 );
+
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
+        clock.advanceTime( 4 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
+        clock.advanceTime( 4 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
+        clock.advanceTime( 4 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+        InternalFactHandle handle5 = (InternalFactHandle) wm.insert( tick5 );
+        clock.advanceTime( 1 );
+        InternalFactHandle handle6 = (InternalFactHandle) wm.insert( tick6 );
+        InternalFactHandle handle7 = (InternalFactHandle) wm.insert( tick7 );
+        clock.advanceTime( 2 );
+        InternalFactHandle handle8 = (InternalFactHandle) wm.insert( tick8 );
+        
+        assertNotNull( handle1 );
+        assertNotNull( handle2 );
+        assertNotNull( handle3 );
+        assertNotNull( handle4 );
+        assertNotNull( handle5 );
+        assertNotNull( handle6 );
+        assertNotNull( handle7 );
+        assertNotNull( handle8 );
+
+        assertTrue( handle1.isEvent() );
+        assertTrue( handle2.isEvent() );
+        assertTrue( handle3.isEvent() );
+        assertTrue( handle4.isEvent() );
+        assertTrue( handle6.isEvent() );
+        assertTrue( handle7.isEvent() );
+        assertTrue( handle8.isEvent() );
+
+        wm.fireAllRules();
+
+        assertEquals( 1,
+                results_coincides.size() );
+        assertEquals( tick5,
+                results_coincides.get( 0 ) );
+        
+        assertEquals( 1,
+                results_before.size() );
+        assertEquals( tick2,
+                results_before.get( 0 ) );
+        
+        assertEquals( 1,
+                      results_after.size() );
+        assertEquals( tick3,
+                      results_after.get( 0 ) );
+        
+        assertEquals( 1,
+                results_meets.size() );
+        assertEquals( tick3,
+                results_meets.get( 0 ) );
+        
+        assertEquals( 1,
+                      results_met_by.size() );
+        assertEquals( tick2,
+                      results_met_by.get( 0 ) );
+        
+        assertEquals( 1,
+                results_met_by.size() );
+        assertEquals( tick2,
+                results_met_by.get( 0 ) );
+        
+        assertEquals( 1,
+                results_overlaps.size() );
+        assertEquals( tick4,
+                results_overlaps.get( 0 ) );
+        
+        assertEquals( 1,
+                results_overlapped_by.size() );
+        assertEquals( tick7,
+                results_overlapped_by.get( 0 ) );
+        
+        assertEquals( 1,
+                results_during.size() );
+        assertEquals( tick6,
+                results_during.get( 0 ) );
+        
+        assertEquals( 1,
+                results_includes.size() );
+        assertEquals( tick4,
+                results_includes.get( 0 ) );
+        
+        assertEquals( 1,
+                results_starts.size() );
+        assertEquals( tick6,
+                results_starts.get( 0 ) );
+        
+        assertEquals( 1,
+                results_started_by.size() );
+        assertEquals( tick7,
+                results_started_by.get( 0 ) );
+        
+        assertEquals( 1,
+                results_finishes.size() );
+        assertEquals( tick8,
+                results_finishes.get( 0 ) );
+        
+        assertEquals( 1,
+                results_finished_by.size() );
+        assertEquals( tick7,
+                results_finished_by.get( 0 ) );
+
+    }
+
+    public void FIXME_testSimpleTimeWindow() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleTimeWindow.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        // how to initialize the clock?
+        // how to configure the clock?
+        SessionPseudoClock clock = wm.getSessionClock();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle1 = (EventFactHandle) wm.insert( new OrderEvent( "1",
+                                                                               "customer A",
+                                                                               70 ) );
+        assertEquals( 10000,
+                      handle1.getStartTimestamp() );
+        assertEquals( 0,
+                      handle1.getDuration() );
+
+        wm.fireAllRules();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle2 = (EventFactHandle) wm.insert( new OrderEvent( "2",
+                                                                               "customer A",
+                                                                               60 ) );
+        assertEquals( 20000,
+                      handle2.getStartTimestamp() );
+        assertEquals( 0,
+                      handle2.getDuration() );
+
+        wm.fireAllRules();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle3 = (EventFactHandle) wm.insert( new OrderEvent( "3",
+                                                                               "customer A",
+                                                                               50 ) );
+        assertEquals( 30000,
+                      handle3.getStartTimestamp() );
+        assertEquals( 0,
+                      handle3.getDuration() );
+
+        wm.fireAllRules();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle4 = (EventFactHandle) wm.insert( new OrderEvent( "4",
+                                                                               "customer A",
+                                                                               30 ) );
+        assertEquals( 40000,
+                      handle4.getStartTimestamp() );
+        assertEquals( 0,
+                      handle4.getDuration() );
+
+        wm.fireAllRules();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle5 = (EventFactHandle) wm.insert( new OrderEvent( "5",
+                                                                               "customer A",
+                                                                               70 ) );
+        assertEquals( 50000,
+                      handle5.getStartTimestamp() );
+        assertEquals( 0,
+                      handle5.getDuration() );
+
+        wm.fireAllRules();
+
+        clock.advanceTime( 10000 ); // 10 seconds
+        EventFactHandle handle6 = (EventFactHandle) wm.insert( new OrderEvent( "6",
+                                                                               "customer A",
+                                                                               80 ) );
+        assertEquals( 60000,
+                      handle6.getStartTimestamp() );
+        assertEquals( 0,
+                      handle6.getDuration() );
+
+        wm.fireAllRules();
+
+    }
+
+    //    public void testTransactionCorrelation() throws Exception {
+    //        // read in the source
+    //        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_TransactionCorrelation.drl" ) );
+    //        final RuleBase ruleBase = loadRuleBase( reader );
+    //
+    //        final WorkingMemory wm = ruleBase.newStatefulSession();
+    //        final List results = new ArrayList();
+    //
+    //        wm.setGlobal( "results",
+    //                      results );
+    //
+    //
+    //    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DslTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DslTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DslTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,178 @@
+package org.drools.integrationtests;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+
+public class DslTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testWithExpanderDSL() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_dsl.dslr" ) );
+        final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_expander.dsl" ) );
+        builder.addPackageFromDrl( source,
+                                   dsl );
+
+        // the compiled package
+        final Package pkg = builder.getPackage();
+        assertTrue( pkg.isValid() );
+        assertEquals( null,
+                      pkg.getErrorSummary() );
+        // Check errors
+        final String err = builder.getErrors().toString();
+        assertEquals( "",
+                      err );
+
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        wm.insert( new Person( "Bob",
+                               "http://foo.bar" ) );
+        wm.insert( new Cheese( "stilton",
+                               42 ) );
+
+        final List messages = new ArrayList();
+        wm.setGlobal( "messages",
+                      messages );
+        wm.fireAllRules();
+
+        // should have fired
+        assertEquals( 1,
+                      messages.size() );
+
+    }
+
+    public void testWithExpanderMore() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_dsl_more.dslr" ) );
+        final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_expander.dsl" ) );
+        builder.addPackageFromDrl( source,
+                                   dsl );
+
+        // the compiled package
+        final Package pkg = builder.getPackage();
+        assertTrue( pkg.isValid() );
+        assertEquals( null,
+                      pkg.getErrorSummary() );
+        // Check errors
+        final String err = builder.getErrors().toString();
+        assertEquals( "",
+                      err );
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        wm.insert( new Person( "rage" ) );
+        wm.insert( new Cheese( "cheddar",
+                               15 ) );
+
+        final List messages = new ArrayList();
+        wm.setGlobal( "messages",
+                      messages );
+        wm.fireAllRules();
+
+        // should have NONE, as both conditions should be false.
+        assertEquals( 0,
+                      messages.size() );
+
+        wm.insert( new Person( "fire" ) );
+        wm.fireAllRules();
+
+        // still no firings
+        assertEquals( 0,
+                      messages.size() );
+
+        wm.insert( new Cheese( "brie",
+                               15 ) );
+
+        wm.fireAllRules();
+
+        // YOUR FIRED
+        assertEquals( 1,
+                      messages.size() );
+    }
+
+    public void testEmptyDSL() throws Exception {
+        final String DSL = "# This is an empty dsl file.";
+        final PackageBuilder builder = new PackageBuilder();
+        final Reader drlReader = new InputStreamReader( getClass().getResourceAsStream( "literal_rule.drl" ) );
+        final Reader dslReader = new StringReader( DSL );
+
+        builder.addPackageFromDrl( drlReader,
+                                   dslReader );
+        final Package pkg = builder.getPackage();
+
+        assertFalse( pkg.isValid() );
+    }
+
+    public void testDSLWithIndividualConstraintMappings() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        final Reader source = new InputStreamReader( getClass().getResourceAsStream( "test_dslWithIndividualConstraints.dslr" ) );
+        final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_dslWithIndividualConstraints.dsl" ) );
+        builder.addPackageFromDrl( source,
+                                   dsl );
+
+        // the compiled package
+        final Package pkg = builder.getPackage();
+        assertTrue( pkg.getErrorSummary(),
+                    pkg.isValid() );
+        assertEquals( pkg.getErrorSummary(),
+                      null,
+                      pkg.getErrorSummary() );
+        // Check errors
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        List results = new ArrayList();
+        wm.setGlobal( "results",
+                      results );
+        Cheese cheese = new Cheese( "stilton",
+                                    42 );
+        wm.insert( cheese );
+
+        wm.fireAllRules();
+
+        // should have fired
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( cheese,
+                      results.get( 0 ) );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DynamicRulesTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DynamicRulesTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/DynamicRulesTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,589 @@
+package org.drools.integrationtests;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.FactA;
+import org.drools.FactB;
+import org.drools.Order;
+import org.drools.OrderItem;
+import org.drools.Person;
+import org.drools.PersonInterface;
+import org.drools.Precondition;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.WorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.rule.Package;
+
+public class DynamicRulesTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testDynamicRuleAdditions() throws Exception {
+        Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) );
+
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg1 = serialisePackage( builder.getPackage() );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg1 );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        workingMemory.setGlobal( "total",
+                                 new Integer( 0 ) );
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        // Adding person in advance. There is no Person() object
+        // type node in memory yet, but the rule engine is supposed
+        // to handle that correctly
+        final PersonInterface bob = new Person( "bob",
+                                                "stilton" );
+        bob.setStatus( "Not evaluated" );
+        workingMemory.insert( bob );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           5 );
+        workingMemory.insert( cheddar );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+
+        reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic2.drl" ) );
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg2 = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg2 );
+
+        assertEquals( 3,
+                      list.size() );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+
+        assertTrue( "cheddar".equals( list.get( 1 ) ) || "cheddar".equals( list.get( 2 ) ) );
+
+        assertTrue( "stilton".equals( list.get( 1 ) ) || "stilton".equals( list.get( 2 ) ) );
+
+        list.clear();
+
+        reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic3.drl" ) );
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg3 = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg3 );
+
+        // Package 3 has a rule working on Person instances.
+        // As we added person instance in advance, rule should fire now       
+
+        Assert.assertEquals( "Rule from package 3 should have been fired",
+                             "match Person ok",
+                             bob.getStatus() );
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( bob,
+                      list.get( 0 ) );
+
+        reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic4.drl" ) );
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg4 = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg4 );
+
+        Assert.assertEquals( "Rule from package 4 should have been fired",
+                             "Who likes Stilton ok",
+                             bob.getStatus() );
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( bob,
+                      list.get( 1 ) );
+
+    }
+
+    public void testDynamicRuleRemovals() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic3.drl" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic4.drl" ) ) );
+        final Package pkg = serialisePackage( builder.getPackage() );
+
+        org.drools.reteoo.ReteooRuleBase reteooRuleBase = null;
+        // org.drools.leaps.LeapsRuleBase leapsRuleBase = null;
+        final RuleBase ruleBase = getRuleBase();
+        reteooRuleBase = (org.drools.reteoo.ReteooRuleBase) ruleBase;
+        ruleBase.addPackage( pkg );
+        final PackageBuilder builder2 = new PackageBuilder();
+        builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic2.drl" ) ) );
+        ruleBase.addPackage( serialisePackage( builder2.getPackage() ) );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface bob = new Person( "bob",
+                                                "stilton" );
+        bob.setStatus( "Not evaluated" );
+        workingMemory.insert( bob );
+
+        final Cheese stilton1 = new Cheese( "stilton",
+                                            5 );
+        workingMemory.insert( stilton1 );
+
+        final Cheese stilton2 = new Cheese( "stilton",
+                                            3 );
+        workingMemory.insert( stilton2 );
+
+        final Cheese stilton3 = new Cheese( "stilton",
+                                            1 );
+        workingMemory.insert( stilton3 );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           5 );
+        workingMemory.insert( cheddar );
+
+        assertEquals( 15,
+                      workingMemory.getAgenda().getActivations().length );
+
+        reteooRuleBase.removeRule( "org.drools.test",
+                                   "Who likes Stilton" );
+        assertEquals( 12,
+                      workingMemory.getAgenda().getActivations().length );
+
+        reteooRuleBase.removeRule( "org.drools.test",
+                                   "like cheese" );
+
+        //        reteooRuleBase.removeRule( "org.drools.test",
+        //                                   "like cheese2" );        
+
+        final Cheese muzzarela = new Cheese( "muzzarela",
+                                             5 );
+        assertEquals( 8,
+                      workingMemory.getAgenda().getActivations().length );
+
+        workingMemory.insert( muzzarela );
+
+        assertEquals( 9,
+                      workingMemory.getAgenda().getActivations().length );
+
+        reteooRuleBase.removePackage( "org.drools.test" );
+
+        assertEquals( 0,
+                      workingMemory.getAgenda().getActivations().length );
+    }
+
+    public void testDynamicRuleRemovalsUnusedWorkingMemory() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic2.drl" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic3.drl" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic4.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        org.drools.reteoo.ReteooRuleBase reteooRuleBase = null;
+
+        final RuleBase ruleBase = getRuleBase();
+        reteooRuleBase = (org.drools.reteoo.ReteooRuleBase) ruleBase;
+
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        if ( reteooRuleBase != null ) {
+            assertEquals( 1,
+                          reteooRuleBase.getPackages().length );
+            assertEquals( 5,
+                          reteooRuleBase.getPackages()[0].getRules().length );
+
+            reteooRuleBase.removeRule( "org.drools.test",
+                                       "Who likes Stilton" );
+            assertEquals( 4,
+                          reteooRuleBase.getPackages()[0].getRules().length );
+
+            reteooRuleBase.removeRule( "org.drools.test",
+                                       "like cheese" );
+            assertEquals( 3,
+                          reteooRuleBase.getPackages()[0].getRules().length );
+
+            reteooRuleBase.removePackage( "org.drools.test" );
+            assertEquals( 0,
+                          reteooRuleBase.getPackages().length );
+        }
+    }
+
+    public void testDynamicFunction() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicFunction1.drl" ) ) );
+        
+        //FIXME JBRULES-1258 serialising a package breaks function removal -- left the serialisation commented out for now
+        //final Package pkg = serialisePackage( builder.getPackage() );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+
+        // Check a function can be removed from a package.
+        // Once removed any efforts to use it should throw an Exception
+        ruleBase.removeFunction( "org.drools.test",
+                                 "addFive" );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           5 );
+        workingMemory.insert( cheddar );
+
+        try {
+            workingMemory.fireAllRules();
+            fail( "Function should have been removed and NoClassDefFoundError thrown from the Consequence" );
+        } catch ( final NoClassDefFoundError e ) {
+        }
+
+        // Check a new function can be added to replace an old function
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicFunction2.drl" ) ) );
+
+        ruleBase.addPackage( serialisePackage( builder.getPackage() ) );
+
+        final Cheese brie = new Cheese( "brie",
+                                        5 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 6 ),
+                      list.get( 1 ) );
+
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicFunction3.drl" ) ) );
+
+        ruleBase.addPackage( serialisePackage( builder.getPackage() ) );
+
+        final Cheese feta = new Cheese( "feta",
+                                        5 );
+        workingMemory.insert( feta );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 2 ) );
+    }
+
+    public void testRemovePackage() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RemovePackage.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        final String packageName = builder.getPackage().getName();
+        ruleBase.addPackage( serialisePackage( builder.getPackage() ) );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.insert( new Precondition( "genericcode",
+                                                "genericvalue" ) );
+        workingMemory.fireAllRules();
+
+        final RuleBase ruleBaseWM = workingMemory.getRuleBase();
+        ruleBaseWM.removePackage( packageName );
+        final PackageBuilder builder1 = new PackageBuilder();
+        builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RemovePackage.drl" ) ) );
+        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );
+        workingMemory.fireAllRules();
+
+        ruleBaseWM.removePackage( packageName );
+        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );
+
+        ruleBaseWM.removePackage( packageName );
+        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );
+    }
+
+    public void testDynamicRules() throws Exception {
+        final RuleBase ruleBase = getRuleBase();
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final Cheese a = new Cheese( "stilton",
+                                     10 );
+        final Cheese b = new Cheese( "stilton",
+                                     15 );
+        final Cheese c = new Cheese( "stilton",
+                                     20 );
+        workingMemory.insert( a );
+        workingMemory.insert( b );
+        workingMemory.insert( c );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicRules.drl" ) ) );
+        final Package pkg = builder.getPackage();
+        ruleBase.addPackage( serialisePackage( pkg ) );
+
+        workingMemory.fireAllRules();
+    }
+
+    public void testDynamicRules2() throws Exception {
+        final RuleBase ruleBase = getRuleBase();
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        // Assert some simple facts
+        final FactA a = new FactA( "hello",
+                                   new Integer( 1 ),
+                                   new Float( 3.14 ) );
+        final FactB b = new FactB( "hello",
+                                   new Integer( 2 ),
+                                   new Float( 6.28 ) );
+        workingMemory.insert( a );
+        workingMemory.insert( b );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicRules2.drl" ) ) );
+        final Package pkg = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg );
+
+        workingMemory.fireAllRules();
+    }
+
+    public void testRuleBaseAddRemove() throws Exception {
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+
+        //add and remove
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+        Package pkg = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg );
+        ruleBase.removePackage( pkg.getName() );
+
+        //add and remove again
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+        pkg = serialisePackage( builder.getPackage() );
+        ruleBase.addPackage( pkg );
+        ruleBase.removePackage( pkg.getName() );
+    }
+
+    public void testClassLoaderSwitchsUsingConf() throws Exception {
+        try {
+            // Creates first class loader and use it to load fact classes
+            ClassLoader loader1 = new SubvertedClassLoader( new URL[]{getClass().getResource( "/" )},
+                                                            this.getClass().getClassLoader() );
+            Class cheeseClass = loader1.loadClass( "org.drools.Cheese" );
+
+            PackageBuilderConfiguration conf = new PackageBuilderConfiguration( loader1 );
+            PackageBuilder builder = new PackageBuilder( conf );
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+
+            // must set the classloader for rulebase conf too
+            RuleBaseConfiguration rbconf = new RuleBaseConfiguration( loader1 );
+            RuleBase ruleBase = RuleBaseFactory.newRuleBase( rbconf );
+            Package pkg = serialisePackage( builder.getPackage() );
+            ruleBase.addPackage( pkg );
+
+            StatefulSession wm = ruleBase.newStatefulSession();
+            wm.insert( cheeseClass.newInstance() );
+            wm.fireAllRules();
+
+            // Creates second class loader and use it to load fact classes
+            ClassLoader loader2 = new SubvertedClassLoader( new URL[]{getClass().getResource( "/" )},
+                                                            this.getClass().getClassLoader() );
+            cheeseClass = loader2.loadClass( "org.drools.Cheese" );
+
+            conf = new PackageBuilderConfiguration( loader2 );
+            builder = new PackageBuilder( conf );
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+
+            rbconf = new RuleBaseConfiguration( loader2 );
+            ruleBase = RuleBaseFactory.newRuleBase( rbconf );
+            pkg = serialisePackage( builder.getPackage() );
+            ruleBase.addPackage( pkg );
+
+            wm = ruleBase.newStatefulSession();
+            wm.insert( cheeseClass.newInstance() );
+            wm.fireAllRules();
+        } catch ( ClassCastException cce ) {
+            cce.printStackTrace();
+            fail( "No ClassCastException should be raised." );
+        }
+
+    }
+
+    public void testClassLoaderSwitchsUsingContext() throws Exception {
+        try {
+            // Creates first class loader and use it to load fact classes
+            ClassLoader original = Thread.currentThread().getContextClassLoader();
+            ClassLoader loader1 = new SubvertedClassLoader( new URL[]{getClass().getResource( "/" )},
+                                                            this.getClass().getClassLoader() );
+            Thread.currentThread().setContextClassLoader( loader1 );
+            Class cheeseClass = loader1.loadClass( "org.drools.Cheese" );
+
+            PackageBuilder builder = new PackageBuilder();
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+
+            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+            Package pkg = serialisePackage( builder.getPackage() );
+            ruleBase.addPackage( pkg );
+
+            StatefulSession wm = ruleBase.newStatefulSession();
+            wm.insert( cheeseClass.newInstance() );
+            wm.fireAllRules();
+
+            // Creates second class loader and use it to load fact classes
+            ClassLoader loader2 = new SubvertedClassLoader( new URL[]{getClass().getResource( "/" )},
+                                                            this.getClass().getClassLoader() );
+            Thread.currentThread().setContextClassLoader( loader2 );
+            cheeseClass = loader2.loadClass( "org.drools.Cheese" );
+
+            builder = new PackageBuilder();
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
+
+            ruleBase = RuleBaseFactory.newRuleBase();
+            pkg = serialisePackage( builder.getPackage() );
+            ruleBase.addPackage( pkg );
+
+            wm = ruleBase.newStatefulSession();
+            wm.insert( cheeseClass.newInstance() );
+            wm.fireAllRules();
+
+            Thread.currentThread().setContextClassLoader( original );
+        } catch ( ClassCastException cce ) {
+            cce.printStackTrace();
+            fail( "No ClassCastException should be raised." );
+        }
+    }
+
+    public void testCollectDynamicRules() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_CollectDynamicRules1.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        List list = new ArrayList();
+        workingMemory.setGlobal( "results", list );
+
+        workingMemory.insert( new Cheese( "stilton", 10 ) );
+        workingMemory.insert( new Cheese( "brie", 10 ) );
+        workingMemory.insert( new Cheese( "stilton", 10 ) );
+        workingMemory.insert( new Cheese( "muzzarela", 10 ) );
+
+        final PackageBuilder builder2 = new PackageBuilder();
+        builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_CollectDynamicRules2.drl" ) ) );
+        final Package pkg2 = builder2.getPackage();
+        ruleBase.addPackage( pkg2 );
+
+        // fire all rules is automatic
+        assertEquals( 1, list.size() );
+        assertEquals( 2, ((List)list.get( 0 )).size() );
+
+    }
+
+    public class SubvertedClassLoader extends URLClassLoader {
+
+        private static final long serialVersionUID = 400L;
+
+        public SubvertedClassLoader(final URL[] urls,
+                                    final ClassLoader parentClassLoader) {
+            super( urls,
+                   parentClassLoader );
+        }
+
+        protected synchronized Class loadClass(String name,
+                                               boolean resolve) throws ClassNotFoundException {
+            // First, check if the class has already been loaded
+            Class c = findLoadedClass( name );
+            if ( c == null ) {
+                try {
+                    c = findClass( name );
+                } catch ( ClassNotFoundException e ) {
+                    c = super.loadClass( name,
+                                         resolve );
+                }
+            }
+            return c;
+        }
+    }
+    
+    protected Package serialisePackage(Package pkg) {
+        try {
+        byte[] bytes = serializeOut( pkg );
+        return (Package) serializeIn( bytes );
+        } catch ( Exception e ) {
+            throw new RuntimeException( "trouble serialising package.", e);
+        }
+    }
+
+    protected Object serializeIn(final byte[] bytes) throws IOException,
+                                                    ClassNotFoundException {
+        final ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
+        final Object obj = in.readObject();
+        in.close();
+        return obj;
+    }
+
+    protected byte[] serializeOut(final Object obj) throws IOException {
+        // Serialize to a byte array
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final ObjectOutput out = new ObjectOutputStream( bos );
+        out.writeObject( obj );
+        out.close();
+
+        // Get the bytes of the serialized object
+        final byte[] bytes = bos.toByteArray();
+        return bytes;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,863 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.FactHandle;
+import org.drools.Person;
+import org.drools.PersonInterface;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.WorkingMemory;
+import org.drools.common.DefaultAgenda;
+import org.drools.common.InternalWorkingMemoryActions;
+import org.drools.common.RuleFlowGroupImpl;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.ProcessBuilder;
+import org.drools.compiler.PackageBuilder.PackageMergeException;
+import org.drools.event.ActivationCancelledEvent;
+import org.drools.event.ActivationCreatedEvent;
+import org.drools.event.AgendaEventListener;
+import org.drools.event.DefaultAgendaEventListener;
+import org.drools.Message;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.process.instance.ProcessInstance;
+import org.drools.rule.Package;
+import org.drools.spi.Activation;
+import org.drools.spi.ActivationGroup;
+import org.drools.spi.AgendaGroup;
+
+public class ExecutionFlowControlTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testSalienceInteger() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_salienceIntegerRule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface person = new Person( "Edson",
+                                                   "cheese" );
+        workingMemory.insert( person );
+
+        workingMemory.fireAllRules();
+
+        Assert.assertEquals( "Two rules should have been fired",
+                             2,
+                             list.size() );
+        Assert.assertEquals( "Rule 3 should have been fired first",
+                             "Rule 3",
+                             list.get( 0 ) );
+        Assert.assertEquals( "Rule 2 should have been fired second",
+                             "Rule 2",
+                             list.get( 1 ) );
+    }
+     
+    public void testSalienceExpression() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_salienceExpressionRule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface person10 = new Person( "bob",
+                                                   "cheese",
+                                                   10);
+        workingMemory.insert( person10 );
+        
+        final PersonInterface person20 = new Person( "mic",
+                                                     "cheese",
+                                                     20);
+          workingMemory.insert( person20 );        
+
+        workingMemory.fireAllRules();
+
+        Assert.assertEquals( "Two rules should have been fired",
+                             2,
+                             list.size() );
+        Assert.assertEquals( "Rule 3 should have been fired first",
+                             "Rule 3",
+                             list.get( 0 ) );
+        Assert.assertEquals( "Rule 2 should have been fired second",
+                             "Rule 2",
+                             list.get( 1 ) );
+    }    
+
+    public void testNoLoop() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "no-loop.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        Assert.assertEquals( "Should not loop  and thus size should be 1",
+                             1,
+                             list.size() );
+
+    }
+
+    public void testLockOnActive() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LockOnActive.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        // AgendaGroup "group1" is not active, so should receive activation
+        final Cheese brie12 = new Cheese( "brie",
+                                          12 );
+        workingMemory.insert( brie12 );
+        final AgendaGroup group1 = workingMemory.getAgenda().getAgendaGroup( "group1" );
+        assertEquals( 1,
+                      group1.size() );
+
+        workingMemory.setFocus( "group1" );
+        // AgendaqGroup "group1" is now active, so should not receive activations
+        final Cheese brie10 = new Cheese( "brie",
+                                          10 );
+        workingMemory.insert( brie10 );
+        assertEquals( 1,
+                      group1.size() );
+
+        final Cheese cheddar20 = new Cheese( "cheddar",
+                                             20 );
+        workingMemory.insert( cheddar20 );
+        final AgendaGroup group2 = workingMemory.getAgenda().getAgendaGroup( "group1" );
+        assertEquals( 1,
+                      group2.size() );
+
+        final RuleFlowGroupImpl rfg = (RuleFlowGroupImpl) workingMemory.getAgenda().getRuleFlowGroup( "ruleflow2" );
+        rfg.setActive( true );
+        final Cheese cheddar17 = new Cheese( "cheddar",
+                                             17 );
+        workingMemory.insert( cheddar17 );
+        assertEquals( 1,
+                      group2.size() );
+    }
+
+    public void testLockOnActiveWithModify() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LockOnActiveWithUpdate.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        wm.setGlobal( "list",
+                      list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        13 );
+
+        final Person bob = new Person( "bob" );
+        bob.setCheese( brie );
+
+        final Person mic = new Person( "mic" );
+        mic.setCheese( brie );
+
+        final Person mark = new Person( "mark" );
+        mark.setCheese( brie );
+
+        final FactHandle brieHandle = wm.insert( brie );
+        wm.insert( bob );
+        wm.insert( mic );
+        wm.insert( mark );
+
+        final DefaultAgenda agenda = (DefaultAgenda) wm.getAgenda();
+        final AgendaGroup group1 = agenda.getAgendaGroup( "group1" );
+        agenda.setFocus( group1 );
+        assertEquals( 3,
+                      group1.size() );
+        agenda.fireNextItem( null );
+        assertEquals( 2,
+                      group1.size() );
+        wm.update( brieHandle,
+                         brie );
+        assertEquals( 2,
+                      group1.size() );
+
+        AgendaGroup group2 = agenda.getAgendaGroup( "group2" );
+        agenda.setFocus( group2 );
+
+        RuleFlowGroupImpl rfg = (RuleFlowGroupImpl) wm.getAgenda().getRuleFlowGroup( "ruleflow2" );
+        assertEquals( 3,
+                      rfg.size() );
+
+        agenda.activateRuleFlowGroup( "ruleflow2" );
+        agenda.fireNextItem( null );
+        assertEquals( 2,
+                      rfg.size() );
+        wm.update( brieHandle,
+                         brie );
+        assertEquals( 2,
+                      group2.size() );
+    }
+
+    public void testAgendaGroups() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AgendaGroups.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 7,
+                      list.size() );
+
+        assertEquals( "group3",
+                      list.get( 0 ) );
+        assertEquals( "group4",
+                      list.get( 1 ) );
+        assertEquals( "group3",
+                      list.get( 2 ) );
+        assertEquals( "MAIN",
+                      list.get( 3 ) );
+        assertEquals( "group1",
+                      list.get( 4 ) );
+        assertEquals( "group1",
+                      list.get( 5 ) );
+        assertEquals( "MAIN",
+                      list.get( 6 ) );
+
+        workingMemory.setFocus( "group2" );
+        workingMemory.fireAllRules();
+
+        assertEquals( 8,
+                      list.size() );
+        assertEquals( "group2",
+                      list.get( 7 ) );
+    }
+
+    public void testActivationGroups() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ActivationGroups.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        final ActivationGroup activationGroup0 = workingMemory.getAgenda().getActivationGroup( "activation-group-0" );
+        assertEquals( 2,
+                      activationGroup0.size() );
+
+        final ActivationGroup activationGroup3 = workingMemory.getAgenda().getActivationGroup( "activation-group-3" );
+        assertEquals( 1,
+                      activationGroup3.size() );
+
+        final AgendaGroup agendaGroup3 = workingMemory.getAgenda().getAgendaGroup( "agenda-group-3" );
+        assertEquals( 1,
+                      agendaGroup3.size() );
+
+        final AgendaGroup agendaGroupMain = workingMemory.getAgenda().getAgendaGroup( "MAIN" );
+        assertEquals( 3,
+                      agendaGroupMain.size() );
+
+        workingMemory.clearAgendaGroup( "agenda-group-3" );
+        assertEquals( 0,
+                      activationGroup3.size() );
+        assertEquals( 0,
+                      agendaGroup3.size() );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      activationGroup0.size() );
+
+        assertEquals( 2,
+                      list.size() );
+        assertEquals( "rule0",
+                      list.get( 0 ) );
+        assertEquals( "rule2",
+                      list.get( 1 ) );
+
+    }
+
+    public void testDuration() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Duration.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        final FactHandle brieHandle = workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        // now check for update
+        assertEquals( 0,
+                      list.size() );
+
+        // sleep for 300ms
+        Thread.sleep( 300 );
+
+        // now check for update
+        assertEquals( 1,
+                      list.size() );
+
+    }
+
+    public void testInsertRetractNoloop() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Insert_Retract_Noloop.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        wm.insert( new Cheese( "stilton",
+                                     15 ) );
+
+        wm.fireAllRules();
+    }
+
+    public void testDurationWithNoLoop() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Duration_with_NoLoop.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        final FactHandle brieHandle = workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        // now check for update
+        assertEquals( 0,
+                      list.size() );
+
+        // sleep for 300ms
+        Thread.sleep( 300 );
+
+        // now check for update
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testFireRuleAfterDuration() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FireRuleAfterDuration.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        final FactHandle brieHandle = workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        // now check for update
+        assertEquals( 0,
+                      list.size() );
+
+        // sleep for 300ms
+        Thread.sleep( 300 );
+
+        workingMemory.fireAllRules();
+
+        // now check for update
+        assertEquals( 2,
+                      list.size() );
+
+    }
+
+    public void testUpdateNoLoop() throws Exception {
+        // JBRULES-780, throws a NullPointer or infinite loop if there is an issue
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_UpdateNoloop.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        wm.insert( new Cheese( "stilton",
+                                     15 ) );
+
+        wm.fireAllRules();
+    }
+
+    public void testUpdateActivationCreationNoLoop() throws Exception {
+        // JBRULES-787, no-loop blocks all dependant tuples for update 
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_UpdateActivationCreationNoLoop.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final InternalWorkingMemoryActions wm = (InternalWorkingMemoryActions) ruleBase.newStatefulSession();
+        final List created = new ArrayList();
+        final List cancelled = new ArrayList();
+        final AgendaEventListener l = new DefaultAgendaEventListener() {
+            public void activationCreated(ActivationCreatedEvent event,
+                                          WorkingMemory workingMemory) {
+                created.add( event );
+            }
+
+            public void activationCancelled(ActivationCancelledEvent event,
+                                            WorkingMemory workingMemory) {
+                cancelled.add( event );
+            }
+
+        };
+
+        wm.addEventListener( l );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           15 );
+        final FactHandle stiltonHandle = wm.insert( stilton );
+
+        final Person p1 = new Person( "p1" );
+        p1.setCheese( stilton );
+        wm.insert( p1 );
+
+        final Person p2 = new Person( "p2" );
+        p2.setCheese( stilton );
+        wm.insert( p2 );
+
+        final Person p3 = new Person( "p3" );
+        p3.setCheese( stilton );
+        wm.insert( p3 );
+
+        assertEquals( 3,
+                      created.size() );
+        assertEquals( 0,
+                      cancelled.size() );
+
+        final Activation item = ((ActivationCreatedEvent) created.get( 2 )).getActivation();
+
+        // simulate a modify inside a consequence
+        wm.update( stiltonHandle,
+                         stilton,
+                         item.getRule(),
+                         item );
+
+        // the two of the three tuples should re-activate
+        assertEquals( 5,
+                      created.size() );
+        assertEquals( 3,
+                      cancelled.size() );
+    }
+
+    public void testRuleFlowGroup() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflowgroup.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.insert( "Test" );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.getAgenda().activateRuleFlowGroup( "Group1" );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testRuleFlow() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.drl" ) ) );
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.rfm" ) ) );
+        final Package pkg = builder.getPackage();
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        final ProcessInstance processInstance = workingMemory.startProcess( "0" );
+        assertEquals( ProcessInstance.STATE_ACTIVE,
+                      processInstance.getState() );
+        workingMemory.fireAllRules();
+        assertEquals( 4,
+                      list.size() );
+        assertEquals( "Rule1",
+                      list.get( 0 ) );
+        assertEquals( "Rule3",
+                      list.get( 1 ) );
+        assertEquals( "Rule2",
+                      list.get( 2 ) );
+        assertEquals( "Rule4",
+                      list.get( 3 ) );
+        assertEquals( ProcessInstance.STATE_COMPLETED,
+                      processInstance.getState() );
+    }
+    
+    public void testRuleFlowClear() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ruleflowClear.drl" ) ) );
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "test_ruleflowClear.rfm" ) ) );
+        final Package pkg = builder.getPackage();
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+        
+        final List activations = new ArrayList();
+        AgendaEventListener listener = new DefaultAgendaEventListener() {            
+            public void activationCancelled(ActivationCancelledEvent event,
+                                            WorkingMemory workingMemory) {
+                activations.add( event.getActivation() );
+            }
+        };
+        
+        workingMemory.addEventListener( listener );
+     
+        assertEquals( 0 , workingMemory.getAgenda().getRuleFlowGroup( "flowgroup-1" ).size() );
+        
+        // We need to call fireAllRules here to get the InitialFact into the system, to the eval(true)'s kick in
+        workingMemory.fireAllRules();
+        
+        // Now we have 4 in the RuleFlow, but not yet in the agenda
+        assertEquals( 4 , workingMemory.getAgenda().getRuleFlowGroup( "flowgroup-1" ).size() );
+        
+        // Check they aren't in the Agenda
+        assertEquals( 0, workingMemory.getAgenda().getAgendaGroup( "MAIN" ).size() );
+        
+        // Start the process, which shoudl populate the Agenda
+        final ProcessInstance processInstance = workingMemory.startProcess( "ruleFlowClear" );
+        assertEquals( 4, workingMemory.getAgenda().getAgendaGroup( "MAIN" ).size() );
+        
+        
+        // Check we have 0 activation cancellation events
+        assertEquals( 0, activations.size() );
+        
+        workingMemory.getAgenda().clearRuleFlowGroup( "flowgroup-1" );
+        
+        // Check the AgendaGroup and RuleFlowGroup  are now empty
+        assertEquals( 0, workingMemory.getAgenda().getAgendaGroup( "MAIN" ).size() );
+        assertEquals( 0 , workingMemory.getAgenda().getRuleFlowGroup( "flowgroup-1" ).size() );
+        
+        // Check we have four activation cancellation events
+        assertEquals( 4, activations.size() );              
+    }
+    
+    public void testRuleFlowInPackage() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.drl" ) ) );
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.rfm" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        final ProcessInstance processInstance = workingMemory.startProcess( "0" );
+        assertEquals( ProcessInstance.STATE_ACTIVE,
+                      processInstance.getState() );
+        workingMemory.fireAllRules();
+        assertEquals( 4,
+                      list.size() );
+        assertEquals( "Rule1",
+                      list.get( 0 ) );
+        assertEquals( "Rule3",
+                      list.get( 1 ) );
+        assertEquals( "Rule2",
+                      list.get( 2 ) );
+        assertEquals( "Rule4",
+                      list.get( 3 ) );
+        assertEquals( ProcessInstance.STATE_COMPLETED,
+                      processInstance.getState() );
+        
+    }
+    
+    public void testLoadingRuleFlowInPackage1() throws Exception {
+    	// adding ruleflow before adding package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.rfm" ) ) );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.drl" ) ) );
+        builder.getPackage();
+    }
+
+    public void testLoadingRuleFlowInPackage2() throws Exception {
+    	// only adding ruleflow
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.rfm" ) ) );
+        builder.getPackage();
+    }
+
+    public void testLoadingRuleFlowInPackage3() throws Exception {
+    	// only adding ruleflow without any generated rules
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "empty_ruleflow.rfm" ) ) );
+        builder.getPackage();
+    }
+
+    public void testLoadingRuleFlowInPackage4() throws Exception {
+    	// adding ruleflows of different package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "empty_ruleflow.rfm" ) ) );
+        try {
+        	builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.rfm" ) ) );
+        	throw new Exception("An exception should have been thrown.");
+        } catch (PackageMergeException e) {
+        	// do nothing
+        }
+    }
+
+    public void testLoadingRuleFlowInPackage5() throws Exception {
+    	// adding ruleflow of different package than rules
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.drl" ) ) );
+        try {
+        	builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "empty_ruleflow.rfm" ) ) );
+        	throw new Exception("An exception should have been thrown.");
+        } catch (PackageMergeException e) {
+        	// do nothing
+        }
+    }
+
+    public void testLoadingRuleFlowInPackage6() throws Exception {
+    	// adding rules of different package than ruleflow
+        final PackageBuilder builder = new PackageBuilder();
+    	builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "empty_ruleflow.rfm" ) ) );
+        try {
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "ruleflow.drl" ) ) );
+        	throw new Exception("An exception should have been thrown.");
+        } catch (PackageMergeException e) {
+        	// do nothing
+        }
+    }
+    
+    public void testRuleFlowActionDialects() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "test_ActionDialects.rfm" ) ) ); 
+        
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        
+        StatefulSession session = ruleBase.newStatefulSession();
+        List list = new ArrayList();
+        session.setGlobal( "list", list );
+        
+        session.startProcess( "ActionDialects" );
+        
+        assertEquals( 2, list.size() );
+        assertEquals( "mvel was here", list.get( 0 ) );
+        assertEquals( "java was here", list.get( 1 ) );
+    }
+    
+    public void testRuleFlowConstraintDialects() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "test_ConstraintDialects.rfm" ) ) );
+        
+        System.err.print( builder.getErrors() );
+        
+        assertEquals( 0, builder.getErrors().getErrors().length );
+        
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        
+        StatefulSession session = ruleBase.newStatefulSession();
+        List inList = new ArrayList();
+        List outList = new ArrayList();
+        session.setGlobal( "inList", inList );
+        session.setGlobal( "outList", outList );
+        
+        inList.add( 1 );
+        inList.add( 3 );
+        inList.add( 6 );
+        inList.add( 25 );
+        
+        FactHandle handle = session.insert( inList );        
+        session.startProcess( "ConstraintDialects" );        
+        assertEquals( 4, outList.size() );
+        assertEquals( "MVELCodeConstraint was here", outList.get( 0 ));
+        assertEquals( "JavaCodeConstraint was here", outList.get( 1 ));
+        assertEquals( "MVELRuleConstraint was here", outList.get( 2 ));
+        assertEquals( "JavaRuleConstraint was here", outList.get( 3 ));
+        
+        outList.clear();
+        inList.remove( new Integer( 1 ) );
+        session.update( handle, inList );
+        session.startProcess( "ConstraintDialects" );
+        assertEquals( 3, outList.size() );
+        assertEquals( "JavaCodeConstraint was here", outList.get( 0 ));
+        assertEquals( "MVELRuleConstraint was here", outList.get( 1 ));
+        assertEquals( "JavaRuleConstraint was here", outList.get( 2 ));      
+        
+        outList.clear();
+        inList.remove( new Integer( 6 ) );
+        session.update( handle, inList );
+        session.startProcess( "ConstraintDialects" );
+        assertEquals( 2, outList.size() );
+        assertEquals( "JavaCodeConstraint was here", outList.get( 0 ));
+        assertEquals( "JavaRuleConstraint was here", outList.get( 1 ));    
+        
+        outList.clear();
+        inList.remove( new Integer( 3 ) );        
+        session.update( handle, inList );
+        session.startProcess( "ConstraintDialects" );
+        assertEquals( 1, outList.size() );
+        assertEquals( "JavaRuleConstraint was here", outList.get( 0 ));          
+        
+        outList.clear();
+        inList.remove( new Integer( 25 ) );
+        session.update( handle, inList );
+        try {
+            session.startProcess( "ConstraintDialects" );
+            fail("This should have thrown an exception" );
+        } catch ( Exception e ) {
+        }                     
+    }    
+
+    public void testLoadingRuleFlowInPackage7() throws Exception {
+    	// loading a ruleflow with errors
+        final PackageBuilder builder = new PackageBuilder();
+    	builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "error_ruleflow.rfm" ) ) );
+    	assertEquals(1, builder.getErrors().getErrors().length);
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testDateEffective() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_EffectiveDate.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        // go !
+        final Message message = new Message( "hola" );
+        workingMemory.insert( message );
+        workingMemory.fireAllRules();
+        assertFalse( message.isFired() );
+
+    }    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,897 @@
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.FactHandle;
+import org.drools.Order;
+import org.drools.OrderItem;
+import org.drools.Person;
+import org.drools.PersonInterface;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.SpecialString;
+import org.drools.State;
+import org.drools.StatefulSession;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+
+public class FirstOrderLogicTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testCollect() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Collect.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "stilton",
+                               7 ) );
+        wm.insert( new Cheese( "stilton",
+                               8 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+        wm.insert( new Cheese( "provolone",
+                               20 ) );
+        wm.insert( new Person( "Bob",
+                               "stilton" ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Collection) results.get( 0 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( 0 ).getClass().getName() );
+    }
+
+    public void testCollectModify() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Collect.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+        final Person bob = new Person( "Bob",
+                                       "stilton" );
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+        final FactHandle bobHandle = wm.insert( bob );
+
+        // ---------------- 1st scenario
+        int fireCount = 0;
+        wm.fireAllRules();
+        Assert.assertEquals( ++fireCount,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Collection) results.get( fireCount - 1 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( fireCount - 1 ).getClass().getName() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setPrice( 9 );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( ++fireCount,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Collection) results.get( fireCount - 1 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( fireCount - 1 ).getClass().getName() );
+
+        // ---------------- 3rd scenario
+        bob.setLikes( "brie" );
+        wm.update( bobHandle,
+                   bob );
+        wm.fireAllRules();
+
+        Assert.assertEquals( fireCount,
+                             results.size() );
+
+        // ---------------- 4th scenario
+        wm.retract( cheeseHandles[3] );
+        wm.fireAllRules();
+
+        // should not have fired as per constraint
+        Assert.assertEquals( fireCount,
+                             results.size() );
+    }
+
+    public void testExistsWithBinding() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ExistsWithBindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Cheese c = new Cheese( "stilton",
+                                     10 );
+        final Person p = new Person( "Mark",
+                                     "stilton" );
+        workingMemory.insert( c );
+        workingMemory.insert( p );
+        workingMemory.fireAllRules();
+
+        assertTrue( list.contains( c.getType() ) );
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testNot() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "not_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        final FactHandle stiltonHandle = workingMemory.insert( stilton );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final FactHandle cheddarHandle = workingMemory.insert( cheddar );
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.retract( stiltonHandle );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 4,
+                      list.size() );
+        Assert.assertTrue( list.contains( new Integer( 5 ) ) );
+        Assert.assertTrue( list.contains( new Integer( 6 ) ) );
+        Assert.assertTrue( list.contains( new Integer( 7 ) ) );
+        Assert.assertTrue( list.contains( new Integer( 8 ) ) );
+    }
+
+    public void testNotWithBindings() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "not_with_bindings_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final Rule rule = pkg.getRules()[0];
+        assertTrue( rule.isValid() );
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        final FactHandle stiltonHandle = workingMemory.insert( stilton );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final FactHandle cheddarHandle = workingMemory.insert( cheddar );
+
+        final PersonInterface paul = new Person( "paul",
+                                                 "stilton",
+                                                 12 );
+        workingMemory.insert( paul );
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.retract( stiltonHandle );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testExists() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "exists_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final FactHandle cheddarHandle = workingMemory.insert( cheddar );
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        final FactHandle stiltonHandle = workingMemory.insert( stilton );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        final Cheese brie = new Cheese( "brie",
+                                        5 );
+        final FactHandle brieHandle = workingMemory.insert( brie );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testExists2() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_exists.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final Cheese provolone = new Cheese( "provolone",
+                                             5 );
+        final Person edson = new Person( "Edson",
+                                         "cheddar" );
+        final Person bob = new Person( "Bob",
+                                       "muzzarela" );
+
+        workingMemory.insert( cheddar );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.insert( provolone );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.insert( edson );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        workingMemory.insert( bob );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testForall() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Forall.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final State state = new State( "SP" );
+        workingMemory.insert( state );
+
+        final Person bob = new Person( "Bob" );
+        bob.setStatus( state.getState() );
+        bob.setLikes( "stilton" );
+        workingMemory.insert( bob );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.insert( new Cheese( bob.getLikes(),
+                                          10 ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testRemoveIdentitiesSubNetwork() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_removeIdentitiesSubNetwork.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBaseConfiguration config = new RuleBaseConfiguration();
+        config.setRemoveIdentities( true );
+        final RuleBase ruleBase = getRuleBase( config );
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Person bob = new Person( "bob",
+                                       "stilton" );
+        workingMemory.insert( bob );
+
+        final Person mark = new Person( "mark",
+                                        "stilton" );
+        workingMemory.insert( mark );
+
+        final Cheese stilton1 = new Cheese( "stilton",
+                                            6 );
+        final FactHandle stilton1Handle = workingMemory.insert( stilton1 );
+        final Cheese stilton2 = new Cheese( "stilton",
+                                            7 );
+        final FactHandle stilton2Handle = workingMemory.insert( stilton2 );
+
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.retract( stilton1Handle );
+
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+        assertEquals( mark,
+                      list.get( 0 ) );
+
+        workingMemory.retract( stilton2Handle );
+
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      list.size() );
+        assertEquals( bob,
+                      list.get( 1 ) );
+    }
+
+    public void testCollectWithNestedFromWithParams() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_CollectWithNestedFrom.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Person bob = new Person( "bob",
+                                       "stilton" );
+
+        Cheesery cheesery = new Cheesery();
+        cheesery.addCheese( new Cheese( "stilton",
+                                        10 ) );
+        cheesery.addCheese( new Cheese( "brie",
+                                        20 ) );
+        cheesery.addCheese( new Cheese( "muzzarela",
+                                        8 ) );
+        cheesery.addCheese( new Cheese( "stilton",
+                                        5 ) );
+        cheesery.addCheese( new Cheese( "provolone",
+                                        1 ) );
+
+        workingMemory.insert( bob );
+        workingMemory.insert( cheesery );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        List cheeses = (List) results.get( 0 );
+        assertEquals( 2,
+                      cheeses.size() );
+        assertEquals( bob.getLikes(),
+                      ((Cheese) cheeses.get( 0 )).getType() );
+        assertEquals( bob.getLikes(),
+                      ((Cheese) cheeses.get( 1 )).getType() );
+
+    }
+
+    public void testCollectModifyAlphaRestriction() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CollectAlphaRestriction.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
+                                                         10 ), new Cheese( "stilton",
+                                                                           2 ), new Cheese( "stilton",
+                                                                                            5 ), new Cheese( "brie",
+                                                                                                             15 ), new Cheese( "brie",
+                                                                                                                               16 ), new Cheese( "provolone",
+                                                                                                                                                 8 )};
+
+        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
+        for ( int i = 0; i < cheese.length; i++ ) {
+            cheeseHandles[i] = wm.insert( cheese[i] );
+        }
+
+        // ---------------- 1st scenario
+        int fireCount = 0;
+        wm.fireAllRules();
+        Assert.assertEquals( ++fireCount,
+                             results.size() );
+        Assert.assertEquals( 3,
+                             ((Collection) results.get( fireCount - 1 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( fireCount - 1 ).getClass().getName() );
+
+        // ---------------- 2nd scenario
+        final int index = 1;
+        cheese[index].setType( "brie" );
+        wm.update( cheeseHandles[index],
+                   cheese[index] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( ++fireCount,
+                             results.size() );
+        Assert.assertEquals( 2,
+                             ((Collection) results.get( fireCount - 1 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( fireCount - 1 ).getClass().getName() );
+
+        // ---------------- 3rd scenario
+        wm.retract( cheeseHandles[2] );
+        wm.fireAllRules();
+
+        Assert.assertEquals( ++fireCount,
+                             results.size() );
+        Assert.assertEquals( 1,
+                             ((Collection) results.get( fireCount - 1 )).size() );
+        Assert.assertEquals( ArrayList.class.getName(),
+                             results.get( fireCount - 1 ).getClass().getName() );
+
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testForallSinglePattern() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ForallSinglePattern.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        // no cheeses, so should fire
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        // only stilton, so should not fire again
+        FactHandle stilton1 = workingMemory.insert( new Cheese( "stilton",
+                                                                10 ) );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        // only stilton, so should fire again
+        FactHandle stilton2 = workingMemory.insert( new Cheese( "stilton",
+                                                                11 ) );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        // there is a brie, so should not fire 
+        FactHandle brie = workingMemory.insert( new Cheese( "brie",
+                                                            10 ) );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        // there is a brie, so should not fire 
+        workingMemory.retract( stilton1 );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+
+        // no brie anymore, so should fire 
+        workingMemory.retract( brie );
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      list.size() );
+
+        //        TODO: in the future, we need to fix the following test case
+        //        // no cheese anymore, so should not fire again 
+        //        workingMemory.retract( stilton2 );
+        //        workingMemory.fireAllRules();
+        //        assertEquals( 2,
+        //                      list.size() );
+        //        
+
+    }
+
+    public void testMVELCollect() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_MVELCollect.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        wm.insert( new Cheese( "stilton",
+                               10 ) );
+        wm.insert( new Cheese( "stilton",
+                               7 ) );
+        wm.insert( new Cheese( "stilton",
+                               8 ) );
+        wm.insert( new Cheese( "brie",
+                               5 ) );
+        wm.insert( new Cheese( "provolone",
+                               150 ) );
+        wm.insert( new Cheese( "provolone",
+                               20 ) );
+        wm.insert( new Person( "Bob",
+                               "stilton" ) );
+        wm.insert( new Person( "Mark",
+                               "provolone" ) );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( 1,
+                             results.size() );
+        Assert.assertEquals( 6,
+                             ((List) results.get( 0 )).size() );
+    }
+
+    public void testNestedCorelatedRulesWithForall() throws Exception {
+
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( FirstOrderLogicTest.class.getResourceAsStream( "test_NestedCorrelatedRulesWithForall.drl" ) ) );
+
+        RuleBase rb = RuleBaseFactory.newRuleBase();
+        rb.addPackage( builder.getPackage() );
+        StatefulSession session = rb.newStatefulSession();
+
+        List list1 = new ArrayList();
+        List list2 = new ArrayList();
+        List list3 = new ArrayList();
+        List list4 = new ArrayList();
+
+        session.setGlobal( "list1",
+                           list1 );
+        session.setGlobal( "list2",
+                           list2 );
+        session.setGlobal( "list3",
+                           list3 );
+        session.setGlobal( "list4",
+                           list4 );
+
+        SpecialString first42 = new SpecialString( "42" );
+        SpecialString second42 = new SpecialString( "42" );
+        SpecialString world = new SpecialString( "World" );
+
+        //System.out.println( "Inserting ..." );
+
+        session.insert( world );
+        session.insert( first42 );
+        session.insert( second42 );
+
+        //System.out.println( "Done." );
+
+        //System.out.println( "Firing rules ..." );
+
+        // check all lists are empty
+        assertTrue( list1.isEmpty() );
+        assertTrue( list2.isEmpty() );
+        assertTrue( list3.isEmpty() );
+        assertTrue( list4.isEmpty() );
+
+        session.fireAllRules();
+
+        //System.out.println( "Done." );
+
+        // check first list is populated correctly
+        assertEquals( 0,
+                      list1.size() );
+
+        // check second list is populated correctly        
+        assertEquals( 0,
+                      list2.size() );
+
+        // check third list is populated correctly        
+        assertEquals( 1,
+                      list3.size() );
+
+        // check fourth list is populated correctly        
+        assertEquals( 0,
+                      list4.size() );
+    }
+
+    public void testFromInsideNotAndExists() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FromInsideNotAndExists.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final Cheese provolone = new Cheese( "provolone",
+                                             5 );
+        final Cheesery cheesery = new Cheesery();
+
+        cheesery.addCheese( cheddar );
+        cheesery.addCheese( provolone );
+
+        FactHandle handle = workingMemory.insert( cheesery );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        cheesery.addCheese( new Cheese( "stilton",
+                                        10 ) );
+        cheesery.removeCheese( cheddar );
+        workingMemory.update( handle,
+                              cheesery );
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      list.size() );
+
+    }
+
+    public void testOr() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OrNesting.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           7 );
+        final Cheese provolone = new Cheese( "provolone",
+                                             5 );
+        final Cheese brie = new Cheese( "brie",
+                                        15 );
+        final Person mark = new Person( "mark",
+                                        "stilton" );
+
+        FactHandle ch = workingMemory.insert( cheddar );
+        FactHandle ph = workingMemory.insert( provolone );
+        FactHandle bh = workingMemory.insert( brie );
+        FactHandle markh = workingMemory.insert( mark );
+
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testCollectWithMemberOfOperators() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_CollectMemberOfOperator.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 1,
+                                        "bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        final Order order2 = new Order( 2,
+                                        "mark" );
+        final OrderItem item21 = new OrderItem( order2,
+                                                1 );
+        final OrderItem item22 = new OrderItem( order2,
+                                                2 );
+
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+        workingMemory.insert( order2 );
+        workingMemory.insert( item21 );
+        workingMemory.insert( item22 );
+
+        workingMemory.fireAllRules();
+
+        int index = 0;
+        assertEquals( 8,
+                      list.size() );
+        assertSame( order1,
+                    list.get( index++ ) );
+        assertSame( item11,
+                    list.get( index++ ) );
+        assertSame( order2,
+                    list.get( index++ ) );
+        assertSame( item21,
+                    list.get( index++ ) );
+        assertSame( order1,
+                    list.get( index++ ) );
+        assertSame( item11,
+                    list.get( index++ ) );
+        assertSame( order2,
+                    list.get( index++ ) );
+        assertSame( item21,
+                    list.get( index++ ) );
+
+    }
+
+    public void testCollectWithContainsOperators() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_CollectContainsOperator.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 1,
+                                        "bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        final Order order2 = new Order( 2,
+                                        "mark" );
+        final OrderItem item21 = new OrderItem( order2,
+                                                1 );
+        final OrderItem item22 = new OrderItem( order2,
+                                                2 );
+
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+        workingMemory.insert( order2 );
+        workingMemory.insert( item21 );
+        workingMemory.insert( item22 );
+
+        workingMemory.fireAllRules();
+
+        int index = 0;
+        assertEquals( 8,
+                      list.size() );
+        assertSame( order1,
+                    list.get( index++ ) );
+        assertSame( item11,
+                    list.get( index++ ) );
+        assertSame( order2,
+                    list.get( index++ ) );
+        assertSame( item21,
+                    list.get( index++ ) );
+        assertSame( order1,
+                    list.get( index++ ) );
+        assertSame( item11,
+                    list.get( index++ ) );
+        assertSame( order2,
+                    list.get( index++ ) );
+        assertSame( item21,
+                    list.get( index++ ) );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/IteratorToList.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/IteratorToList.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/IteratorToList.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.integrationtests;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class IteratorToList {
+    public static List convert(Iterator it) {
+        List list = new ArrayList();
+        while ( it.hasNext() ) {
+            list.add( it.next() );
+        }
+        return list;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/LargeRuleBase.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/LargeRuleBase.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/LargeRuleBase.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,214 @@
+package org.drools.integrationtests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.StringReader;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+
+import junit.framework.Assert;
+
+/**
+ * This generates a large number of rules (complex ones) and then times
+ * compiling, serializing etc.
+ */
+public class LargeRuleBase {
+
+	private static final int RULE_COUNT = 20000;
+
+	public static void main(String[] args) throws Exception {
+		System.err.println(Runtime.getRuntime().freeMemory());
+
+		// bigBlobCompile();
+		realisticSmallBlobCompile();
+		System.gc();
+		Thread.sleep(5000);
+		System.err.println(Runtime.getRuntime().freeMemory());
+
+	}
+
+	private static void bigBlobCompile() throws DroolsParserException,
+			IOException, Exception {
+		StringBuffer buf = new StringBuffer();
+		buf.append(getHeader());
+
+		for (int i = 0; i < RULE_COUNT; i++) {
+			String name = "x" + i;
+			int status = i;
+
+			String r = getTemplate1(name, status);
+			buf.append(r);
+		}
+
+		/* love you */long time = System.currentTimeMillis();
+
+		DrlParser ps = new DrlParser();
+		PackageDescr pkg = ps.parse(new StringReader(buf.toString()));
+
+		System.err.println("Time taken for parsing: "
+				+ (System.currentTimeMillis() - time));
+
+		time = System.currentTimeMillis();
+		PackageBuilder b = new PackageBuilder();
+		b.addPackage(pkg);
+		Assert.assertFalse(b.getErrors().toString(), b.hasErrors());
+
+		System.err.println("Time taken for compiling: "
+				+ (System.currentTimeMillis() - time));
+		time = System.currentTimeMillis();
+
+		Package p = b.getPackage();
+		RuleBase rb = RuleBaseFactory.newRuleBase();
+
+		rb.addPackage(p);
+
+		System.err.println("Time taken rete building: "
+				+ (System.currentTimeMillis() - time));
+
+		File f = new File("foo.rulebase");
+		if (f.exists())
+			f.delete();
+
+		time = System.currentTimeMillis();
+		ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(f));
+		out.writeObject(rb);
+		out.flush();
+		out.close();
+		System.err.println("Time taken serializing rulebase: "
+				+ (System.currentTimeMillis() - time));
+
+		time = System.currentTimeMillis();
+		ObjectInputStream in = new ObjectInputStream(new FileInputStream(f));
+		RuleBase rb_ = (RuleBase) in.readObject();
+		System.err.println("Time taken de-serializing rulebase: "
+				+ (System.currentTimeMillis() - time));
+
+	}
+
+	private static void smallBlobCompile() throws DroolsParserException,
+			IOException, Exception {
+
+		/* love you */long time = System.currentTimeMillis();
+		PackageBuilder b = new PackageBuilder();
+		b.addPackageFromDrl(new StringReader(getHeader()));
+		for (int i = 0; i < RULE_COUNT; i++) {
+			String name = "x" + i;
+			int status = i;
+
+			String r = getTemplate2(name, i, status);
+			b.addPackageFromDrl(new StringReader(r));
+			if (i % 1000 == 0)
+				System.err.println("Rule #" + i);
+
+		}
+
+		Assert.assertFalse(b.getErrors().toString(), b.hasErrors());
+
+		System.err.println("Time taken for compiling: "
+				+ (System.currentTimeMillis() - time));
+		time = System.currentTimeMillis();
+
+		Package p = b.getPackage();
+		RuleBase rb = RuleBaseFactory.newRuleBase();
+
+		rb.addPackage(p);
+
+		System.err.println("Time taken rete building: "
+				+ (System.currentTimeMillis() - time));
+	}
+
+	private static void realisticSmallBlobCompile() throws DroolsParserException,
+			IOException, Exception {
+
+		/* love you */long time = System.currentTimeMillis();
+		PackageBuilder b = new PackageBuilder();
+		b.addPackageFromDrl(new StringReader(getHeader()));
+
+		int count = 0;
+
+		for (int i = 0; i < 2000; i++) {
+
+			String name = "x" + i;
+			for (int j = 0; j < 10; j++) {
+				count++;
+				int status = j;
+				String r = getTemplate2(name, count, status);
+				b.addPackageFromDrl(new StringReader(r));
+				if (count % 1000 == 0)
+					System.err.println("Rule #" + count);
+			}
+
+		}
+
+		Assert.assertFalse(b.getErrors().toString(), b.hasErrors());
+
+		System.err.println("Time taken for compiling: "
+				+ (System.currentTimeMillis() - time));
+		time = System.currentTimeMillis();
+
+		Package p = b.getPackage();
+		RuleBase rb = RuleBaseFactory.newRuleBase();
+
+		rb.addPackage(p);
+
+		System.err.println("Time taken rete building: "
+				+ (System.currentTimeMillis() - time));
+	}
+
+	private static String getHeader() {
+		return "package org.drools.test; \n " + "import org.drools.Person; \n "
+				+ "import org.drools.Cheese; \n "
+				+ "import org.drools.Cheesery; \n "
+				+ " import java.util.List \n "
+				+ " global List list \n dialect 'mvel'\n  ";
+	}
+
+	private static String getTemplate1(String name, int status) {
+		return "rule 'match Person "
+				+ name
+				+ "' \n"
+				+ " agenda-group \'xxx\' \n"
+				+ " salience ($age2 - $age1) \n "
+				+ " dialect 'mvel' \n"
+				+ "	when \n "
+				+ " 		$person : Person(name=='"
+				+ name
+				+ "', $age1 : age ) \n "
+				+ "	    cheesery : Cheesery( cheeses contains $person, status == "
+				+ status + " ) \n "
+				+ " 		cheeses : List() from cheesery.getCheeses() \n "
+				+ "		Person( age < ( $age1 ) ) \n "
+				+ "		Person( $age2 : age -> ( $age1 == $age2 ) ) \n "
+				+ "		eval( $age1 == $age2 ) \n " + "   then \n "
+				+ "		list.add( $person ); \n "
+				+ "		$person.setStatus(\"match Person ok\"); \n " + " end \n";
+	}
+
+	private static String getTemplate2(String name, int num,  int status) {
+		return "rule 'match Person "
+				+ num
+				+ "' \n"
+				+ " dialect 'mvel' \n"
+				+ "	when \n "
+				+ " 		$person : Person(name=='"
+				+ name
+				+ "', $age1 : age ) \n "
+				+ "	    cheesery : Cheesery( cheeses contains $person, status == "
+				+ status + " ) \n "
+				+ " Person(age < " + num + ") \n"
+				+ " then \n "
+				+ "		list.add( $person ); \n "
+				+ "		$person.setStatus(\"match Person ok\"); \n " + " end \n";
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MVELTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MVELTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MVELTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,155 @@
+package org.drools.integrationtests;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectOutputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.common.DroolsObjectInputStream;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.util.DateUtils;
+import org.mvel.MVEL;
+
+public class MVELTest extends TestCase {
+    public void testHelloWorld() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_mvel.drl" ) );
+        RuleBase ruleBase = loadRuleBase( reader );
+
+        // Bellow lines are a way to make sure serialization is fine
+        // start of serialization block
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ObjectOutputStream obj = new ObjectOutputStream( out );
+        obj.writeObject( ruleBase );
+        obj.close();
+
+        byte[] buf = out.toByteArray();
+
+        DroolsObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( buf ) );
+        ruleBase = (RuleBase) in.readObject();
+        // end of serialization block
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final List list2 = new ArrayList();
+        workingMemory.setGlobal( "list2",
+                                 list2 );
+
+
+        Cheese c = new Cheese("stilton", 10) ;
+        workingMemory.insert( c);
+        workingMemory.fireAllRules();
+        assertEquals( 2, list.size() );
+        assertEquals( new Integer(30), list.get(0));
+        assertEquals( new Integer(22), list.get(1));
+
+        assertEquals( "hello world", list2.get(0));
+
+        Date dt = DateUtils.parseDate( "10-Jul-1974" );
+        assertEquals(dt, c.getUsedBy());
+    }
+    
+    public void testLocalVariableMVELConsequence() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LocalVariableMVELConsequence.drl" ) ) );
+        final Package pkg = builder.getPackage();
+ 
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+ 
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+ 
+        workingMemory.insert( new Person( "bob", "stilton" ) );
+        workingMemory.insert( new Person( "mark", "brie" ) );
+ 
+        try {
+            workingMemory.fireAllRules();
+ 
+            assertEquals( "should have fired twice", 
+                          2,
+                          list.size() );
+ 
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail( "Should not raise any exception");
+        }
+ 
+    }    
+
+    public void FIXME_testDuplicateLocalVariableMVELConsequence() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DuplicateLocalVariableMVELConsequence.drl" ) ) );
+        
+        try {
+            final Package pkg = builder.getPackage();
+            
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg );
+            
+            fail( "Should have raised exception because of the duplicate variable definition");
+        } catch (Exception e) {
+            // success
+        }
+ 
+    }    
+
+    public Object compiledExecute(String ex) {
+        Serializable compiled = MVEL.compileExpression(ex);
+        return MVEL.executeExpression(compiled, new Object(), new HashMap());
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+
+        System.out.println( builder.getErrors() );
+
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MiscTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MiscTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/MiscTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,4845 @@
+package org.drools.integrationtests;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.acme.insurance.Driver;
+import org.acme.insurance.Policy;
+import org.drools.Address;
+import org.drools.Attribute;
+import org.drools.Cell;
+import org.drools.Cheese;
+import org.drools.CheeseEqual;
+import org.drools.Cheesery;
+import org.drools.Child;
+import org.drools.FactA;
+import org.drools.FactB;
+import org.drools.FactC;
+import org.drools.FactHandle;
+import org.drools.FirstClass;
+import org.drools.FromTestClass;
+import org.drools.Guess;
+import org.drools.IndexedNumber;
+import org.drools.InsertedObject;
+import org.drools.Message;
+import org.drools.Order;
+import org.drools.OrderItem;
+import org.drools.Person;
+import org.drools.PersonFinal;
+import org.drools.PersonInterface;
+import org.drools.PersonWithEquals;
+import org.drools.PolymorphicFact;
+import org.drools.Primitives;
+import org.drools.QueryResult;
+import org.drools.QueryResults;
+import org.drools.RandomNumber;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.SecondClass;
+import org.drools.Sensor;
+import org.drools.SpecialString;
+import org.drools.State;
+import org.drools.StatefulSession;
+import org.drools.StatelessSession;
+import org.drools.TestParam;
+import org.drools.WorkingMemory;
+import org.drools.Cheesery.Maturity;
+import org.drools.audit.WorkingMemoryFileLogger;
+import org.drools.base.ClassObjectFilter;
+import org.drools.common.AbstractWorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsError;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ParserError;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.PackageBuilder.PackageMergeException;
+import org.drools.event.ActivationCancelledEvent;
+import org.drools.event.ActivationCreatedEvent;
+import org.drools.event.AfterActivationFiredEvent;
+import org.drools.event.AgendaEventListener;
+import org.drools.event.AgendaGroupPoppedEvent;
+import org.drools.event.AgendaGroupPushedEvent;
+import org.drools.event.BeforeActivationFiredEvent;
+import org.drools.event.DefaultWorkingMemoryEventListener;
+import org.drools.event.ObjectInsertedEvent;
+import org.drools.event.ObjectRetractedEvent;
+import org.drools.event.ObjectUpdatedEvent;
+import org.drools.event.WorkingMemoryEventListener;
+import org.drools.facttemplates.Fact;
+import org.drools.facttemplates.FactTemplate;
+import org.drools.lang.DrlDumper;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.InvalidRulePackage;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
+import org.drools.spi.Activation;
+import org.drools.spi.ConsequenceExceptionHandler;
+import org.drools.spi.GlobalResolver;
+import org.drools.xml.XmlDumper;
+
+
+/** Run all the tests with the ReteOO engine implementation */
+public class MiscTest extends TestCase {
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testGlobals() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "globals_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.setGlobal( "string",
+                                 "stilton" );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+    }
+
+    public void testGlobals2() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_globalsAsConstraints.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final List cheeseTypes = new ArrayList();
+        workingMemory.setGlobal( "cheeseTypes",
+                                 cheeseTypes );
+        cheeseTypes.add( "stilton" );
+        cheeseTypes.add( "muzzarela" );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( "memberOf",
+                      results.get( 0 ) );
+
+        final Cheese brie = new Cheese( "brie",
+                                        5 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+        assertEquals( "not memberOf",
+                      results.get( 1 ) );
+    }
+
+    public void testCustomGlobalResolver() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_globalCustomResolver.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Map map = new HashMap();
+        List list = new ArrayList();
+        String string = "stilton";
+
+        map.put( "list",
+                 list );
+        map.put( "string",
+                 string );
+
+        workingMemory.setGlobalResolver( new GlobalResolver() {
+            public Object resolveGlobal(String identifier) {
+                return map.get( identifier );
+            }
+
+            public void setGlobal(String identifier,
+                                  Object value) {
+                map.put( identifier,
+                         value );
+            }
+
+        } );
+
+        workingMemory.fireAllRules();
+
+        assertEquals(1, list.size() );
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+    }
+
+    public void testCustomGlobalResolverWithWorkingMemoryObject() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_globalCustomResolver.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Map map = new HashMap();
+        List list = new ArrayList();
+        String string = "stilton";
+
+        map.put( "list",
+                 list );
+        map.put( "string",
+                 string );
+
+        workingMemory.setGlobalResolver( new GlobalResolver() {
+            public Object resolveGlobal(String identifier) {
+                return map.get( identifier );
+            }
+
+            public void setGlobal(String identifier,
+                                  Object value) {
+                map.put( identifier,
+                         value );
+            }
+
+        } );
+
+        Cheese bree = new Cheese ();
+        bree.setPrice( 100 );
+
+        workingMemory.insert( bree );
+
+        workingMemory.fireAllRules();
+
+        assertEquals(2, list.size() );
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+
+        assertEquals( new Integer( 6 ),
+                      list.get( 1 ) );
+    }
+
+
+    public void testFieldBiningsAndEvalSharing() throws Exception {
+        final String drl = "test_FieldBindingsAndEvalSharing.drl";
+        evalSharingTest( drl );
+    }
+
+    public void testFieldBiningsAndPredicateSharing() throws Exception {
+        final String drl = "test_FieldBindingsAndPredicateSharing.drl";
+        evalSharingTest( drl );
+    }
+
+    private void evalSharingTest(final String drl) throws DroolsParserException,
+                                                  IOException,
+                                                  Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( drl ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        wm.setGlobal( "list",
+                      list );
+
+        final TestParam tp1 = new TestParam();
+        tp1.setValue2( "boo" );
+        wm.insert( tp1 );
+
+        wm.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testFactBindings() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FactBindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List events = new ArrayList();
+        final WorkingMemoryEventListener listener = new DefaultWorkingMemoryEventListener() {
+            public void objectUpdated(ObjectUpdatedEvent event) {
+                events.add( event );
+            }
+        };
+
+        workingMemory.addEventListener( listener );
+
+        final Person bigCheese = new Person( "big cheese" );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           15 );
+        bigCheese.setCheese( cheddar );
+
+        final FactHandle bigCheeseHandle = workingMemory.insert( bigCheese );
+        final FactHandle cheddarHandle = workingMemory.insert( cheddar );
+        workingMemory.fireAllRules();
+
+        ObjectUpdatedEvent event = (ObjectUpdatedEvent) events.get( 0 );
+        assertSame( cheddarHandle,
+                    event.getFactHandle() );
+        assertSame( cheddar,
+                    event.getOldObject() );
+        assertSame( cheddar,
+                    event.getObject() );
+
+        event = (ObjectUpdatedEvent) events.get( 1 );
+        assertSame( bigCheeseHandle,
+                    event.getFactHandle() );
+        assertSame( bigCheese,
+                    event.getOldObject() );
+        assertSame( bigCheese,
+                    event.getObject() );
+    }
+
+    public void testNullHandling() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NullHandling.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+        final Cheese nullCheese = new Cheese( null,
+                                              2 );
+        workingMemory.insert( nullCheese );
+
+        final Person notNullPerson = new Person( "shoes butt back" );
+        notNullPerson.setBigDecimal( new BigDecimal( "42.42" ) );
+
+        workingMemory.insert( notNullPerson );
+
+        final Person nullPerson = new Person( "whee" );
+        nullPerson.setBigDecimal( null );
+
+        workingMemory.insert( nullPerson );
+
+        workingMemory.fireAllRules();
+        System.out.println( list.get( 0 ) );
+        assertEquals( 3,
+                      list.size() );
+
+    }
+
+    public void NullFieldOnCompositeSink() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NullFieldOnCompositeSink.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        List list = new ArrayList();
+        workingMemory.setGlobal("list", list);
+
+        workingMemory.insert(new Attribute());
+        workingMemory.insert(new Message());
+        workingMemory.fireAllRules();
+
+        assertEquals(1, list.size());
+        assertEquals("X", list.get(0));
+
+    }
+
+    public void testEmptyPattern() throws Exception {
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EmptyPattern.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testExplicitAnd() throws Exception {
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_ExplicitAnd.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+        workingMemory.insert( new Message( "hola" ) );
+
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.insert( new Cheese( "brie",
+                                          33 ) );
+
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testHelloWorld() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "HelloWorld.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        // go !
+        final Message message = new Message( "hola" );
+        message.addToList( "hello" );
+        message.setNumber( 42 );
+
+        workingMemory.insert( message );
+        workingMemory.insert( "boo" );
+        workingMemory.fireAllRules();
+        assertTrue( message.isFired() );
+        assertEquals( message,
+                      list.get( 0 ) );
+
+    }
+
+    public void testMVELSoundex() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "MVEL_soundex.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        Cheese c = new Cheese( "fubar",
+                               2 );
+
+        workingMemory.insert( c );
+        workingMemory.fireAllRules();
+        assertEquals( 42,
+                      c.getPrice() );
+    }
+
+    public void testLiteral() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testLiteralWithBoolean() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_with_boolean.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface bill = new Person( "bill",
+                                                 null,
+                                                 12 );
+        bill.setAlive( true );
+        workingMemory.insert( bill );
+        workingMemory.fireAllRules();
+
+        assertEquals( bill,
+                      list.get( 0 ) );
+    }
+
+    public void testFactTemplate() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FactTemplate.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final FactTemplate cheese = pkg.getFactTemplate( "Cheese" );
+        final Fact stilton = cheese.createFact( 0 );
+        stilton.setFieldValue( "name",
+                               "stilton" );
+        stilton.setFieldValue( "price",
+                               new Integer( 100 ) );
+        workingMemory.insert( stilton );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+        assertEquals( stilton,
+                      list.get( 0 ) );
+        final Fact fact = (Fact) list.get( 0 );
+        assertSame( stilton,
+                    fact );
+        assertEquals( new Integer( 200 ),
+                      fact.getFieldValue( "price" ) );
+
+    }
+
+    public void testPropertyChangeSupport() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_PropertyChange.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final State state = new State( "initial" );
+        workingMemory.insert( state,
+                              true );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        state.setFlag( true );
+        assertEquals( 1,
+                      list.size() );
+
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      list.size() );
+
+        state.setState( "finished" );
+        workingMemory.fireAllRules();
+        assertEquals( 3,
+                      list.size() );
+
+    }
+
+    public void testBigDecimal() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "big_decimal_and_comparable.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface bill = new Person( "bill",
+                                                 null,
+                                                 12 );
+        bill.setBigDecimal( new BigDecimal( "42" ) );
+
+        final PersonInterface ben = new Person( "ben",
+                                                null,
+                                                13 );
+        ben.setBigDecimal( new BigDecimal( "43" ) );
+
+        workingMemory.insert( bill );
+        workingMemory.insert( ben );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testCell() throws Exception {
+        final Cell cell1 = new Cell( 9 );
+        final Cell cell = new Cell( 0 );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "evalmodify.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory memory = ruleBase.newStatefulSession();
+        memory.insert( cell1 );
+        memory.insert( cell );
+        memory.fireAllRules();
+        assertEquals( 9,
+                      cell.getValue() );
+    }
+
+    public void testNesting() throws Exception {
+        Person p = new Person();
+        p.setName( "Michael" );
+
+        Address add1 = new Address();
+        add1.setStreet( "High" );
+
+        Address add2 = new Address();
+        add2.setStreet( "Low" );
+
+        List l = new ArrayList();
+        l.add( add1 );
+        l.add( add2 );
+
+        p.setAddresses( l );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "nested_fields.drl" ) ) );
+
+        assertFalse( builder.getErrors().toString(),
+                     builder.hasErrors() );
+
+        DrlParser parser = new DrlParser();
+        PackageDescr desc = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "nested_fields.drl" ) ) );
+        List packageAttrs = desc.getAttributes();
+        assertEquals( 1,
+                      desc.getRules().size() );
+        assertEquals( 1,
+                      packageAttrs.size() );
+
+        RuleDescr rule = (RuleDescr) desc.getRules().get( 0 );
+        List ruleAttrs = rule.getAttributes();
+        assertEquals( 1,
+                      ruleAttrs.size() );
+
+        assertEquals( "mvel",
+                      ((AttributeDescr) ruleAttrs.get( 0 )).getValue() );
+        assertEquals( "dialect",
+                      ((AttributeDescr) ruleAttrs.get( 0 )).getName() );
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory memory = ruleBase.newStatefulSession();
+
+        memory.insert( p );
+        memory.fireAllRules();
+
+    }
+
+    public void testOr() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "or_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           5 );
+        final FactHandle h = workingMemory.insert( cheddar );
+
+        workingMemory.fireAllRules();
+
+        // just one added
+        assertEquals( "got cheese",
+                      list.get( 0 ) );
+        assertEquals( 1,
+                      list.size() );
+
+        workingMemory.retract( h );
+        workingMemory.fireAllRules();
+
+        // still just one
+        assertEquals( 1,
+                      list.size() );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          5 ) );
+        workingMemory.fireAllRules();
+
+        // now have one more
+        assertEquals( 2,
+                      list.size() );
+
+    }
+
+    public void testQuery() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "simple_query_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese stilton = new Cheese( "stinky",
+                                           5 );
+        workingMemory.insert( stilton );
+        final QueryResults results = workingMemory.getQueryResults( "simple query" );
+        assertEquals( 1,
+                      results.size() );
+    }
+
+    public void testEval() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "eval_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "five",
+                                 new Integer( 5 ) );
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+        workingMemory.fireAllRules();
+
+        assertEquals( stilton,
+                      list.get( 0 ) );
+    }
+
+    public void testJaninoEval() throws Exception {
+        final PackageBuilderConfiguration config = new PackageBuilderConfiguration();
+        JavaDialectConfiguration javaConf = (JavaDialectConfiguration) config.getDialectConfiguration( "java" );
+        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
+
+        final PackageBuilder builder = new PackageBuilder( config );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "eval_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "five",
+                                 new Integer( 5 ) );
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+        workingMemory.fireAllRules();
+
+        assertEquals( stilton,
+                      list.get( 0 ) );
+    }
+
+    public void testEvalMore() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "eval_rule_test_more.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Person foo = new Person( "foo" );
+        workingMemory.insert( foo );
+        workingMemory.fireAllRules();
+
+        assertEquals( foo,
+                      list.get( 0 ) );
+    }
+
+    public void testReturnValue() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "returnvalue_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "two",
+                                 new Integer( 2 ) );
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface peter = new Person( "peter",
+                                                  null,
+                                                  12 );
+        workingMemory.insert( peter );
+        final PersonInterface jane = new Person( "jane",
+                                                 null,
+                                                 10 );
+        workingMemory.insert( jane );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( jane,
+                      list.get( 0 ) );
+        assertEquals( peter,
+                      list.get( 1 ) );
+    }
+
+    public void testPredicate() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "predicate_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "two",
+                                 new Integer( 2 ) );
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface peter = new Person( "peter",
+                                                  null,
+                                                  12 );
+        workingMemory.insert( peter );
+        final PersonInterface jane = new Person( "jane",
+                                                 null,
+                                                 10 );
+        workingMemory.insert( jane );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( jane,
+                      list.get( 0 ) );
+        assertEquals( peter,
+                      list.get( 1 ) );
+    }
+
+    public void testNullBehaviour() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "null_behaviour.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final PersonInterface p1 = new Person( "michael",
+                                               "food",
+                                               40 );
+        final PersonInterface p2 = new Person( null,
+                                               "drink",
+                                               30 );
+        workingMemory.insert( p1 );
+        workingMemory.insert( p2 );
+
+        workingMemory.fireAllRules();
+
+    }
+
+    public void testNullConstraint() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "null_constraint.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List foo = new ArrayList();
+        workingMemory.setGlobal( "messages",
+                                 foo );
+
+        final PersonInterface p1 = new Person( null,
+                                               "food",
+                                               40 );
+        final Primitives p2 = new Primitives();
+        p2.setArrayAttribute( null );
+
+        workingMemory.insert( p1 );
+        workingMemory.insert( p2 );
+
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      foo.size() );
+
+    }
+
+    public void testImportFunctions() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ImportFunctions.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final Cheese cheese = new Cheese( "stilton",
+                                          15 );
+        workingMemory.insert( cheese );
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+        workingMemory.fireAllRules();
+
+        assertEquals( 4,
+                      list.size() );
+
+        assertEquals( "rule1",
+                      list.get( 0 ) );
+        assertEquals( "rule2",
+                      list.get( 1 ) );
+        assertEquals( "rule3",
+                      list.get( 2 ) );
+        assertEquals( "rule4",
+                      list.get( 3 ) );
+    }
+
+    public void testBasicFrom() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_From.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list1 = new ArrayList();
+        workingMemory.setGlobal( "list1",
+                                 list1 );
+        final List list2 = new ArrayList();
+        workingMemory.setGlobal( "list2",
+                                 list2 );
+        final List list3 = new ArrayList();
+        workingMemory.setGlobal( "list3",
+                                 list3 );
+
+        final Cheesery cheesery = new Cheesery();
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           15 );
+        cheesery.addCheese( stilton );
+        cheesery.addCheese( cheddar );
+        workingMemory.setGlobal( "cheesery",
+                                 cheesery );
+        workingMemory.insert( cheesery );
+
+        Person p = new Person( "stilton" );
+        workingMemory.insert( p );
+
+        workingMemory.fireAllRules();
+
+        // from using a global
+        assertEquals( 2,
+                      list1.size() );
+        assertEquals( cheddar,
+                      list1.get( 0 ) );
+        assertEquals( stilton,
+                      list1.get( 1 ) );
+
+        // from using a declaration
+        assertEquals( 2,
+                      list2.size() );
+        assertEquals( cheddar,
+                      list2.get( 0 ) );
+        assertEquals( stilton,
+                      list2.get( 1 ) );
+
+        // from using a declaration
+        assertEquals( 1,
+                      list3.size() );
+        assertEquals( stilton,
+                      list3.get( 0 ) );
+    }
+
+    public void testFromWithParams() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FromWithParams.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List list = new ArrayList();
+        final Object globalObject = new Object();
+        workingMemory.setGlobal( "list",
+                                 list );
+        workingMemory.setGlobal( "testObject",
+                                 new FromTestClass() );
+        workingMemory.setGlobal( "globalObject",
+                                 globalObject );
+
+        final Person bob = new Person( "bob" );
+        workingMemory.insert( bob );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 6,
+                      list.size() );
+
+        final List array = (List) list.get( 0 );
+        assertEquals( 3,
+                      array.size() );
+        final Person p = (Person) array.get( 0 );
+        assertSame( p,
+                    bob );
+
+        assertEquals( new Integer( 42 ),
+                      array.get( 1 ) );
+
+        final List nested = (List) array.get( 2 );
+        assertEquals( "x",
+                      nested.get( 0 ) );
+        assertEquals( "y",
+                      nested.get( 1 ) );
+
+        final Map map = (Map) list.get( 1 );
+        assertEquals( 2,
+                      map.keySet().size() );
+
+        assertTrue( map.keySet().contains( bob ) );
+        assertSame( globalObject,
+                    map.get( bob ) );
+
+        assertTrue( map.keySet().contains( "key1" ) );
+        final Map nestedMap = (Map) map.get( "key1" );
+        assertEquals( 1,
+                      nestedMap.keySet().size() );
+        assertTrue( nestedMap.keySet().contains( "key2" ) );
+        assertEquals( "value2",
+                      nestedMap.get( "key2" ) );
+
+        assertEquals( new Integer( 42 ),
+                      list.get( 2 ) );
+        assertEquals( "literal",
+                      list.get( 3 ) );
+        assertSame( bob,
+                    list.get( 4 ) );
+        assertSame( globalObject,
+                    list.get( 5 ) );
+    }
+
+    public void testFromWithNewConstructor() throws Exception {
+        DrlParser parser = new DrlParser();
+        PackageDescr descr = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "test_FromWithNewConstructor.drl" ) ) );
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( descr );
+        Package pkg = builder.getPackage();
+        pkg.checkValidity();
+    }
+
+    public void testWithInvalidRule() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "invalid_rule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+        // Mark: please check if the conseqeuence/should/shouldn't be built
+        // Rule badBoy = pkg.getRules()[0];
+        // assertFalse(badBoy.isValid());
+
+        RuntimeException runtime = null;
+        // this should ralph all over the place.
+        final RuleBase ruleBase = getRuleBase();
+        try {
+            ruleBase.addPackage( pkg );
+            fail( "Should have thrown an exception as the rule is NOT VALID." );
+        } catch ( final RuntimeException e ) {
+            assertNotNull( e.getMessage() );
+            runtime = e;
+        }
+        assertTrue( builder.getErrors().getErrors().length > 0 );
+
+        final String pretty = builder.getErrors().toString();
+        assertFalse( pretty.equals( "" ) );
+        assertEquals( pretty,
+                      runtime.getMessage() );
+
+    }
+
+    public void testErrorLineNumbers() throws Exception {
+        // this test aims to test semantic errors
+        // parser errors are another test case
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "errors_in_rule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final DroolsError err = builder.getErrors().getErrors()[0];
+        final DescrBuildError ruleErr = (DescrBuildError) err;
+        assertNotNull( ruleErr.getDescr() );
+        assertTrue( ruleErr.getLine() != -1 );
+
+        final DroolsError errs[] = builder.getErrors().getErrors();
+
+        assertEquals( 3,
+                      builder.getErrors().getErrors().length );
+
+        // check that its getting it from the ruleDescr
+        assertEquals( ruleErr.getLine(),
+                      ruleErr.getDescr().getLine() );
+        // check the absolute error line number (there are more).
+        assertEquals( 11,
+                      ruleErr.getLine() );
+
+        // now check the RHS, not being too specific yet, as long as it has the
+        // rules line number, not zero
+        final DescrBuildError rhs = (DescrBuildError) builder.getErrors().getErrors()[2];
+        assertTrue( rhs.getLine() > 7 ); // not being too specific - may need to
+        // change this when we rework the error
+        // reporting
+
+    }
+
+    public void testErrorsParser() throws Exception {
+        final DrlParser parser = new DrlParser();
+        assertEquals( 0,
+                      parser.getErrors().size() );
+        parser.parse( new InputStreamReader( getClass().getResourceAsStream( "errors_parser_multiple.drl" ) ) );
+        assertTrue( parser.hasErrors() );
+        assertTrue( parser.getErrors().size() > 0 );
+        assertTrue( parser.getErrors().get( 0 ) instanceof ParserError );
+        final ParserError first = ((ParserError) parser.getErrors().get( 0 ));
+        assertTrue( first.getMessage() != null );
+        assertFalse( first.getMessage().equals( "" ) );
+    }
+
+    public void testFunction() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionInConsequence.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+    }
+
+    public void testAssertRetract() throws Exception {
+        // postponed while I sort out KnowledgeHelperFixer
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "assert_retract.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final PersonInterface person = new Person( "michael",
+                                                   "cheese" );
+        person.setStatus( "start" );
+        workingMemory.insert( person );
+        workingMemory.fireAllRules();
+
+        assertEquals( 5,
+                      list.size() );
+        assertTrue( list.contains( "first" ) );
+        assertTrue( list.contains( "second" ) );
+        assertTrue( list.contains( "third" ) );
+        assertTrue( list.contains( "fourth" ) );
+        assertTrue( list.contains( "fifth" ) );
+
+    }
+
+    public void testPredicateAsFirstPattern() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "predicate_as_first_pattern.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese mussarela = new Cheese( "Mussarela",
+                                             35 );
+        workingMemory.insert( mussarela );
+        final Cheese provolone = new Cheese( "Provolone",
+                                             20 );
+        workingMemory.insert( provolone );
+
+        workingMemory.fireAllRules();
+
+        Assert.assertEquals( "The rule is being incorrectly fired",
+                             35,
+                             mussarela.getPrice() );
+        Assert.assertEquals( "Rule is incorrectly being fired",
+                             20,
+                             provolone.getPrice() );
+    }
+
+    public void testConsequenceException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConsequenceException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        try {
+            workingMemory.fireAllRules();
+            fail( "Should throw an Exception from the Consequence" );
+        } catch ( final Exception e ) {
+            assertEquals( "this should throw an exception",
+                          e.getCause().getMessage() );
+        }
+    }
+
+    public void testCustomConsequenceException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConsequenceException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        CustomConsequenceExceptionHandler handler = new CustomConsequenceExceptionHandler();
+        conf.setConsequenceExceptionHandler( handler );
+
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertTrue( handler.isCalled() );
+    }
+
+    public static class CustomConsequenceExceptionHandler
+        implements
+        ConsequenceExceptionHandler {
+
+        private boolean called;
+
+        public void handleException(Activation activation,
+                                    WorkingMemory workingMemory,
+                                    Exception exception) {
+            this.called = true;
+        }
+
+        public boolean isCalled() {
+            return this.called;
+        }
+
+    }
+
+    public void testFunctionException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        try {
+            workingMemory.fireAllRules();
+            fail( "Should throw an Exception from the Function" );
+        } catch ( final Exception e ) {
+            assertEquals( "this should throw an exception",
+                          e.getCause().getMessage() );
+        }
+    }
+
+    public void testEvalException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EvalException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+
+        try {
+            workingMemory.insert( brie );
+            workingMemory.fireAllRules();
+            fail( "Should throw an Exception from the Eval" );
+        } catch ( final Exception e ) {
+            assertEquals( "this should throw an exception",
+                          e.getCause().getMessage() );
+        }
+    }
+
+    public void testPredicateException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_PredicateException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+
+        try {
+            workingMemory.insert( brie );
+            workingMemory.fireAllRules();
+            fail( "Should throw an Exception from the Predicate" );
+        } catch ( final Exception e ) {
+            assertEquals( "this should throw an exception",
+                          e.getCause().getMessage() );
+        }
+    }
+
+    public void testReturnValueException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ReturnValueException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+
+        try {
+            workingMemory.insert( brie );
+            workingMemory.fireAllRules();
+            fail( "Should throw an Exception from the ReturnValue" );
+        } catch ( final Exception e ) {
+            assertTrue( e.getCause().getMessage().endsWith( "this should throw an exception" ) );
+        }
+    }
+
+    public void testMultiRestrictionFieldConstraint() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_MultiRestrictionFieldConstraint.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list1 = new ArrayList();
+        workingMemory.setGlobal( "list1",
+                                 list1 );
+        final List list2 = new ArrayList();
+        workingMemory.setGlobal( "list2",
+                                 list2 );
+        final List list3 = new ArrayList();
+        workingMemory.setGlobal( "list3",
+                                 list3 );
+        final List list4 = new ArrayList();
+        workingMemory.setGlobal( "list4",
+                                 list4 );
+
+        final Person youngChili1 = new Person( "young chili1" );
+        youngChili1.setAge( 12 );
+        youngChili1.setHair( "blue" );
+        final Person youngChili2 = new Person( "young chili2" );
+        youngChili2.setAge( 25 );
+        youngChili2.setHair( "purple" );
+
+        final Person chili1 = new Person( "chili1" );
+        chili1.setAge( 35 );
+        chili1.setHair( "red" );
+
+        final Person chili2 = new Person( "chili2" );
+        chili2.setAge( 38 );
+        chili2.setHair( "indigigo" );
+
+        final Person oldChili1 = new Person( "old chili2" );
+        oldChili1.setAge( 45 );
+        oldChili1.setHair( "green" );
+
+        final Person oldChili2 = new Person( "old chili2" );
+        oldChili2.setAge( 48 );
+        oldChili2.setHair( "blue" );
+
+        workingMemory.insert( youngChili1 );
+        workingMemory.insert( youngChili2 );
+        workingMemory.insert( chili1 );
+        workingMemory.insert( chili2 );
+        workingMemory.insert( oldChili1 );
+        workingMemory.insert( oldChili2 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list1.size() );
+        assertTrue( list1.contains( chili1 ) );
+
+        assertEquals( 2,
+                      list2.size() );
+        assertTrue( list2.contains( chili1 ) );
+        assertTrue( list2.contains( chili2 ) );
+
+        assertEquals( 2,
+                      list3.size() );
+        assertTrue( list3.contains( youngChili1 ) );
+        assertTrue( list3.contains( youngChili2 ) );
+
+        assertEquals( 2,
+                      list4.size() );
+        assertTrue( list4.contains( youngChili1 ) );
+        assertTrue( list4.contains( chili1 ) );
+    }
+
+    public void testDumpers() throws Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "test_Dumpers.drl" ) ) );
+
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( pkg );
+
+        RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( "3 1",
+                      list.get( 0 ) );
+        assertEquals( "MAIN",
+                      list.get( 1 ) );
+        assertEquals( "1 1",
+                      list.get( 2 ) );
+
+        final DrlDumper drlDumper = new DrlDumper();
+        final String drlResult = drlDumper.dump( pkg );
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( new StringReader( drlResult ) );
+
+        ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        workingMemory = ruleBase.newStatefulSession();
+
+        list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( "3 1",
+                      list.get( 0 ) );
+        assertEquals( "MAIN",
+                      list.get( 1 ) );
+        assertEquals( "1 1",
+                      list.get( 2 ) );
+
+        final XmlDumper xmlDumper = new XmlDumper();
+        final String xmlResult = xmlDumper.dump( pkg );
+
+        // System.out.println( xmlResult );
+
+        builder = new PackageBuilder();
+        builder.addPackageFromXml( new StringReader( xmlResult ) );
+
+        ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        workingMemory = ruleBase.newStatefulSession();
+
+        list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( "3 1",
+                      list.get( 0 ) );
+        assertEquals( "MAIN",
+                      list.get( 1 ) );
+        assertEquals( "1 1",
+                      list.get( 2 ) );
+    }
+
+    public void testContainsCheese() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ContainsCheese.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        workingMemory.insert( stilton );
+        final Cheese brie = new Cheese( "brie",
+                                        10 );
+        workingMemory.insert( brie );
+
+        final Cheesery cheesery = new Cheesery();
+        cheesery.getCheeses().add( stilton );
+        workingMemory.insert( cheesery );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( stilton,
+                      list.get( 0 ) );
+        assertEquals( brie,
+                      list.get( 1 ) );
+    }
+
+    public void testStaticFieldReference() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_StaticField.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheesery cheesery1 = new Cheesery();
+        cheesery1.setStatus( Cheesery.SELLING_CHEESE );
+        cheesery1.setMaturity( Maturity.OLD );
+        workingMemory.insert( cheesery1 );
+
+        final Cheesery cheesery2 = new Cheesery();
+        cheesery2.setStatus( Cheesery.MAKING_CHEESE );
+        cheesery2.setMaturity( Maturity.YOUNG );
+        workingMemory.insert( cheesery2 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( cheesery1,
+                      list.get( 0 ) );
+        assertEquals( cheesery2,
+                      list.get( 1 ) );
+    }
+
+    public void testDuplicateRuleNames() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DuplicateRuleName1.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DuplicateRuleName2.drl" ) ) );
+        ruleBase.addPackage( builder.getPackage() );
+
+        // @todo: this is from JBRULES-394 - maybe we should test more stuff
+        // here?
+
+    }
+
+    public void testNullValuesIndexing() throws Exception {
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_NullValuesIndexing.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg1 = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg1 );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        // Adding person with null name and likes attributes
+        final PersonInterface bob = new Person( null,
+                                                null );
+        bob.setStatus( "P1" );
+        final PersonInterface pete = new Person( null,
+                                                 null );
+        bob.setStatus( "P2" );
+        workingMemory.insert( bob );
+        workingMemory.insert( pete );
+
+        workingMemory.fireAllRules();
+
+        Assert.assertEquals( "Indexing with null values is not working correctly.",
+                             "OK",
+                             bob.getStatus() );
+        Assert.assertEquals( "Indexing with null values is not working correctly.",
+                             "OK",
+                             pete.getStatus() );
+
+    }
+
+    public void testSerializable() throws Exception {
+
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg = builder.getPackage();
+
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        RuleBase ruleBase = getRuleBase();// RuleBaseFactory.newRuleBase();
+
+        ruleBase.addPackage( pkg );
+
+        Map map = new HashMap();
+        map.put( "x",
+                 ruleBase );
+        final byte[] ast = serializeOut( map );
+        map = (Map) serializeIn( ast );
+        ruleBase = (RuleBase) map.get( "x" );
+        final Rule[] rules = ruleBase.getPackages()[0].getRules();
+        assertEquals( 4,
+                      rules.length );
+
+        assertEquals( "match Person 1",
+                      rules[0].getName() );
+        assertEquals( "match Person 2",
+                      rules[1].getName() );
+        assertEquals( "match Person 3",
+                      rules[2].getName() );
+        assertEquals( "match Integer",
+                      rules[3].getName() );
+
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "list",
+                                 new ArrayList() );
+
+        final Person bob = new Person( "bob" );
+        workingMemory.insert( bob );
+
+        final byte[] wm = serializeOut( workingMemory );
+
+        workingMemory = ruleBase.newStatefulSession( new ByteArrayInputStream( wm ) );
+
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertEquals( bob,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).get( 0 ) );
+
+        assertEquals( 2,
+                      workingMemory.getAgenda().agendaSize() );
+
+        workingMemory.fireAllRules();
+
+        final List list = (List) workingMemory.getGlobal( "list" );
+
+        assertEquals( 3,
+                      list.size() );
+        // because of agenda-groups
+        assertEquals( new Integer( 4 ),
+                      list.get( 0 ) );
+
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( bob ) );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( new Person( "help" ) ) );
+    }
+    
+    public void testSerializeWorkingMemoryAndRuleBase1() throws Exception {
+        // has the first newStatefulSession before the ruleBase is serialised
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg = builder.getPackage();
+
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        RuleBase ruleBase = getRuleBase();// RuleBaseFactory.newRuleBase();
+
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();        
+        
+        Map map = new HashMap();
+        map.put( "x", ruleBase );
+        final byte[] ast = serializeOut( map );
+        map = (Map) serializeIn( ast );
+        ruleBase = (RuleBase) map.get( "x" );
+
+
+
+        
+        final byte[] wm = serializeOut( workingMemory );
+
+        workingMemory = ruleBase.newStatefulSession( new ByteArrayInputStream( wm ) );
+
+        ruleBase.addPackage( pkg );
+
+        workingMemory.setGlobal( "list", 
+                new ArrayList() );
+        
+
+        final Person bob = new Person( "bob" );
+        workingMemory.insert( bob );
+
+
+        
+        final Rule[] rules = ruleBase.getPackages()[0].getRules();
+
+                
+        assertEquals( 4,
+                      rules.length );
+
+        assertEquals( "match Person 1",
+                      rules[0].getName() );
+        assertEquals( "match Person 2",
+                      rules[1].getName() );
+        assertEquals( "match Person 3",
+                      rules[2].getName() );
+        assertEquals( "match Integer",
+                      rules[3].getName() );
+
+        
+
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertEquals( bob,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).get( 0 ) );
+
+        assertEquals( 2,
+                      workingMemory.getAgenda().agendaSize() );
+
+        workingMemory.fireAllRules();
+
+        final List list = (List) workingMemory.getGlobal( "list" );
+
+        assertEquals( 3,
+                      list.size() );
+        // because of agenda-groups
+        assertEquals( new Integer( 4 ),
+                      list.get( 0 ) );
+
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( bob ) );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( new Person( "help" ) ) );
+
+    }    
+
+    public void testSerializeWorkingMemoryAndRuleBase2() throws Exception {
+        // has the first newStatefulSession after the ruleBase is serialised
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg = builder.getPackage();
+
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        RuleBase ruleBase = getRuleBase();// RuleBaseFactory.newRuleBase();   
+        
+        // serialise a hashmap with the RuleBase as a key
+        Map map = new HashMap();
+        map.put( "x", ruleBase );
+        final byte[] ast = serializeOut( map );
+        map = (Map) serializeIn( ast );
+        ruleBase = (RuleBase) map.get( "x" );
+
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();    
+        
+        // serialise the working memory before population
+        final byte[] wm = serializeOut( workingMemory );        
+        workingMemory = ruleBase.newStatefulSession( new ByteArrayInputStream( wm ) );
+
+        ruleBase.addPackage( pkg );
+
+        workingMemory.setGlobal( "list", 
+        					     new ArrayList() );
+        
+        final Person bob = new Person( "bob" );
+        workingMemory.insert( bob );
+        
+        final Rule[] rules = ruleBase.getPackages()[0].getRules();
+                
+        assertEquals( 4,
+                      rules.length );
+
+        assertEquals( "match Person 1",
+                      rules[0].getName() );
+        assertEquals( "match Person 2",
+                      rules[1].getName() );
+        assertEquals( "match Person 3",
+                      rules[2].getName() );
+        assertEquals( "match Integer",
+                      rules[3].getName() );        
+
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertEquals( bob,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).get( 0 ) );
+
+        assertEquals( 2,
+                      workingMemory.getAgenda().agendaSize() );
+
+        workingMemory.fireAllRules();
+
+        final List list = (List) workingMemory.getGlobal( "list" );
+
+        assertEquals( 3,
+                      list.size() );
+        // because of agenda-groups
+        assertEquals( new Integer( 4 ),
+                      list.get( 0 ) );
+
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( bob ) );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( new Person( "help" ) ) );
+    }    
+    
+    
+    public void FIXME_testSerializeWorkingMemoryAndRuleBase3() throws Exception {
+        // has the first newStatefulSession after the ruleBase is serialised
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg = builder.getPackage();
+
+        assertEquals( 0,
+                      builder.getErrors().getErrors().length );
+
+        RuleBase ruleBase = getRuleBase();        
+        WorkingMemory workingMemory = ruleBase.newStatefulSession();            
+
+        ruleBase.addPackage( pkg );
+
+        workingMemory.setGlobal( "list", 
+        						 new ArrayList() );
+        
+
+        final Person bob = new Person( "bob" );
+        workingMemory.insert( bob );        
+        
+        // serialise a hashmap with the RuleBase as a key, after WM population
+        Map map = new HashMap();
+        map.put( "x", ruleBase );
+        final byte[] ast = serializeOut( map );
+        map = (Map) serializeIn( ast );
+        ruleBase = (RuleBase) map.get( "x" );        
+        
+        // now try serialising with a fully populated wm from a serialised rulebase
+        final byte[] wm = serializeOut( workingMemory );
+        workingMemory = ruleBase.newStatefulSession( new ByteArrayInputStream( wm ) );         
+        
+        final Rule[] rules = ruleBase.getPackages()[0].getRules();
+                
+        assertEquals( 4,
+                      rules.length );
+
+        assertEquals( "match Person 1",
+                      rules[0].getName() );
+        assertEquals( "match Person 2",
+                      rules[1].getName() );
+        assertEquals( "match Person 3",
+                      rules[2].getName() );
+        assertEquals( "match Integer",
+                      rules[3].getName() );        
+
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertEquals( bob,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).get( 0 ) );
+
+        assertEquals( 2,
+                      workingMemory.getAgenda().agendaSize() );
+
+        workingMemory.fireAllRules();
+
+        final List list = (List) workingMemory.getGlobal( "list" );
+
+        assertEquals( 3,
+                      list.size() );
+        // because of agenda-groups
+        assertEquals( new Integer( 4 ),
+                      list.get( 0 ) );
+
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( bob ) );
+        assertTrue( IteratorToList.convert( workingMemory.iterateObjects() ).contains( new Person( "help" ) ) );              
+    }    
+    
+    
+    
+    public void testEmptyRule() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EmptyRule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        assertTrue( list.contains( "fired1" ) );
+        assertTrue( list.contains( "fired2" ) );
+    }
+
+    public void testjustEval() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NoPatterns.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        assertTrue( list.contains( "fired1" ) );
+        assertTrue( list.contains( "fired3" ) );
+    }
+
+    public void testOrWithBinding() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OrWithBindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Person hola = new Person( "hola" );
+        workingMemory.insert( hola );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+        workingMemory.insert( new State( "x" ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+        assertTrue( list.contains( hola ) );
+
+    }
+
+    protected Object serializeIn(final byte[] bytes) throws IOException,
+                                                    ClassNotFoundException {
+        final ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
+        final Object obj = in.readObject();
+        in.close();
+        return obj;
+    }
+
+    protected byte[] serializeOut(final Object obj) throws IOException {
+        // Serialize to a byte array
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final ObjectOutput out = new ObjectOutputStream( bos );
+        out.writeObject( obj );
+        out.close();
+
+        // Get the bytes of the serialized object
+        final byte[] bytes = bos.toByteArray();
+        return bytes;
+    }
+
+    public void testJoinNodeModifyObject() throws Exception {
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_JoinNodeModifyObject.drl" ) );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg1 = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg1 );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List orderedFacts = new ArrayList();
+        final List errors = new ArrayList();
+
+        workingMemory.setGlobal( "orderedNumbers",
+                                 orderedFacts );
+        workingMemory.setGlobal( "errors",
+                                 errors );
+
+        final int MAX = 5;
+        for ( int i = 1; i <= MAX; i++ ) {
+            final IndexedNumber n = new IndexedNumber( i,
+                                                       MAX - i + 1 );
+            workingMemory.insert( n );
+        }
+        workingMemory.fireAllRules();
+
+        Assert.assertTrue( "Processing generated errors: " + errors.toString(),
+                           errors.isEmpty() );
+
+        for ( int i = 1; i <= MAX; i++ ) {
+            final IndexedNumber n = (IndexedNumber) orderedFacts.get( i - 1 );
+            Assert.assertEquals( "Fact is out of order",
+                                 i,
+                                 n.getIndex() );
+        }
+    }
+
+    public void testQuery2() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Query.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        workingMemory.fireAllRules();
+
+        final QueryResults results = workingMemory.getQueryResults( "assertedobjquery" );
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( new InsertedObject( "value1" ),
+                      results.get( 0 ).get( 0 ) );
+    }
+
+    public void testQueryWithParams() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_QueryWithParams.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        workingMemory.fireAllRules();
+
+        QueryResults results = workingMemory.getQueryResults( "assertedobjquery",
+                                                              new String[]{"value1"} );
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( new InsertedObject( "value1" ),
+                      results.get( 0 ).get( 0 ) );
+
+        results = workingMemory.getQueryResults( "assertedobjquery",
+                                                 new String[]{"value3"} );
+        assertEquals( 0,
+                      results.size() );
+
+        results = workingMemory.getQueryResults( "assertedobjquery2",
+                                                 new String[]{null, "value2"} );
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( new InsertedObject( "value2" ),
+                      results.get( 0 ).get( 0 ) );
+
+        results = workingMemory.getQueryResults( "assertedobjquery2",
+                                                 new String[]{"value3", "value2"} );
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( new InsertedObject( "value2" ),
+                      results.get( 0 ).get( 0 ) );
+    }
+
+    public void testTwoQuerries() throws Exception {
+        // @see JBRULES-410 More than one Query definition causes an incorrect
+        // Rete network to be built.
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_TwoQuerries.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese stilton = new Cheese( "stinky",
+                                           5 );
+        workingMemory.insert( stilton );
+        final Person per1 = new Person( "stinker",
+                                        "smelly feet",
+                                        70 );
+        final Person per2 = new Person( "skunky",
+                                        "smelly armpits",
+                                        40 );
+
+        workingMemory.insert( per1 );
+        workingMemory.insert( per2 );
+
+        QueryResults results = workingMemory.getQueryResults( "find stinky cheeses" );
+        assertEquals( 1,
+                      results.size() );
+
+        results = workingMemory.getQueryResults( "find pensioners" );
+        assertEquals( 1,
+                      results.size() );
+    }
+
+    public void testInsurancePricingExample() throws Exception {
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "insurance_pricing_example.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        // now create some test data
+        final Driver driver = new Driver();
+        final Policy policy = new Policy();
+
+        wm.insert( driver );
+        wm.insert( policy );
+
+        wm.fireAllRules();
+
+        assertEquals( 120,
+                      policy.getBasePrice() );
+    }
+
+    public void testLLR() throws Exception {
+
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_JoinNodeModifyTuple.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        // 1st time
+        org.drools.Target tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Anna" );
+        tgt.setLat( new Float( 60.26544f ) );
+        tgt.setLon( new Float( 28.952137f ) );
+        tgt.setCourse( new Float( 145.0f ) );
+        tgt.setSpeed( new Float( 12.0f ) );
+        tgt.setTime( new Float( 1.8666667f ) );
+        wm.insert( tgt );
+
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Maria" );
+        tgt.setLat( new Float( 60.236874f ) );
+        tgt.setLon( new Float( 28.992579f ) );
+        tgt.setCourse( new Float( 325.0f ) );
+        tgt.setSpeed( new Float( 8.0f ) );
+        tgt.setTime( new Float( 1.8666667f ) );
+        wm.insert( tgt );
+
+        wm.fireAllRules();
+
+        // 2nd time
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Anna" );
+        tgt.setLat( new Float( 60.265343f ) );
+        tgt.setLon( new Float( 28.952267f ) );
+        tgt.setCourse( new Float( 145.0f ) );
+        tgt.setSpeed( new Float( 12.0f ) );
+        tgt.setTime( new Float( 1.9f ) );
+        wm.insert( tgt );
+
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Maria" );
+        tgt.setLat( new Float( 60.236935f ) );
+        tgt.setLon( new Float( 28.992493f ) );
+        tgt.setCourse( new Float( 325.0f ) );
+        tgt.setSpeed( new Float( 8.0f ) );
+        tgt.setTime( new Float( 1.9f ) );
+        wm.insert( tgt );
+
+        wm.fireAllRules();
+
+        // 3d time
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Anna" );
+        tgt.setLat( new Float( 60.26525f ) );
+        tgt.setLon( new Float( 28.952396f ) );
+        tgt.setCourse( new Float( 145.0f ) );
+        tgt.setSpeed( new Float( 12.0f ) );
+        tgt.setTime( new Float( 1.9333333f ) );
+        wm.insert( tgt );
+
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Maria" );
+        tgt.setLat( new Float( 60.236996f ) );
+        tgt.setLon( new Float( 28.992405f ) );
+        tgt.setCourse( new Float( 325.0f ) );
+        tgt.setSpeed( new Float( 8.0f ) );
+        tgt.setTime( new Float( 1.9333333f ) );
+        wm.insert( tgt );
+
+        wm.fireAllRules();
+
+        // 4th time
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Anna" );
+        tgt.setLat( new Float( 60.265163f ) );
+        tgt.setLon( new Float( 28.952526f ) );
+        tgt.setCourse( new Float( 145.0f ) );
+        tgt.setSpeed( new Float( 12.0f ) );
+        tgt.setTime( new Float( 1.9666667f ) );
+        wm.insert( tgt );
+
+        tgt = new org.drools.Target();
+        tgt.setLabel( "Santa-Maria" );
+        tgt.setLat( new Float( 60.237057f ) );
+        tgt.setLon( new Float( 28.99232f ) );
+        tgt.setCourse( new Float( 325.0f ) );
+        tgt.setSpeed( new Float( 8.0f ) );
+        tgt.setTime( new Float( 1.9666667f ) );
+        wm.insert( tgt );
+
+        wm.fireAllRules();
+    }
+
+    public void testDoubleQueryWithExists() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DoubleQueryWithExists.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Person p1 = new Person( "p1",
+                                      "stilton",
+                                      20 );
+        p1.setStatus( "europe" );
+        final FactHandle c1FactHandle = workingMemory.insert( p1 );
+        final Person p2 = new Person( "p2",
+                                      "stilton",
+                                      30 );
+        p2.setStatus( "europe" );
+        final FactHandle c2FactHandle = workingMemory.insert( p2 );
+        final Person p3 = new Person( "p3",
+                                      "stilton",
+                                      40 );
+        p3.setStatus( "europe" );
+        final FactHandle c3FactHandle = workingMemory.insert( p3 );
+        workingMemory.fireAllRules();
+
+        QueryResults queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 2,
+                      queryResults.size() );
+
+        // europe=[ 1, 2 ], america=[ 3 ]
+        p3.setStatus( "america" );
+        workingMemory.update( c3FactHandle,
+                              p3 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 1,
+                      queryResults.size() );
+
+        // europe=[ 1 ], america=[ 2, 3 ]
+        p2.setStatus( "america" );
+        workingMemory.update( c2FactHandle,
+                              p2 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 1,
+                      queryResults.size() );
+
+        // europe=[ ], america=[ 1, 2, 3 ]
+        p1.setStatus( "america" );
+        workingMemory.update( c1FactHandle,
+                              p1 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 2,
+                      queryResults.size() );
+
+        // europe=[ 2 ], america=[ 1, 3 ]
+        p2.setStatus( "europe" );
+        workingMemory.update( c2FactHandle,
+                              p2 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 1,
+                      queryResults.size() );
+
+        // europe=[ 1, 2 ], america=[ 3 ]
+        p1.setStatus( "europe" );
+        workingMemory.update( c1FactHandle,
+                              p1 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 1,
+                      queryResults.size() );
+
+        // europe=[ 1, 2, 3 ], america=[ ]
+        p3.setStatus( "europe" );
+        workingMemory.update( c3FactHandle,
+                              p3 );
+        workingMemory.fireAllRules();
+        queryResults = workingMemory.getQueryResults( "2 persons with the same status" );
+        assertEquals( 2,
+                      queryResults.size() );
+    }
+
+    public void testFunctionWithPrimitives() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionWithPrimitives.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( new Integer( 10 ),
+                      list.get( 0 ) );
+    }
+
+    public void testReturnValueAndGlobal() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ReturnValueAndGlobal.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List matchlist = new ArrayList();
+        workingMemory.setGlobal( "matchingList",
+                                 matchlist );
+
+        final List nonmatchlist = new ArrayList();
+        workingMemory.setGlobal( "nonMatchingList",
+                                 nonmatchlist );
+
+        workingMemory.setGlobal( "cheeseType",
+                                 "stilton" );
+
+        final Cheese stilton1 = new Cheese( "stilton",
+                                            5 );
+        final Cheese stilton2 = new Cheese( "stilton",
+                                            7 );
+        final Cheese brie = new Cheese( "brie",
+                                        4 );
+        workingMemory.insert( stilton1 );
+        workingMemory.insert( stilton2 );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      matchlist.size() );
+        assertEquals( 1,
+                      nonmatchlist.size() );
+    }
+
+    public void testDeclaringAndUsingBindsInSamePattern() throws Exception {
+        final RuleBaseConfiguration config = new RuleBaseConfiguration();
+        config.setRemoveIdentities( true );
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DeclaringAndUsingBindsInSamePattern.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase( config );
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List sensors = new ArrayList();
+
+        workingMemory.setGlobal( "sensors",
+                                 sensors );
+
+        final Sensor sensor1 = new Sensor( 100,
+                                           150 );
+        workingMemory.insert( sensor1 );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      sensors.size() );
+
+        final Sensor sensor2 = new Sensor( 200,
+                                           150 );
+        workingMemory.insert( sensor2 );
+        workingMemory.fireAllRules();
+        assertEquals( 3,
+                      sensors.size() );
+    }
+
+    public void testMissingImports() {
+        try {
+            final PackageBuilder builder = new PackageBuilder();
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_missing_import.drl" ) ) );
+            final Package pkg = builder.getPackage();
+
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg );
+
+            Assert.fail( "Should have thrown an InvalidRulePackage" );
+        } catch ( final InvalidRulePackage e ) {
+            // everything fine
+        } catch ( final Exception e ) {
+            e.printStackTrace();
+            Assert.fail( "Should have thrown an InvalidRulePackage Exception instead of " + e.getMessage() );
+        }
+    }
+
+    public void testNestedConditionalElements() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NestedConditionalElements.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final State state = new State( "SP" );
+        workingMemory.insert( state );
+
+        final Person bob = new Person( "Bob" );
+        bob.setStatus( state.getState() );
+        bob.setLikes( "stilton" );
+        workingMemory.insert( bob );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        workingMemory.insert( new Cheese( bob.getLikes(),
+                                          10 ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+    }
+
+    public void testDeclarationUsage() throws Exception {
+
+        try {
+            final PackageBuilder builder = new PackageBuilder();
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DeclarationUsage.drl" ) ) );
+            final Package pkg = builder.getPackage();
+
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg );
+
+            fail( "Should have trown an exception" );
+        } catch ( final InvalidRulePackage e ) {
+            // success ... correct exception thrown
+        } catch ( final Exception e ) {
+            e.printStackTrace();
+            fail( "Wrong exception raised: " + e.getMessage() );
+        }
+    }
+
+    public void testUnbalancedTrees() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_UnbalancedTrees.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        wm.insert( new Cheese( "a",
+                               10 ) );
+        wm.insert( new Cheese( "b",
+                               10 ) );
+        wm.insert( new Cheese( "c",
+                               10 ) );
+        wm.insert( new Cheese( "d",
+                               10 ) );
+        final Cheese e = new Cheese( "e",
+                                     10 );
+        wm.insert( e );
+
+        wm.fireAllRules();
+
+        Assert.assertEquals( "Rule should have fired twice, seting the price to 30",
+                             30,
+                             e.getPrice() );
+        // success
+    }
+
+    public void testImportConflict() throws Exception {
+        final RuleBase ruleBase = getRuleBase();
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ImportConflict.drl" ) ) );
+        final Package pkg = builder.getPackage();
+        ruleBase.addPackage( pkg );
+    }
+
+    public void testPrimitiveArray() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_primitiveArray.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List result = new ArrayList();
+        workingMemory.setGlobal( "result",
+                                 result );
+
+        final Primitives p1 = new Primitives();
+        p1.setPrimitiveArrayAttribute( new int[]{1, 2, 3} );
+        p1.setArrayAttribute( new String[]{"a", "b"} );
+
+        workingMemory.insert( p1 );
+
+        workingMemory.fireAllRules();
+        assertEquals( 3,
+                      result.size() );
+        assertEquals( 3,
+                      ((Integer) result.get( 0 )).intValue() );
+        assertEquals( 2,
+                      ((Integer) result.get( 1 )).intValue() );
+        assertEquals( 3,
+                      ((Integer) result.get( 2 )).intValue() );
+
+    }
+
+    public void testEmptyIdentifier() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_emptyIdentifier.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final List result = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 result );
+
+        final Person person = new Person( "bob" );
+        final Cheese cheese = new Cheese( "brie",
+                                          10 );
+
+        workingMemory.insert( person );
+        workingMemory.insert( cheese );
+
+        workingMemory.fireAllRules();
+        assertEquals( 4,
+                      result.size() );
+    }
+
+    public void testDuplicateVariableBinding() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_duplicateVariableBinding.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        final Map result = new HashMap();
+        workingMemory.setGlobal( "results",
+                                 result );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           20 );
+        final Cheese brie = new Cheese( "brie",
+                                        10 );
+
+        workingMemory.insert( stilton );
+        workingMemory.insert( brie );
+
+        workingMemory.fireAllRules();
+        assertEquals( 5,
+                      result.size() );
+        assertEquals( stilton.getPrice(),
+                      ((Integer) result.get( stilton.getType() )).intValue() );
+        assertEquals( brie.getPrice(),
+                      ((Integer) result.get( brie.getType() )).intValue() );
+
+        assertEquals( stilton.getPrice(),
+                      ((Integer) result.get( stilton )).intValue() );
+        assertEquals( brie.getPrice(),
+                      ((Integer) result.get( brie )).intValue() );
+
+        assertEquals( stilton.getPrice(),
+                      ((Integer) result.get( "test3" + stilton.getType() )).intValue() );
+
+        workingMemory.insert( new Person( "bob",
+                                          brie.getType() ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 6,
+                      result.size() );
+        assertEquals( brie.getPrice(),
+                      ((Integer) result.get( "test3" + brie.getType() )).intValue() );
+    }
+
+    public void testDuplicateVariableBindingError() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_duplicateVariableBindingError.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        assertFalse( pkg.isValid() );
+        System.out.println( pkg.getErrorSummary() );
+        assertEquals( 6,
+                      pkg.getErrorSummary().split( "\n" ).length );
+    }
+
+    public void testShadowProxyInHirarchies() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ShadowProxyInHirarchies.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.insert( new Child( "gp" ) );
+
+        workingMemory.fireAllRules();
+    }
+
+    public void testSelfReference() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_SelfReference.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Order order = new Order( 10,
+                                       "Bob" );
+        final OrderItem item1 = new OrderItem( order,
+                                               1 );
+        final OrderItem item2 = new OrderItem( order,
+                                               2 );
+        final OrderItem anotherItem1 = new OrderItem( null,
+                                                      3 );
+        final OrderItem anotherItem2 = new OrderItem( null,
+                                                      4 );
+        workingMemory.insert( order );
+        workingMemory.insert( item1 );
+        workingMemory.insert( item2 );
+        workingMemory.insert( anotherItem1 );
+        workingMemory.insert( anotherItem2 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+        assertTrue( results.contains( item1 ) );
+        assertTrue( results.contains( item2 ) );
+    }
+
+    public void testNumberComparisons() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NumberComparisons.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        // asserting the sensor object
+        final RandomNumber rn = new RandomNumber();
+        rn.setValue( 10 );
+        workingMemory.insert( rn );
+
+        final Guess guess = new Guess();
+        guess.setValue( new Integer( 5 ) );
+
+        final FactHandle handle = workingMemory.insert( guess );
+
+        workingMemory.fireAllRules();
+
+        // HIGHER
+        assertEquals( 1,
+                      list.size() );
+        assertEquals( "HIGHER",
+                      list.get( 0 ) );
+
+        guess.setValue( new Integer( 15 ) );
+        workingMemory.update( handle,
+                              guess );
+
+        workingMemory.fireAllRules();
+
+        // LOWER
+        assertEquals( 2,
+                      list.size() );
+        assertEquals( "LOWER",
+                      list.get( 1 ) );
+
+        guess.setValue( new Integer( 10 ) );
+        workingMemory.update( handle,
+                              guess );
+
+        workingMemory.fireAllRules();
+
+        // CORRECT
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( "CORRECT",
+                      list.get( 2 ) );
+
+    }
+
+    public void testSkipModify() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_skipModify.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Cheese cheese = new Cheese( "brie",
+                                          10 );
+        final FactHandle handle = workingMemory.insert( cheese );
+
+        final Person bob = new Person( "bob",
+                                       "stilton" );
+        workingMemory.insert( bob );
+
+        cheese.setType( "stilton" );
+        workingMemory.update( handle,
+                              cheese );
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      results.size() );
+    }
+
+    public void testEventModel() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EventModel.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final List agendaList = new ArrayList();
+        final AgendaEventListener agendaEventListener = new AgendaEventListener() {
+
+            public void activationCancelled(ActivationCancelledEvent event,
+                                            WorkingMemory workingMemory) {
+                agendaList.add( event );
+
+            }
+
+            public void activationCreated(ActivationCreatedEvent event,
+                                          WorkingMemory workingMemory) {
+                agendaList.add( event );
+            }
+
+            public void afterActivationFired(AfterActivationFiredEvent event,
+                                             WorkingMemory workingMemory) {
+                agendaList.add( event );
+            }
+
+            public void agendaGroupPopped(AgendaGroupPoppedEvent event,
+                                          WorkingMemory workingMemory) {
+                agendaList.add( event );
+            }
+
+            public void agendaGroupPushed(AgendaGroupPushedEvent event,
+                                          WorkingMemory workingMemory) {
+                agendaList.add( event );
+            }
+
+            public void beforeActivationFired(BeforeActivationFiredEvent event,
+                                              WorkingMemory workingMemory) {
+                agendaList.add( event );
+            }
+
+        };
+
+        final List wmList = new ArrayList();
+        final WorkingMemoryEventListener workingMemoryListener = new WorkingMemoryEventListener() {
+
+            public void objectInserted(ObjectInsertedEvent event) {
+                wmList.add( event );
+            }
+
+            public void objectUpdated(ObjectUpdatedEvent event) {
+                wmList.add( event );
+            }
+
+            public void objectRetracted(ObjectRetractedEvent event) {
+                wmList.add( event );
+            }
+
+        };
+
+        wm.addEventListener( workingMemoryListener );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           15 );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           17 );
+
+        final FactHandle stiltonHandle = wm.insert( stilton );
+
+        final ObjectInsertedEvent oae = (ObjectInsertedEvent) wmList.get( 0 );
+        assertSame( stiltonHandle,
+                    oae.getFactHandle() );
+
+        wm.update( stiltonHandle,
+                   stilton );
+        final ObjectUpdatedEvent ome = (ObjectUpdatedEvent) wmList.get( 1 );
+        assertSame( stiltonHandle,
+                    ome.getFactHandle() );
+
+        wm.retract( stiltonHandle );
+        final ObjectRetractedEvent ore = (ObjectRetractedEvent) wmList.get( 2 );
+        assertSame( stiltonHandle,
+                    ore.getFactHandle() );
+
+        wm.insert( cheddar );
+    }
+
+    public void testImplicitDeclarations() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_implicitDeclarations.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+        workingMemory.setGlobal( "factor",
+                                 new Double( 1.2 ) );
+
+        final Cheese cheese = new Cheese( "stilton",
+                                          10 );
+        workingMemory.insert( cheese );
+
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      results.size() );
+    }
+
+    public void testCastingInsideEvals() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_castsInsideEval.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "value",
+                                 new Integer( 20 ) );
+
+        workingMemory.fireAllRules();
+    }
+
+    public void testMemberOfAndNotMemberOf() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_memberOf.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        final Cheese muzzarela = new Cheese( "muzzarela",
+                                             10 );
+        final Cheese brie = new Cheese( "brie",
+                                        15 );
+        workingMemory.insert( stilton );
+        workingMemory.insert( muzzarela );
+
+        final Cheesery cheesery = new Cheesery();
+        cheesery.getCheeses().add( stilton.getType() );
+        cheesery.getCheeses().add( brie.getType() );
+        workingMemory.insert( cheesery );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( stilton,
+                      list.get( 0 ) );
+        assertEquals( muzzarela,
+                      list.get( 1 ) );
+    }
+
+    public void testContainsInArray() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_contains_in_array.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Primitives p = new Primitives();
+        p.setStringArray( new String[]{"test1", "test3"} );
+        workingMemory.insert( p );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( "ok1",
+                      list.get( 0 ) );
+        assertEquals( "ok2",
+                      list.get( 1 ) );
+    }
+
+    public void testCollectNodeSharing() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_collectNodeSharing.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          10 ) );
+        workingMemory.insert( new Cheese( "brie",
+                                          15 ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( 2,
+                      ((List) list.get( 0 )).size() );
+    }
+
+    public void testNodeSharingNotExists() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_nodeSharingNotExists.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( "rule1",
+                      list.get( 0 ) );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          10 ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+
+        assertEquals( "rule2",
+                      list.get( 1 ) );
+
+    }
+
+    public void testNullBinding() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_nullBindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        workingMemory.insert( new Person( "bob" ) );
+        workingMemory.insert( new Person( null ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( "OK",
+                      list.get( 0 ) );
+
+    }
+
+    public void testModifyRetractWithFunction() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RetractModifyWithFunction.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           7 );
+        final Cheese muzzarella = new Cheese( "muzzarella",
+                                              9 );
+        final int sum = stilton.getPrice() + muzzarella.getPrice();
+        final FactHandle stiltonHandle = workingMemory.insert( stilton );
+        final FactHandle muzzarellaHandle = workingMemory.insert( muzzarella );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( sum,
+                      stilton.getPrice() );
+        assertEquals( 1,
+                      workingMemory.getObjectStore().size() );
+        assertNotNull( workingMemory.getObject( stiltonHandle ) );
+        assertNotNull( workingMemory.getFactHandle( stilton ) );
+
+        assertNull( workingMemory.getObject( muzzarellaHandle ) );
+        assertNull( workingMemory.getFactHandle( muzzarella ) );
+
+    }
+
+    public void testConstraintConnectors() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConstraintConnectors.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Person youngChili1 = new Person( "young chili1" );
+        youngChili1.setAge( 12 );
+        youngChili1.setHair( "blue" );
+        final Person youngChili2 = new Person( "young chili2" );
+        youngChili2.setAge( 25 );
+        youngChili2.setHair( "purple" );
+
+        final Person chili1 = new Person( "chili1" );
+        chili1.setAge( 35 );
+        chili1.setHair( "red" );
+
+        final Person chili2 = new Person( "chili2" );
+        chili2.setAge( 38 );
+        chili2.setHair( "indigigo" );
+
+        final Person oldChili1 = new Person( "old chili2" );
+        oldChili1.setAge( 45 );
+        oldChili1.setHair( "green" );
+
+        final Person oldChili2 = new Person( "old chili2" );
+        oldChili2.setAge( 48 );
+        oldChili2.setHair( "blue" );
+
+        final Person veryold = new Person( "very old" );
+        veryold.setAge( 99 );
+        veryold.setHair( "gray" );
+
+        workingMemory.insert( youngChili1 );
+        workingMemory.insert( youngChili2 );
+        workingMemory.insert( chili1 );
+        workingMemory.insert( chili2 );
+        workingMemory.insert( oldChili1 );
+        workingMemory.insert( oldChili2 );
+        workingMemory.insert( veryold );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 4,
+                      results.size() );
+        assertEquals( chili1,
+                      results.get( 0 ) );
+        assertEquals( oldChili1,
+                      results.get( 1 ) );
+        assertEquals( youngChili1,
+                      results.get( 2 ) );
+        assertEquals( veryold,
+                      results.get( 3 ) );
+
+    }
+
+    public void testMatchesNotMatchesCheese() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_MatchesNotMatches.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        final Cheese stilton2 = new Cheese( "stilton2",
+                                            12 );
+        final Cheese agedStilton = new Cheese( "aged stilton",
+                                            12 );
+        final Cheese brie = new Cheese( "brie",
+                                        10 );
+        final Cheese brie2 = new Cheese( "brie2",
+                                         10 );
+        final Cheese muzzarella = new Cheese( "muzzarella",
+                                              10 );
+        final Cheese muzzarella2 = new Cheese( "muzzarella2",
+                                               10 );
+        workingMemory.insert( stilton );
+        workingMemory.insert( stilton2 );
+        workingMemory.insert( agedStilton );
+        workingMemory.insert( brie );
+        workingMemory.insert( brie2 );
+        workingMemory.insert( muzzarella );
+        workingMemory.insert( muzzarella2 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      list.size() );
+
+        assertEquals( stilton,
+                      list.get( 0 ) );
+        assertEquals( brie,
+                      list.get( 1 ) );
+        assertEquals( agedStilton,
+                      list.get( 2 ) );
+    }
+
+    public void testAutomaticBindings() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AutoBindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Person bob = new Person( "bob",
+                                       "stilton" );
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        workingMemory.insert( bob );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( bob,
+                      list.get( 0 ) );
+    }
+
+    public void testAutomaticBindingsErrors() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AutoBindingsErrors.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        assertNotNull( pkg.getErrorSummary() );
+    }
+
+    public void testQualifiedFieldReference() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_QualifiedFieldReference.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Person bob = new Person( "bob",
+                                       "stilton" );
+        final Cheese stilton = new Cheese( "stilton",
+                                           12 );
+        workingMemory.insert( bob );
+        workingMemory.insert( stilton );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( bob,
+                      list.get( 0 ) );
+    }
+
+    public void testEvalRewrite() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EvalRewrite.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 10,
+                                        "Bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        order1.addItem( item11 );
+        order1.addItem( item12 );
+        final Order order2 = new Order( 11,
+                                        "Bob" );
+        final OrderItem item21 = new OrderItem( order2,
+                                                1 );
+        final OrderItem item22 = new OrderItem( order2,
+                                                2 );
+        order2.addItem( item21 );
+        order2.addItem( item22 );
+        final Order order3 = new Order( 12,
+                                        "Bob" );
+        final OrderItem item31 = new OrderItem( order3,
+                                                1 );
+        final OrderItem item32 = new OrderItem( order3,
+                                                2 );
+        order3.addItem( item31 );
+        order3.addItem( item32 );
+        final Order order4 = new Order( 13,
+                                        "Bob" );
+        final OrderItem item41 = new OrderItem( order4,
+                                                1 );
+        final OrderItem item42 = new OrderItem( order4,
+                                                2 );
+        order4.addItem( item41 );
+        order4.addItem( item42 );
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+        workingMemory.insert( order2 );
+        workingMemory.insert( item21 );
+        workingMemory.insert( item22 );
+        workingMemory.insert( order3 );
+        workingMemory.insert( item31 );
+        workingMemory.insert( item32 );
+        workingMemory.insert( order4 );
+        workingMemory.insert( item41 );
+        workingMemory.insert( item42 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 5,
+                      list.size() );
+        assertTrue( list.contains( item11 ) );
+        assertTrue( list.contains( item12 ) );
+        assertTrue( list.contains( item22 ) );
+        assertTrue( list.contains( order3 ) );
+        assertTrue( list.contains( order4 ) );
+
+    }
+
+    public void testMapAccess() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_MapAccess.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        Map map = new HashMap();
+        map.put( "name",
+                 "Edson" );
+        map.put( "surname",
+                 "Tirelli" );
+        map.put( "age",
+                 "28" );
+
+        workingMemory.insert( map );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+        assertTrue( list.contains( map ) );
+
+    }
+
+    public void testHalt() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_halt.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Integer( 0 ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 10,
+                      results.size() );
+        for ( int i = 0; i < 10; i++ ) {
+            assertEquals( new Integer( i ),
+                          results.get( i ) );
+        }
+    }
+
+    public void testFireLimit() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_fireLimit.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Integer( 0 ) );
+        workingMemory.fireAllRules();
+
+        assertEquals( 20,
+                      results.size() );
+        for ( int i = 0; i < 20; i++ ) {
+            assertEquals( new Integer( i ),
+                          results.get( i ) );
+        }
+        results.clear();
+
+        workingMemory.insert( new Integer( 0 ) );
+        workingMemory.fireAllRules( 10 );
+
+        assertEquals( 10,
+                      results.size() );
+        for ( int i = 0; i < 10; i++ ) {
+            assertEquals( new Integer( i ),
+                          results.get( i ) );
+        }
+        results.clear();
+
+        workingMemory.insert( new Integer( 0 ) );
+        workingMemory.fireAllRules( -1 );
+
+        assertEquals( 20,
+                      results.size() );
+        for ( int i = 0; i < 20; i++ ) {
+            assertEquals( new Integer( i ),
+                          results.get( i ) );
+        }
+        results.clear();
+
+    }
+
+    public void testEqualitySupport() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_equalitySupport.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.EQUALITY );
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        PersonWithEquals person = new PersonWithEquals( "bob",
+                                                        30 );
+
+        workingMemory.insert( person );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( "mark",
+                      results.get( 0 ) );
+
+    }
+
+    public void testCharComparisons() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_charComparisons.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        Primitives p1 = new Primitives();
+        p1.setCharPrimitive( 'a' );
+        p1.setStringAttribute( "b" );
+        Primitives p2 = new Primitives();
+        p2.setCharPrimitive( 'b' );
+        p2.setStringAttribute( "a" );
+
+        workingMemory.insert( p1 );
+        workingMemory.insert( p2 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      results.size() );
+        assertEquals( "1",
+                      results.get( 0 ) );
+        assertEquals( "2",
+                      results.get( 1 ) );
+        assertEquals( "3",
+                      results.get( 2 ) );
+
+    }
+
+    public void testAlphaNodeSharing() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_alphaNodeSharing.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setShareAlphaNodes( false );
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        Person p1 = new Person( "bob",
+                                5 );
+        workingMemory.insert( p1 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+        assertEquals( "1",
+                      results.get( 0 ) );
+        assertEquals( "2",
+                      results.get( 1 ) );
+
+    }
+
+    public void testFunctionCallingFunctionWithEclipse() throws Exception {
+        PackageBuilderConfiguration packageBuilderConfig = new PackageBuilderConfiguration();
+        ((JavaDialectConfiguration) packageBuilderConfig.getDialectConfiguration( "java" )).setCompiler( JavaDialectConfiguration.ECLIPSE );
+
+        final PackageBuilder builder = new PackageBuilder( packageBuilderConfig );
+
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_functionCallingFunction.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( 10,
+                      ((Integer) list.get( 0 )).intValue() );
+    }
+
+    public void testFunctionCallingFunctionWithJanino() throws Exception {
+        PackageBuilderConfiguration packageBuilderConfig = new PackageBuilderConfiguration();
+        ((JavaDialectConfiguration) packageBuilderConfig.getDialectConfiguration( "java" )).setCompiler( JavaDialectConfiguration.JANINO );
+
+        final PackageBuilder builder = new PackageBuilder( packageBuilderConfig );
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_functionCallingFunction.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertEquals( 10,
+                      ((Integer) list.get( 0 )).intValue() );
+    }
+
+    public void testSelfReference2() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_SelfReference2.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Cheese() );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      results.size() );
+    }
+
+    public void testMergingDifferentPackages() throws Exception {
+        // using the same builder
+        try {
+            final PackageBuilder builder = new PackageBuilder();
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes1.drl" ) ) );
+            builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes2.drl" ) ) );
+            fail( "Can't merge packages with different names " );
+        } catch ( PackageMergeException e ) {
+            // success
+        } catch ( RuntimeException e ) {
+            e.printStackTrace();
+            fail( "unexpected exception: " + e.getMessage() );
+        }
+    }
+
+    public void testMergingDifferentPackages2() throws Exception {
+        // using different builders
+        try {
+            final PackageBuilder builder1 = new PackageBuilder();
+            builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes1.drl" ) ) );
+            final Package pkg1 = builder1.getPackage();
+
+            assertEquals( 1,
+                          pkg1.getRules().length );
+
+            final PackageBuilder builder2 = new PackageBuilder();
+            builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes2.drl" ) ) );
+            final Package pkg2 = builder2.getPackage();
+
+            assertEquals( 1,
+                          pkg2.getRules().length );
+
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg1 );
+            ruleBase.addPackage( pkg2 );
+            final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+            final List results = new ArrayList();
+            workingMemory.setGlobal( "results",
+                                     results );
+
+            workingMemory.insert( new Cheese( "stilton",
+                                              10 ) );
+            workingMemory.insert( new Cheese( "brie",
+                                              5 ) );
+
+            workingMemory.fireAllRules();
+
+            assertEquals( results.toString(),
+                          2,
+                          results.size() );
+            assertTrue( results.contains( "p1.r1" ) );
+            assertTrue( results.contains( "p2.r1" ) );
+
+        } catch ( PackageMergeException e ) {
+            fail( "Should not raise exception when merging different packages into the same rulebase: " + e.getMessage() );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "unexpected exception: " + e.getMessage() );
+        }
+    }
+
+    public void testRuleReplacement() throws Exception {
+        // test rule replacement
+        try {
+            final PackageBuilder builder1 = new PackageBuilder();
+            builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes1.drl" ) ) );
+            builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuleNameClashes3.drl" ) ) );
+            final Package pkg1 = builder1.getPackage();
+
+            assertEquals( 1,
+                          pkg1.getRules().length );
+
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg1 );
+            final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+            final List results = new ArrayList();
+            workingMemory.setGlobal( "results",
+                                     results );
+
+            workingMemory.insert( new Cheese( "stilton",
+                                              10 ) );
+            workingMemory.insert( new Cheese( "brie",
+                                              5 ) );
+
+            workingMemory.fireAllRules();
+
+            assertEquals( results.toString(),
+                          0,
+                          results.size() );
+
+            workingMemory.insert( new Cheese( "muzzarella",
+                                              7 ) );
+
+            workingMemory.fireAllRules();
+
+            assertEquals( results.toString(),
+                          1,
+                          results.size() );
+            assertTrue( results.contains( "p1.r3" ) );
+
+        } catch ( PackageMergeException e ) {
+            fail( "Should not raise exception when merging different packages into the same rulebase: " + e.getMessage() );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "unexpected exception: " + e.getMessage() );
+        }
+    }
+
+    public void testBindingsOnConnectiveExpressions() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_bindings.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          15 ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+        assertEquals( "stilton",
+                      results.get( 0 ) );
+        assertEquals( new Integer( 15 ),
+                      results.get( 1 ) );
+    }
+
+    public void testMultipleFroms() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_multipleFroms.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Cheesery cheesery = new Cheesery();
+        cheesery.addCheese( new Cheese( "stilton",
+                                        15 ) );
+        cheesery.addCheese( new Cheese( "brie",
+                                        10 ) );
+
+        workingMemory.setGlobal( "cheesery",
+                                 cheesery );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+        assertEquals( 2,
+                      ((List) results.get( 0 )).size() );
+        assertEquals( 2,
+                      ((List) results.get( 1 )).size() );
+    }
+
+    public void testNullHashing() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NullHashing.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          15 ) );
+        workingMemory.insert( new Cheese( "",
+                                          10 ) );
+        workingMemory.insert( new Cheese( null,
+                                          8 ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      results.size() );
+    }
+
+    public void testDefaultBetaConstrains() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DefaultBetaConstraint.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+        final FirstClass first = new FirstClass( "1",
+                                                 "2",
+                                                 "3",
+                                                 "4",
+                                                 "5" );
+        final FactHandle handle = workingMemory.insert( first );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 0 ) );
+
+        workingMemory.insert( new SecondClass() );
+        workingMemory.update( handle,
+                              first );
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 1 ) );
+
+        workingMemory.update( handle,
+                              first );
+        workingMemory.insert( new SecondClass( null,
+                                               "2",
+                                               "3",
+                                               "4",
+                                               "5" ) );
+        workingMemory.fireAllRules();
+        assertEquals( 3,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 2 ) );
+
+        workingMemory.update( handle,
+                              first );
+        workingMemory.insert( new SecondClass( "1",
+                                               null,
+                                               "3",
+                                               "4",
+                                               "5" ) );
+        workingMemory.fireAllRules();
+        assertEquals( 4,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 3 ) );
+
+        workingMemory.update( handle,
+                              first );
+        workingMemory.insert( new SecondClass( "1",
+                                               "2",
+                                               null,
+                                               "4",
+                                               "5" ) );
+        workingMemory.fireAllRules();
+        assertEquals( 5,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 4 ) );
+
+        workingMemory.update( handle,
+                              first );
+        workingMemory.insert( new SecondClass( "1",
+                                               "2",
+                                               "3",
+                                               null,
+                                               "5" ) );
+        workingMemory.fireAllRules();
+        assertEquals( 6,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 5 ) );
+
+        workingMemory.update( handle,
+                              first );
+        workingMemory.insert( new SecondClass( "1",
+                                               "2",
+                                               "3",
+                                               "4",
+                                               null ) );
+        workingMemory.fireAllRules();
+        assertEquals( 7,
+                      results.size() );
+        assertEquals( "NOT",
+                      results.get( 6 ) );
+
+        workingMemory.insert( new SecondClass( "1",
+                                               "2",
+                                               "3",
+                                               "4",
+                                               "5" ) );
+        workingMemory.update( handle,
+                              first );
+        workingMemory.fireAllRules();
+        assertEquals( 8,
+                      results.size() );
+        assertEquals( "EQUALS",
+                      results.get( 7 ) );
+
+    }
+
+    public void testBooleanWrapper() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_BooleanWrapper.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        Primitives p1 = new Primitives();
+        workingMemory.insert( p1 );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      results.size() );
+
+        Primitives p2 = new Primitives();
+        p2.setBooleanWrapper( Boolean.FALSE );
+        workingMemory.insert( p2 );
+        workingMemory.fireAllRules();
+        assertEquals( 0,
+                      results.size() );
+
+        Primitives p3 = new Primitives();
+        p3.setBooleanWrapper( Boolean.TRUE );
+        workingMemory.insert( p3 );
+        workingMemory.fireAllRules();
+        assertEquals( 1,
+                      results.size() );
+
+    }
+
+    public void testCrossProductRemovingIdentityEquals() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( MiscTest.class.getResourceAsStream( "test_CrossProductRemovingIdentityEquals.drl" ) ) );
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setShadowProxy( true );
+        RuleBase rb = RuleBaseFactory.newRuleBase( conf );
+        rb.addPackage( builder.getPackage() );
+        StatefulSession session = rb.newStatefulSession();
+
+        List list1 = new ArrayList();
+        List list2 = new ArrayList();
+
+        session.setGlobal( "list1",
+                           list1 );
+        session.setGlobal( "list2",
+                           list2 );
+
+        SpecialString first42 = new SpecialString( "42" );
+        SpecialString second43 = new SpecialString( "42" );
+        SpecialString world = new SpecialString( "World" );
+        session.insert( world );
+        session.insert( first42 );
+        session.insert( second43 );
+
+        //System.out.println( "Firing rules ..." );
+
+        session.fireAllRules();
+
+        assertEquals( 6,
+                      list1.size() );
+        assertEquals( 6,
+                      list2.size() );
+
+        assertEquals( second43,
+                      list1.get( 0 ) );
+        assertEquals( first42,
+                      list1.get( 1 ) );
+        assertEquals( world,
+                      list1.get( 2 ) );
+        assertEquals( second43,
+                      list1.get( 3 ) );
+        assertEquals( first42,
+                      list1.get( 4 ) );
+        assertEquals( world,
+                      list1.get( 5 ) );
+
+        assertEquals( first42,
+                      list2.get( 0 ) );
+        assertEquals( second43,
+                      list2.get( 1 ) );
+        assertEquals( second43,
+                      list2.get( 2 ) );
+        assertEquals( world,
+                      list2.get( 3 ) );
+        assertEquals( world,
+                      list2.get( 4 ) );
+        assertEquals( first42,
+                      list2.get( 5 ) );
+    }
+
+    public void testIterateObjects() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_IterateObjects.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          10 ) );
+
+        workingMemory.fireAllRules();
+
+        Iterator events = workingMemory.iterateObjects( new ClassObjectFilter( PersonInterface.class ) );
+
+        assertTrue( events.hasNext() );
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( results.get( 0 ),
+                      events.next() );
+    }
+
+    public void testNotInStatelessSession() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NotInStatelessSession.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setSequential( true );
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+
+        StatelessSession session = ruleBase.newStatelessSession();
+        List list = new ArrayList();
+        session.setGlobal( "list",
+                           list );
+        session.execute( "not integer" );
+        assertEquals( "not integer",
+                      list.get( 0 ) );
+    }
+
+    public void testDynamicallyAddInitialFactRule() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        String rule = "package org.drools.test\n global java.util.List list\n rule xxx\n when\n i:Integer()\nthen\n list.add(i);\nend";
+        builder.addPackageFromDrl( new StringReader( rule ) );
+        Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        StatefulSession session = ruleBase.newStatefulSession();
+        List list = new ArrayList();
+        session.setGlobal( "list",
+                           list );
+
+        session.insert( new Integer( 5 ) );
+        session.fireAllRules();
+
+        assertEquals( new Integer( 5 ),
+                      list.get( 0 ) );
+
+        builder = new PackageBuilder();
+        rule = "package org.drools.test\n global java.util.List list\n rule xxx\n when\nthen\n list.add(\"x\");\nend";
+        builder.addPackageFromDrl( new StringReader( rule ) );
+        pkg = builder.getPackage();
+
+        // Make sure that this rule is fired as the Package is updated, it also tests that InitialFactImpl is still in the network
+        // even though the first rule didn't use it.
+        ruleBase.addPackage( pkg );
+
+        assertEquals( "x",
+                      list.get( 1 ) );
+
+    }
+
+    public void testEvalRewriteWithSpecialOperators() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EvalRewriteWithSpecialOperators.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 10,
+                                        "Bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        order1.addItem( item11 );
+        order1.addItem( item12 );
+        final Order order2 = new Order( 11,
+                                        "Bob" );
+        final OrderItem item21 = new OrderItem( order2,
+                                                1 );
+        final OrderItem item22 = new OrderItem( order2,
+                                                2 );
+        order2.addItem( item21 );
+        order2.addItem( item22 );
+        final Order order3 = new Order( 12,
+                                        "Bob" );
+        final OrderItem item31 = new OrderItem( order3,
+                                                1 );
+        final OrderItem item32 = new OrderItem( order3,
+                                                2 );
+        final OrderItem item33 = new OrderItem( order3,
+                                                3 );
+        order3.addItem( item31 );
+        order3.addItem( item32 );
+        order3.addItem( item33 );
+        final Order order4 = new Order( 13,
+                                        "Bob" );
+        final OrderItem item41 = new OrderItem( order4,
+                                                1 );
+        final OrderItem item42 = new OrderItem( order4,
+                                                2 );
+        order4.addItem( item41 );
+        order4.addItem( item42 );
+        final Order order5 = new Order( 14,
+                                        "Mark" );
+        final OrderItem item51 = new OrderItem( order5,
+                                                1 );
+        final OrderItem item52 = new OrderItem( order5,
+                                                2 );
+        order5.addItem( item51 );
+        order5.addItem( item52 );
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+        workingMemory.insert( order2 );
+        workingMemory.insert( item21 );
+        workingMemory.insert( item22 );
+        workingMemory.insert( order3 );
+        workingMemory.insert( item31 );
+        workingMemory.insert( item32 );
+        workingMemory.insert( item33 );
+        workingMemory.insert( order4 );
+        workingMemory.insert( item41 );
+        workingMemory.insert( item42 );
+        workingMemory.insert( order5 );
+        workingMemory.insert( item51 );
+        workingMemory.insert( item52 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 9,
+                      list.size() );
+        int index = 0;
+        assertEquals( item11,
+                      list.get( index++ ) );
+        assertEquals( item12,
+                      list.get( index++ ) );
+        assertEquals( item21,
+                      list.get( index++ ) );
+        assertEquals( item22,
+                      list.get( index++ ) );
+        assertEquals( item31,
+                      list.get( index++ ) );
+        assertEquals( item33,
+                      list.get( index++ ) );
+        assertEquals( item41,
+                      list.get( index++ ) );
+        assertEquals( order5,
+                      list.get( index++ ) );
+        assertEquals( order5,
+                      list.get( index++ ) );
+
+    }
+
+    public void testImportColision() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        final PackageBuilder builder2 = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "nested1.drl" ) ) );
+        builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "nested2.drl" ) ) );
+        final Package pkg = builder.getPackage();
+        final Package pkg2 = builder2.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        ruleBase.addPackage( pkg2 );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.insert( new FirstClass() );
+        workingMemory.insert( new SecondClass() );
+        workingMemory.insert( new FirstClass.AlternativeKey() );
+        workingMemory.insert( new SecondClass.AlternativeKey() );
+
+        workingMemory.fireAllRules();
+    }
+
+    public void testAutovivificationOfVariableRestrictions() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AutoVivificationVR.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          10,
+                                          8 ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+    }
+
+    public void testShadowProxyOnCollections() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ShadowProxyOnCollections.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List results = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 results );
+
+        final Cheesery cheesery = new Cheesery();
+        workingMemory.insert( cheesery );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        assertEquals( 1,
+                      cheesery.getCheeses().size() );
+        assertEquals( results.get( 0 ),
+                      cheesery.getCheeses().get( 0 ) );
+    }
+
+    public void testQueryWithCollect() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Query.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        workingMemory.fireAllRules();
+
+        final QueryResults results = workingMemory.getQueryResults( "collect objects" );
+        assertEquals( 1,
+                      results.size() );
+
+        final QueryResult result = results.get( 0 );
+        final List list = (List) result.get( "$list" );
+
+        assertEquals( 2,
+                      list.size() );
+    }
+
+    public void testNestedAccessors() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NestedAccessors.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 11,
+                                        "Bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        order1.addItem( item11 );
+        order1.addItem( item12 );
+
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 0,
+                      list.size() );
+
+        final Order order2 = new Order( 12,
+                                        "Mark" );
+        Order.OrderStatus status = new Order.OrderStatus();
+        status.setActive( true );
+        order2.setStatus( status );
+        final OrderItem item21 = new OrderItem( order2,
+                                                1 );
+        final OrderItem item22 = new OrderItem( order2,
+                                                2 );
+        order1.addItem( item21 );
+        order1.addItem( item22 );
+
+        workingMemory.insert( order2 );
+        workingMemory.insert( item21 );
+        workingMemory.insert( item22 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+        assertSame( item21,
+                    list.get( 0 ) );
+        assertSame( item22,
+                    list.get( 1 ) );
+    }
+
+    public void testWorkingMemoryLoggerWithUnbalancedBranches() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Logger.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        try {
+            final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( wm );
+            logger.setFileName( "testLogger" );
+
+            wm.fireAllRules();
+
+            wm.insert( new Cheese( "a",
+                                   10 ) );
+            wm.insert( new Cheese( "b",
+                                   11 ) );
+
+            wm.fireAllRules();
+
+            //            logger.writeToDisk();
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "No exception should be raised " );
+        }
+
+    }
+
+    public void testFromNestedAccessors() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FromNestedAccessors.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 11,
+                                        "Bob" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        order1.addItem( item11 );
+        order1.addItem( item12 );
+
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        assertSame( order1.getStatus(),
+                    list.get( 0 ) );
+    }
+
+    public void testSubNetworks() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_SubNetworks.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+
+        try {
+            ruleBase.addPackage( builder.getPackage() );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail( "Should not raise any exception!" );
+        }
+
+    }
+
+    public void testFinalClass() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FinalClass.drl" ) ) );
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final PersonFinal bob = new PersonFinal();
+        bob.setName( "bob" );
+        bob.setStatus( null );
+
+        workingMemory.insert( bob );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 1,
+                      list.size() );
+
+        // Dynamic addition of rules which use the final class are not supported yet
+        //        final PackageBuilder builder2 = new PackageBuilder();
+        //        builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FinalClass2.drl" ) ) );
+        //        ruleBase.addPackage( builder2.getPackage() );
+        //
+        //        // it will automatically fire the rule
+        //        assertEquals( 2,
+        //                      list.size() );
+    }
+
+    public void testEvalRewriteMatches() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EvalRewriteMatches.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        final Order order1 = new Order( 14,
+                                        "Mark" );
+        final OrderItem item11 = new OrderItem( order1,
+                                                1 );
+        final OrderItem item12 = new OrderItem( order1,
+                                                2 );
+        order1.addItem( item11 );
+        order1.addItem( item12 );
+
+        workingMemory.insert( order1 );
+        workingMemory.insert( item11 );
+        workingMemory.insert( item12 );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 2,
+                      list.size() );
+        assertTrue( list.contains( item11 ) );
+        assertTrue( list.contains( item12 ) );
+    }
+
+    public void testConsequenceBuilderException() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConsequenceBuilderException.drl" ) ) );
+        
+        assertTrue( builder.hasErrors() );
+    }
+    
+    public void testRuntimeTypeCoercion() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuntimeTypeCoercion.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+        
+        final PolymorphicFact fact = new PolymorphicFact( new Integer( 10 ) );
+        final FactHandle handle = workingMemory.insert( fact );
+        
+        workingMemory.fireAllRules();
+        
+        assertEquals( 1, list.size() );
+        assertEquals( fact.getData(), list.get( 0 ) );
+        
+        fact.setData( "10" );
+        workingMemory.update( handle, fact );
+        workingMemory.fireAllRules();
+        
+        assertEquals( 2, list.size() );
+        assertEquals( fact.getData(), list.get( 1 ) );
+        
+        try {
+            fact.setData( new Boolean(true) );
+            workingMemory.update( handle, fact );
+            fail("Should not allow to compare < with a Boolean object");
+        } catch( ClassCastException cce ) {
+            // success, as can't use "<" to compare to a boolean
+        }
+        
+    }
+
+    public void testRuntimeTypeCoercion2() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RuntimeTypeCoercion2.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+        
+        final Primitives fact = new Primitives( );
+        fact.setBooleanPrimitive( true );
+        fact.setBooleanWrapper( new Boolean(true) );
+        fact.setObject( new Boolean(true) );
+        fact.setCharPrimitive( 'X' );
+        final FactHandle handle = workingMemory.insert( fact );
+        
+        workingMemory.fireAllRules();
+        
+        int index = 0;
+        assertEquals( list.toString(), 4, list.size() );
+        assertEquals( "boolean", list.get( index++ ));
+        assertEquals( "boolean wrapper", list.get( index++ ));
+        assertEquals( "boolean object", list.get( index++ ));
+        assertEquals( "char", list.get( index++ ));
+        
+        fact.setBooleanPrimitive( false );
+        fact.setBooleanWrapper( null );
+        fact.setCharPrimitive( '\0' );
+        fact.setObject( new Character('X') );
+        workingMemory.update( handle, fact );
+        workingMemory.fireAllRules();
+        assertEquals( 5, list.size() );
+        assertEquals( "char object", list.get( index++ ) );
+        
+        fact.setObject( null );
+        workingMemory.update( handle, fact );
+        workingMemory.fireAllRules();
+        assertEquals( 6, list.size() );
+        assertEquals( "null object", list.get( index++ ) );
+        
+    }
+
+    public void testAlphaEvalWithOrCE() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AlphaEvalWithOrCE.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+        
+        FactA a = new FactA();
+        a.setField1( "a value" );
+
+        workingMemory.insert( a );
+        workingMemory.insert( new FactB() );
+        workingMemory.insert( new FactC() );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( "should not have fired", 
+                      0,
+                      list.size() );
+    }
+
+    public void testModifyRetractAndModifyInsert() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ModifyRetractInsert.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        Person bob = new Person( "Bob" );
+        bob.setStatus( "hungry" );
+        workingMemory.insert( bob );
+        workingMemory.insert( new Cheese() );
+        workingMemory.insert( new Cheese() );
+
+        workingMemory.fireAllRules( 2 );
+
+        assertEquals( "should have fired only once", 
+                      1,
+                      list.size() );
+    }
+    
+    // this test requires mvel 1.2.19. Leaving it commented until mvel is released.
+    public void FIXME_testJavaModifyBlock() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_JavaModifyBlock.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+
+        Person bob = new Person( "Bob", 30 );
+        bob.setStatus( "hungry" );
+        workingMemory.insert( bob );
+        workingMemory.insert( new Cheese() );
+        workingMemory.insert( new Cheese() );
+
+        workingMemory.fireAllRules( 2 );
+
+        assertEquals( "should have fired only once", 
+                      1,
+                      list.size() );
+        assertEquals( "full", bob.getStatus() );
+        assertEquals( 31, bob.getAge() );
+    }
+    
+    public void testOrCE() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OrCE.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "results",
+                                 list );
+        
+        workingMemory.insert( new Cheese( "brie", 10 ) );
+        workingMemory.insert( new Person( "bob" ) );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( "should have fired once", 
+                      1,
+                      list.size() );
+    }
+    
+    public void testGetFactHandleEqualityBehavior() throws Exception {
+        final RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.EQUALITY );
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase( conf );
+
+        final StatefulSession session = ruleBase.newStatefulSession();
+
+        CheeseEqual cheese = new CheeseEqual("stilton", 10);
+        session.insert(cheese);
+        FactHandle fh = session.getFactHandle(new CheeseEqual("stilton", 10));
+        assertNotNull(fh);
+    }    
+
+    public void testGetFactHandleIdentityBehavior() throws Exception {
+        final RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.IDENTITY );
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase( conf );
+
+        final StatefulSession session = ruleBase.newStatefulSession();
+
+        CheeseEqual cheese = new CheeseEqual("stilton", 10);
+        session.insert(cheese);
+        FactHandle fh1 = session.getFactHandle(new Cheese("stilton", 10));
+        assertNull(fh1);
+        FactHandle fh2 = session.getFactHandle( cheese );
+        assertNotNull(fh2);
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/OutOfMemoryTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/OutOfMemoryTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/OutOfMemoryTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,89 @@
+package org.drools.integrationtests;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.InputStreamReader;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.WorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+
+
+/** Run all the tests with the ReteOO engine implementation */
+public class OutOfMemoryTest extends TestCase {
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testStatefulSessionsCreation() throws Exception {
+
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OutOfMemoryError.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        
+        int i = 0;
+        
+        try {
+            for( i = 0; i < 300000; i++ ) {
+                final StatefulSession session = ruleBase.newStatefulSession( true );
+                session.dispose();
+            } 
+        } catch ( Throwable e ) {
+            System.out.println("Error at: "+i);
+            e.printStackTrace();
+            fail("Should not raise any error or exception.");
+        }
+
+    }
+    
+    public void testAgendaLoop() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OutOfMemory.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.insert( new Cheese( "stilton",
+                                          1 ) );
+
+        workingMemory.fireAllRules( 3000000 );
+
+        // just for profiling
+        //Thread.currentThread().wait();
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/PackageBuilderThreadSafetyTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/PackageBuilderThreadSafetyTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/PackageBuilderThreadSafetyTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,144 @@
+package org.drools.integrationtests;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.compiler.DroolsError;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.PackageBuilderErrors;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
+
+public class PackageBuilderThreadSafetyTest extends TestCase {
+
+    private static final int _NUMBER_OF_THREADS = 100;
+    private static final int _SLEEP_TIME_MS     = 100;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testDummy() {
+    }
+
+    public void testThreadSafetyEclipse() {
+        execute( JavaDialectConfiguration.ECLIPSE );
+    }
+
+    public void testThreadSafetyJanino() {
+        execute( JavaDialectConfiguration.JANINO  );
+    }
+
+    public void execute(int compiler) {
+        final PackageBuilderConfiguration packageBuilderConfig = new PackageBuilderConfiguration();
+        ((JavaDialectConfiguration) packageBuilderConfig.getDialectConfiguration( "java" )).setCompiler( compiler );
+
+        final List<PackageBuilderErrors> errors = new ArrayList<PackageBuilderErrors>();
+        final List<Exception> exceptions = new ArrayList<Exception>();
+        Thread[] threads = new Thread[_NUMBER_OF_THREADS];
+        for ( int i = 0; i < _NUMBER_OF_THREADS; i++ ) {
+            final int ID = i;
+            Thread testThread = new Thread() {
+                public void run() {
+                    try {
+                        this.setName( "Thread[" + ID + "]" );
+                        org.drools.compiler.PackageBuilder builder = null;
+                        try {
+                            builder = new org.drools.compiler.PackageBuilder( packageBuilderConfig );
+                        } catch ( Throwable t ) {
+                            t.printStackTrace();
+                            throw new RuntimeException( t );
+                        }
+                        PackageDescr packageDescr = new PackageDescr( "MyRulebase" );
+                        addImports( packageDescr );
+                        addFunctions( packageDescr );
+                        // added some arbitrary sleep statements to encourage
+                        // context switching and hope this provokes exceptions
+                        sleep( _SLEEP_TIME_MS );
+                        builder.addPackage( packageDescr );
+                        sleep( _SLEEP_TIME_MS );
+                        builder.getPackage();
+                        sleep( _SLEEP_TIME_MS );
+                        if ( builder.hasErrors() ) {
+                            System.out.println( "ERROR in thread: " + ID );
+                            System.out.println( builder.getErrors().toString() );
+                            errors.add( builder.getErrors() );
+                        }
+                    } catch ( Exception e ) {
+                        e.printStackTrace();
+                        exceptions.add( e );
+                    }
+                }
+            };
+            threads[i] = testThread;
+            try {
+                testThread.start();
+            } catch ( Exception e ) {
+                assertTrue( false );
+            }
+        }
+        for ( int i = 0; i < _NUMBER_OF_THREADS; i++ ) {
+            try {
+                threads[i].join();
+            } catch ( InterruptedException e ) {
+                threads[i].interrupt();
+            }
+        }
+        StringBuffer exceptionBuf = new StringBuffer();
+        if (!exceptions.isEmpty()) {
+        	System.err.println("------->EXCEPTION(s) DURING THREAD TEST : <-------------------");
+            for (Iterator<Exception> iterator = exceptions.iterator(); iterator.hasNext();) {
+				Exception name = iterator.next();
+				exceptionBuf.append(name + name.getMessage() + "\n");
+			}
+        }
+
+        StringBuffer errorBuf = new StringBuffer();
+        if (!errors.isEmpty()) {
+        	System.err.println("------->ERROR(s) DURING THREAD TEST : <-------------------");
+            for (Iterator<PackageBuilderErrors> iterator = errors.iterator(); iterator.hasNext();) {
+				PackageBuilderErrors e = iterator.next();
+				for (int i = 0; i < e.getErrors().length; i++) {
+					DroolsError de = e.getErrors()[i];
+					errorBuf.append(de.getMessage() + "\n");
+				}
+
+			}
+        }
+
+
+
+
+        assertTrue( "Exceptions during package compilation : \n" + exceptionBuf.toString(),
+                    exceptions.isEmpty() );
+        assertTrue( "PackageBuilderErrors during package compilation : \n" + errorBuf.toString(),
+                    errors.isEmpty() );
+    }
+
+    private static void addImports(PackageDescr packageDescr) {
+        packageDescr.addImport( new ImportDescr( "java.util.List" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.ArrayList" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.LinkedList" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.Set" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.HashSet" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.SortedSet" ) );
+        packageDescr.addImport( new ImportDescr( "java.util.TreeSet" ) );
+    }
+
+    private static void addFunctions(PackageDescr packageDescr) {
+        FunctionDescr functionDescr = new FunctionDescr( "foo",
+                                                         "void" );
+        functionDescr.addParameter( "String",
+                                    "arg1" );
+        String body = "Set myHashSet = new HashSet();" + "myHashSet.add(arg1);" + "List myArrayList = new ArrayList();" + "myArrayList.add(arg1);" + "List myLinkedList = new LinkedList();" + "myLinkedList.add(arg1);"
+                      + "Set myTreeSet = new TreeSet();" + "myTreeSet.add(arg1);";
+        functionDescr.setText( body );
+        packageDescr.addFunction( functionDescr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatefulSessionTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatefulSessionTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatefulSessionTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,216 @@
+package org.drools.integrationtests;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.FactHandle;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.concurrent.Future;
+import org.drools.rule.Package;
+
+public class StatefulSessionTest extends TestCase {
+    final List list = new ArrayList();
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testSingleObjectAssert() throws Exception {
+        StatefulSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );        
+
+        Future futureAssert = session.asyncInsert( stilton );               
+        Future futureFireAllRules = session.asyncFireAllRules();
+        
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }        
+               
+        assertTrue( futureAssert.getObject() instanceof FactHandle );
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+        
+    }
+    
+    public void testArrayObjectAssert() throws Exception {
+        StatefulSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );        
+
+        Future futureAssert = session.asyncInsert( new Object[] { stilton } );                
+        Future futureFireAllRules = session.asyncFireAllRules();
+        
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }        
+               
+        
+        assertTrue( futureAssert.getObject() instanceof List );
+        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );        
+    } 
+    
+    public void testCollectionObjectAssert() throws Exception {
+        StatefulSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );        
+
+        List collection = new ArrayList();
+        collection.add( stilton );
+        Future futureAssert = session.asyncInsert( collection );
+        
+        Future futureFireAllRules = session.asyncFireAllRules();
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }        
+               
+        assertTrue( futureAssert.getObject() instanceof List );
+        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );
+        
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }   
+    
+    public void testHasExceptionSingleAssert()throws Exception {
+
+        StatefulSession session = getExceptionSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );      
+
+        Future futureAssert = session.asyncInsert( brie );
+
+        Future futureFireAllRules = session.asyncFireAllRules();
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }   
+        
+
+        assertTrue( futureAssert.getObject() instanceof FactHandle );        
+        assertTrue( futureFireAllRules.exceptionThrown() );
+        assertTrue( futureFireAllRules.getException() instanceof Exception );
+    }
+    
+    public void testHasExceptionArrayAssert()throws Exception {
+
+        StatefulSession session = getExceptionSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );      
+
+        Future futureAssert = session.asyncInsert( new Object[] { brie } );                
+        Future futureFireAllRules = session.asyncFireAllRules();
+        
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }        
+                       
+        assertTrue( futureAssert.getObject() instanceof List );
+        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );        
+        assertTrue( futureFireAllRules.getException() instanceof Exception );
+    }   
+    
+    public void testHasExceptionCollectionAssert()throws Exception {
+
+        StatefulSession session = getExceptionSession();
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );      
+
+        List collection = new ArrayList();
+        collection.add( brie );
+        Future futureAssert = session.asyncInsert( collection );             
+        Future futureFireAllRules = session.asyncFireAllRules();
+        
+        int i = 0;
+        while ( !futureFireAllRules.isDone() ) {
+            Thread.sleep( 100 );
+            if (i++ > 5) {
+                fail( "Future should have finished by now" );
+            }
+        }        
+                       
+        assertTrue( futureAssert.getObject() instanceof List );
+        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );        
+        assertTrue( futureFireAllRules.getException() instanceof Exception );
+    }    
+    
+    public void testSequentialException() {
+        RuleBaseConfiguration config = new RuleBaseConfiguration();
+        config.setSequential( true );
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase( config );
+        
+        try {
+            ruleBase.newStatefulSession();
+            fail("cannot have a stateful session with sequential set to true" );
+        } catch ( Exception e ) {
+            
+        }
+    }
+    
+    private StatefulSession getExceptionSession() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConsequenceException.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        return ruleBase.newStatefulSession();
+    }
+
+    private StatefulSession getSession() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final StatefulSession session = ruleBase.newStatefulSession();
+
+        session.setGlobal( "list",
+                           this.list );
+        return session;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessSessionTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessSessionTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessSessionTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,276 @@
+package org.drools.integrationtests;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatelessSession;
+import org.drools.StatelessSessionResult;
+import org.drools.WorkingMemory;
+import org.drools.base.CopyIdentifiersGlobalExporter;
+import org.drools.base.MapGlobalResolver;
+import org.drools.base.ReferenceOriginalGlobalExporter;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+import org.drools.spi.GlobalExporter;
+import org.drools.spi.GlobalResolver;
+
+import junit.framework.TestCase;
+
+public class StatelessSessionTest extends TestCase {
+    final List list = new ArrayList();
+    final Cheesery cheesery = new Cheesery();
+    final GlobalResolver globalResolver = new MapGlobalResolver();
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testSingleObjectAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        session.execute( stilton );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testArrayObjectAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        session.execute( new Object[]{stilton} );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testCollectionObjectAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        List collection = new ArrayList();
+        collection.add( stilton );
+        session.execute( collection );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testSingleObjectAssertWithResults() throws Exception {
+        StatelessSession session = getSession();
+
+        // notice I don't export Cheessery
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter( new String[]{"list"} ) );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        StatelessSessionResult result = session.executeWithResults( stilton );
+
+        assertSame( stilton,
+                    result.iterateObjects().next() );
+
+        assertEquals( "stilton",
+                      ((List) result.getGlobal( "list" )).get( 0 ) );
+
+        // cheesery should be null
+        assertNull( result.getGlobal( "cheesery" ) );
+    }
+
+    public void testArrayObjectAssertWithResults() throws Exception {
+        StatelessSession session = getSession();
+
+        // notice I don't export Cheessery
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter( new String[]{"list"} ) );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        StatelessSessionResult result = session.executeWithResults( new Object[]{stilton} );
+
+        assertSame( stilton,
+                    result.iterateObjects().next() );
+
+        assertEquals( "stilton",
+                      ((List) result.getGlobal( "list" )).get( 0 ) );
+
+        // cheesery should be null
+        assertNull( result.getGlobal( "cheesery" ) );
+    }
+
+    public void testCollectionObjectAssertWithResults() throws Exception {
+        StatelessSession session = getSession();
+
+        // notice I don't export Cheessery
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter( new String[]{"list"} ) );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        List collection = new ArrayList();
+        collection.add( stilton );
+        StatelessSessionResult result = session.executeWithResults( collection );
+
+        assertSame( stilton,
+                    result.iterateObjects().next() );
+
+        assertEquals( "stilton",
+                      ((List) result.getGlobal( "list" )).get( 0 ) );
+
+        // cheesery should be null
+        assertNull( result.getGlobal( "cheesery" ) );
+    }
+
+    public void testAsynSingleOjbectcAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        session.asyncExecute( stilton );
+
+        Thread.sleep( 100 );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testAsynArrayOjbectcAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        session.asyncExecute( new Object[]{stilton} );
+
+        Thread.sleep( 100 );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+
+    public void testAsynCollectionOjbectcAssert() throws Exception {
+        StatelessSession session = getSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           5 );
+
+        List collection = new ArrayList();
+        collection.add( stilton );
+        session.execute( collection );
+
+        Thread.sleep( 100 );
+
+        assertEquals( "stilton",
+                      list.get( 0 ) );
+    }
+    
+    public void testCopyIdentifierGlobalExporterOneValue() throws Exception {
+        StatelessSession session = getSession();       
+
+        // notice I don't export Cheessery
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter( new String[]{"list"} ) );
+
+        StatelessSessionResult result = session.executeWithResults( (Object) null );
+
+        assertSame( this.list,
+                    result.getGlobal( "list" ) );
+
+        // cheesery should be null
+        assertNull( result.getGlobal( "cheesery" ) );
+        
+        assertNotSame( this.globalResolver, result.getGlobalResolver() );
+    }
+    
+    public void testCopyIdentifierGlobalExporterTwoValues() throws Exception {
+        StatelessSession session = getSession();
+
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter( new String[]{"list", "cheesery"} ) );
+
+        StatelessSessionResult result = session.executeWithResults( (Object) null );
+
+        assertSame( this.list,
+                    result.getGlobal( "list" ) );
+
+        // cheesery should be null
+        assertSame( this.cheesery,
+                    result.getGlobal( "cheesery" ) );
+        
+        assertNotSame( this.globalResolver, result.getGlobalResolver() );        
+    }    
+    
+    public void testCopyIdentifierGlobalExporterAllValues() throws Exception {
+        StatelessSession session = getSession();
+
+        // I've not specified any identifiers, so it should do them alll
+        session.setGlobalExporter( new CopyIdentifiersGlobalExporter() );
+
+        StatelessSessionResult result = session.executeWithResults( (Object) null );
+
+        assertSame( this.list,
+                    result.getGlobal( "list" ) );
+
+        // cheesery should be null
+        assertSame( this.cheesery,
+                    result.getGlobal( "cheesery" ) );
+        
+        assertNotSame( this.globalResolver, result.getGlobalResolver() );        
+    }     
+    
+    public void testReferenceOriginalGlobalExporter() throws Exception {
+        StatelessSession session = getSession();
+
+        // I've not specified any identifiers, so it should do them alll
+        session.setGlobalExporter( new ReferenceOriginalGlobalExporter() );
+
+        StatelessSessionResult result = session.executeWithResults( (Object) null );
+
+        assertSame( this.list,
+                    result.getGlobal( "list" ) );
+
+        // cheesery should be null
+        assertSame( this.cheesery,
+                    result.getGlobal( "cheesery" ) );
+        
+        assertSame( this.globalResolver, result.getGlobalResolver() );        
+    }        
+
+    private StatelessSession getSession() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_rule_test.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final StatelessSession session = ruleBase.newStatelessSession();
+        
+        session.setGlobalResolver( this.globalResolver );
+
+        session.setGlobal( "list",
+                           this.list );
+        session.setGlobal( "cheesery",
+                           this.cheesery );
+        return session;
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessStressTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessStressTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StatelessStressTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,96 @@
+package org.drools.integrationtests;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.Address;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatelessSession;
+import org.drools.compiler.PackageBuilder;
+
+import junit.framework.TestCase;
+
+/**
+ * This is for testing possible PermSpace issues (leaking) when spawning lots of sessions in concurrent threads.
+ * Normally this test will be XXX'ed out, as when running it will not terminate.
+ * @author Michael Neale
+ */
+public class StatelessStressTest extends TestCase {
+
+    public void testDummy() {
+        
+    }
+    
+    
+    public void XXXtestLotsOfStateless() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "thread_class_test.drl" ) ) );
+        assertFalse(builder.hasErrors());
+
+        
+        
+
+        final RuleBase rb  = RuleBaseFactory.newRuleBase();
+        rb.addPackage( builder.getPackage() );
+        
+      
+        
+        int numThreads = 100;
+        Thread[] ts = new Thread[numThreads];
+        
+        
+            for (int i=0; i<numThreads; i++) {
+                Runnable run = new Runnable() {
+    
+                    public void run() {
+                        
+                        long start = 0;
+                        long previous = 0;
+                        
+                        while (true) {
+                            start = System.currentTimeMillis();
+                            StatelessSession sess = rb.newStatelessSession();
+                            Person p = new Person();
+                            p.setName( "Michael" ); 
+                            Address add1 = new Address();
+                            add1.setStreet( "High" );
+                            Address add2 = new Address();
+                            add2.setStreet( "Low" );
+                            List l = new ArrayList();
+                            l.add( add1 ); l.add( add2 );
+                            p.setAddresses( l );        
+                            sess.execute( p );
+                            
+                            long current = System.currentTimeMillis() - start;
+                            if (previous != 0) {
+                                float f = current/previous;
+                                if (f > 1) {
+                                    System.err.println("SLOWDOWN");
+                                }
+                            }
+                            
+                            previous = current;
+                        }
+                    }
+                    
+                };
+                
+                Thread t = new Thread(run);
+                t.start();
+                ts[i] = t;
+            }
+            
+            for ( int i = 0; i < ts.length; i++ ) {
+                ts[i].join();
+            }
+        
+        
+        
+        
+    }
+    
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StreamsTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StreamsTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/StreamsTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Dec 14, 2007
+ */
+package org.drools.integrationtests;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.ClockType;
+import org.drools.EntryPointInterface;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StockTick;
+import org.drools.WorkingMemory;
+import org.drools.common.InternalFactHandle;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * Tests related to the stream support features
+ * 
+ * @author etirelli
+ */
+public class StreamsTest extends TestCase {
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    private RuleBase loadRuleBase(final Reader reader) throws IOException,
+                                                      DroolsParserException,
+                                                      Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+        if ( parser.hasErrors() ) {
+            System.out.println( parser.getErrors() );
+            Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+        }
+        // pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        // add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        // load up the rulebase
+        return ruleBase;
+    }
+
+    public void testEventAssertion() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_EntryPoint.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        StockTick tick1 = new StockTick( 1,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+        StockTick tick2 = new StockTick( 2,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis() );
+        StockTick tick3 = new StockTick( 3,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis() );
+        StockTick tick4 = new StockTick( 4,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+
+        assertNotNull( handle1 );
+        assertNotNull( handle2 );
+        assertNotNull( handle3 );
+        assertNotNull( handle4 );
+
+        assertTrue( handle1.isEvent() );
+        assertTrue( handle2.isEvent() );
+        assertTrue( handle3.isEvent() );
+        assertTrue( handle4.isEvent() );
+
+        wm.fireAllRules();
+
+        assertEquals( 0,
+                      results.size() );
+
+        StockTick tick5 = new StockTick( 5,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+        StockTick tick6 = new StockTick( 6,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis() );
+        StockTick tick7 = new StockTick( 7,
+                                         "ACME",
+                                         15,
+                                         System.currentTimeMillis() );
+        StockTick tick8 = new StockTick( 8,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis() );
+
+        EntryPointInterface entry = wm.getEntryPoint( "StockStream" );
+
+        InternalFactHandle handle5 = (InternalFactHandle) entry.insert( tick5 );
+        InternalFactHandle handle6 = (InternalFactHandle) entry.insert( tick6 );
+        InternalFactHandle handle7 = (InternalFactHandle) entry.insert( tick7 );
+        InternalFactHandle handle8 = (InternalFactHandle) entry.insert( tick8 );
+
+        assertNotNull( handle5 );
+        assertNotNull( handle6 );
+        assertNotNull( handle7 );
+        assertNotNull( handle8 );
+
+        assertTrue( handle5.isEvent() );
+        assertTrue( handle6.isEvent() );
+        assertTrue( handle7.isEvent() );
+        assertTrue( handle8.isEvent() );
+
+        wm.fireAllRules();
+
+        assertEquals( 1,
+                      results.size() );
+        assertSame( tick7,
+                    results.get( 0 ) );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,777 @@
+package org.drools.integrationtests;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.CheeseEqual;
+import org.drools.FactHandle;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.Sensor;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectFilter;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.common.TruthMaintenanceSystem;
+import org.drools.compiler.PackageBuilder;
+import org.drools.event.DefaultWorkingMemoryEventListener;
+import org.drools.event.ObjectInsertedEvent;
+import org.drools.event.ObjectRetractedEvent;
+import org.drools.event.ObjectUpdatedEvent;
+import org.drools.event.WorkingMemoryEventListener;
+import org.drools.rule.Package;
+import org.drools.util.ObjectHashMap;
+
+public class TruthMaintenanceTest extends TestCase {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+    
+    public void testLogicalInsertions() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertions.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        final Cheese brie = new Cheese( "brie",
+                                        12 );
+        final FactHandle brieHandle = workingMemory.insert( brie );
+
+        final Cheese provolone = new Cheese( "provolone",
+                                             12 );
+        final FactHandle provoloneHandle = workingMemory.insert( provolone );
+
+        workingMemory.fireAllRules();
+
+        assertEquals( 3,
+                      list.size() );
+
+        assertEquals( 3,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.retract( brieHandle );
+
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.retract( provoloneHandle );
+
+        assertEquals( 0,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+    }
+
+    public void testLogicalInsertionsBacking() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsBacking.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Cheese cheese1 = new Cheese( "c",
+                                           1 );
+        final Cheese cheese2 = new Cheese( cheese1.getType(),
+                                           1 );
+        List list;
+
+        final FactHandle h1 = workingMemory.insert( cheese1 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( cheese1.getType().getClass() ) ) );
+        assertEquals( 1,
+                      list.size() );
+        // probably dangerous, as contains works with equals, not identity
+        assertEquals( cheese1.getType(),
+                      list.get( 0 ) );
+        // FactHandle ht = workingMemory.getFactHandle(c1.getType());
+
+        final FactHandle h2 = workingMemory.insert( cheese2 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( cheese1.getType().getClass() ) ) );
+        assertEquals( 1,
+                      list.size() );
+        assertEquals( cheese1.getType(),
+                      list.get( 0 ) );
+        
+        assertEquals( 3, IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.retract( h1 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( cheese1.getType().getClass() ) ) );
+        assertEquals( "cheese-type " + cheese1.getType() + " was retracted, but should not. Backed by cheese2 => type.",
+                      1,
+                      list.size() );
+        assertEquals( "cheese-type " + cheese1.getType() + " was retracted, but should not. Backed by cheese2 => type.",
+                      cheese1.getType(),
+                      list.get( 0 ) );
+
+        workingMemory.retract( h2 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( cheese1.getType().getClass() ) ) );
+        assertEquals( "cheese-type " + cheese1.getType() + " was not retracted, but should have. Neither  cheese1 => type nor cheese2 => type is true.",
+                      0,
+                      list.size() );
+    }
+
+    public void testLogicalInsertionsSelfreferencing() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsSelfreferencing.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List list;
+
+        final Person b = new Person( "b" );
+        final Person a = new Person( "a" );
+
+        workingMemory.setGlobal( "b",
+                                 b );
+
+        FactHandle h1 = workingMemory.insert( a );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( a.getClass() ) ) );
+        assertEquals( 2,
+                      list.size() );
+        assertTrue( list.contains( a ) );
+        assertTrue( list.contains( b ) );
+
+        workingMemory.retract( h1 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( a.getClass() ) ) );
+        assertEquals( "b was retracted, but it should not have. Is backed by b => b being true.",
+                      1,
+                      list.size() );
+        assertEquals( "b was retracted, but it should not have. Is backed by b => b being true.",
+                      b,
+                      list.get( 0 ) );
+
+        h1 = workingMemory.getFactHandle( b );
+        workingMemory.retract( h1 );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( a.getClass() ) ) );
+        assertEquals( 0,
+                      list.size() );
+    }
+
+    public void testLogicalInsertionsLoop() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsLoop.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List list;
+
+        final List l = new ArrayList();
+        final Person a = new Person( "a" );
+        workingMemory.setGlobal( "a",
+                                 a );
+        workingMemory.setGlobal( "l",
+                                 l );
+
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( a.getClass() ) ) );
+        assertEquals( "a still asserted.",
+                      0,
+                      list.size() );
+        assertEquals( "Rule has not fired (looped) expected number of times",
+                      10,
+                      l.size() );
+    }
+
+    public void testLogicalInsertionsNoLoop() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsNoLoop.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List list;
+
+        final List l = new ArrayList();
+        final Person a = new Person( "a" );
+        workingMemory.setGlobal( "a",
+                                 a );
+        workingMemory.setGlobal( "l",
+                                 l );
+
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( a.getClass() ) ) );
+        assertEquals( "a still in WM",
+                      0,
+                      list.size() );
+        assertEquals( "Rule should not loop",
+                      1,
+                      l.size() );
+    }
+
+    public void testLogicalInsertionsWithModify() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsWithUpdate.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+        
+        final WorkingMemoryEventListener l2 = new DefaultWorkingMemoryEventListener() {
+            public void objectInserted(ObjectInsertedEvent event) {
+                System.out.println( event );
+            }
+
+            public void objectRetracted(ObjectRetractedEvent event) {
+                System.out.println( event );
+            }
+
+            public void objectUpdated(ObjectUpdatedEvent event) {
+                System.out.println( event );
+            }
+        };
+        
+        workingMemory.addEventListener( l2 );        
+
+        List l;
+        final Person p = new Person( "person" );
+        p.setAge( 2 );
+        final FactHandle h = workingMemory.insert( p );
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        
+        l = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( CheeseEqual.class ) ) );
+        assertEquals( 1,
+                      l.size() );
+        assertEquals( 2,
+                      ((CheeseEqual) l.get( 0 )).getPrice() );
+
+        workingMemory.retract( h );
+        assertEquals( 0,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        TruthMaintenanceSystem tms = ((InternalWorkingMemory) workingMemory).getTruthMaintenanceSystem();
+
+        final java.lang.reflect.Field field = tms.getClass().getDeclaredField( "assertMap" );
+        field.setAccessible( true );
+        final ObjectHashMap m = (ObjectHashMap) field.get( tms );
+        field.setAccessible( false );
+        assertEquals( "assertMap should be empty",
+                      0,
+                      m.size() );
+    }
+
+    public void testLogicalInsertions2() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertions2.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+//        final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( workingMemory );
+//        logger.setFileName( "logical" );
+
+        final List events = new ArrayList();
+
+        workingMemory.setGlobal( "events",
+                                 events );
+
+        final Sensor sensor = new Sensor( 80,
+                                          80 );
+        final FactHandle handle = workingMemory.insert( sensor );
+
+        // everything should be normal
+        workingMemory.fireAllRules();
+
+        final List list = IteratorToList.convert( workingMemory.iterateObjects() );
+
+        assertEquals( "Only sensor is there",
+                      1,
+                      list.size() );
+        assertEquals( "Only one event",
+                      1,
+                      events.size() );
+
+        // problems should be detected
+        sensor.setPressure( 200 );
+        sensor.setTemperature( 200 );
+        workingMemory.update( handle,
+                                    sensor );
+
+        workingMemory.fireAllRules();
+//        logger.writeToDisk();
+
+        assertEquals( "Only sensor is there",
+                      1,
+                      list.size() );
+        assertEquals( "Exactly seven events",
+                      7,
+                      events.size() );
+    }
+
+    public void testLogicalInsertionsNot() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsNot.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List list;
+
+        final Person a = new Person( "a" );
+        final Cheese cheese = new Cheese( "brie",
+                                          1 );
+        workingMemory.setGlobal( "cheese",
+                                 cheese );
+
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects() );
+        assertEquals( "i was not asserted by not a => i.",
+                      1,
+                      list.size() );
+        assertEquals( "i was not asserted by not a => i.",
+                      cheese,
+                      list.get( 0 ) );
+
+        final FactHandle h = workingMemory.insert( a );
+        // no need to fire rules, assertion alone removes justification for i,
+        // so it should be retracted.
+        // workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects() );
+        assertEquals( "a was not asserted or i not retracted.",
+                      1,
+                      list.size() );
+        assertEquals( "a was asserted.",
+                      a,
+                      list.get( 0 ) );
+        assertFalse( "i was not rectracted.",
+                     list.contains( cheese ) );
+
+        // no rules should fire, but nevertheless...
+        // workingMemory.fireAllRules();
+        assertEquals( "agenda should be empty.",
+                      0,
+                      workingMemory.getAgenda().agendaSize() );
+
+        workingMemory.retract( h );
+        workingMemory.fireAllRules();
+        list = IteratorToList.convert( workingMemory.iterateObjects() );
+        assertEquals( "i was not asserted by not a => i.",
+                      1,
+                      list.size() );
+        assertEquals( "i was not asserted by not a => i.",
+                      cheese,
+                      list.get( 0 ) );
+    }
+
+    public void testLogicalInsertionsNotPingPong() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsNotPingPong.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        // workingMemory.addEventListener(new DebugAgendaEventListener());
+        // workingMemory.addEventListener(new
+        // DebugWorkingMemoryEventListener());
+
+        final List list = new ArrayList();
+
+        final Person person = new Person( "person" );
+        final Cheese cheese = new Cheese( "cheese",
+                                          0 );
+        workingMemory.setGlobal( "cheese",
+                                 cheese );
+        workingMemory.setGlobal( "person",
+                                 person );
+        workingMemory.setGlobal( "list",
+                                 list );
+
+        workingMemory.fireAllRules();
+
+        // not sure about desired state of working memory.
+        assertEquals( "Rules have not fired (looped) expected number of times",
+                      10,
+                      list.size() );
+    }
+
+    public void testLogicalInsertionsDynamicRule() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsDynamicRule.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        org.drools.reteoo.ReteooRuleBase reteooRuleBase = null;
+        // org.drools.leaps.LeapsRuleBase leapsRuleBase = null;
+        final RuleBase ruleBase = getRuleBase();
+        if ( ruleBase instanceof org.drools.reteoo.ReteooRuleBase ) {
+            reteooRuleBase = (org.drools.reteoo.ReteooRuleBase) ruleBase;
+            // } else if ( ruleBase instanceof org.drools.leaps.LeapsRuleBase )
+            // {
+            // leapsRuleBase = (org.drools.leaps.LeapsRuleBase) ruleBase;
+        }
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        // workingMemory.addEventListener(new
+        // org.drools.event.DebugAgendaEventListener());
+        // workingMemory.addEventListener(new
+        // org.drools.event.DebugWorkingMemoryEventListener());
+
+        final Cheese c1 = new Cheese( "a",
+                                      1 );
+        final Cheese c2 = new Cheese( "b",
+                                      2 );
+        final Cheese c3 = new Cheese( "c",
+                                      3 );
+        List list;
+
+        workingMemory.insert( c1 );
+        final FactHandle h = workingMemory.insert( c2 );
+        workingMemory.insert( c3 );
+        workingMemory.fireAllRules();
+
+        // Check logical Insertions where made for c2 and c3
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Person.class) ) );
+        assertEquals( 2,
+                      list.size() );
+        assertFalse( list.contains( new Person( c1.getType() ) ) );
+        assertTrue( list.contains( new Person( c2.getType() ) ) );
+        assertTrue( list.contains( new Person( c3.getType() ) ) );
+
+        // this rule will make a logical assertion for c1 too
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsDynamicRule2.drl" ) );
+        builder = new PackageBuilder();
+        builder.addPackageFromDrl( reader );
+        final Package pkg2 = builder.getPackage();
+        ruleBase.addPackage( pkg2 );
+
+        workingMemory.fireAllRules();
+
+        // check all now have just one logical assertion each
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Person.class) ) );
+        assertEquals( 3,
+                      list.size() );
+        assertTrue( list.contains( new Person( c1.getType() ) ) );
+        assertTrue( list.contains( new Person( c2.getType() ) ) );
+        assertTrue( list.contains( new Person( c3.getType() ) ) );
+
+        // check the packages are correctly populated
+        assertEquals( "org.drools.test",
+                      ruleBase.getPackages()[0].getName() );
+        assertEquals( "org.drools.test2",
+                      ruleBase.getPackages()[1].getName() );
+        assertEquals( "rule1",
+                      ruleBase.getPackages()[0].getRules()[0].getName() );
+        assertEquals( "rule2",
+                      ruleBase.getPackages()[1].getRules()[0].getName() );
+
+        // now remove the first rule
+        if ( reteooRuleBase != null ) {
+            reteooRuleBase.removeRule( ruleBase.getPackages()[0].getName(),
+                                       ruleBase.getPackages()[0].getRules()[0].getName() );
+            // } else if ( leapsRuleBase != null ) {
+            // leapsRuleBase.removeRule( ruleBase.getPackages()[0].getName(),
+            // ruleBase.getPackages()[0].getRules()[0].getName() );
+        }
+
+        // Check the rule was correctly remove
+        assertEquals( 0,
+                      ruleBase.getPackages()[0].getRules().length );
+        assertEquals( 1,
+                      ruleBase.getPackages()[1].getRules().length );
+        assertEquals( "org.drools.test2",
+                      ruleBase.getPackages()[1].getName() );
+        assertEquals( "rule2",
+                      ruleBase.getPackages()[1].getRules()[0].getName() );
+
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Person.class) ) );
+        assertEquals( "removal of the rule should result in retraction of c3's logical assertion",
+                      2,
+                      list.size() );
+        assertTrue( "c1's logical assertion should not be retracted",
+                    list.contains( new Person( c1.getType() ) ) );
+        assertTrue( "c2's logical assertion should  not be retracted",
+                    list.contains( new Person( c2.getType() ) ) );
+        assertFalse( "c3's logical assertion should be  retracted",
+                     list.contains( new Person( c3.getType() ) ) );
+
+        c2.setPrice( 3 );
+        workingMemory.update( h,
+                                    c2 );
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Person.class) ) );
+        assertEquals( "c2 now has a higher price, its logical assertion should  be cancelled",
+                      1,
+                      list.size() );
+        assertFalse( "The logical assertion cor c2 should have been retracted",
+                     list.contains( new Person( c2.getType() ) ) );
+        assertTrue( "The logical assertion  for c1 should exist",
+                    list.contains( new Person( c1.getType() ) ) );
+
+        if ( reteooRuleBase != null ) {
+            reteooRuleBase.removeRule( ruleBase.getPackages()[1].getName(),
+                                       ruleBase.getPackages()[1].getRules()[0].getName() );
+            // } else if ( leapsRuleBase != null ) {
+            // leapsRuleBase.removeRule( ruleBase.getPackages()[1].getName(),
+            // ruleBase.getPackages()[1].getRules()[0].getName() );
+        }
+        assertEquals( 0,
+                      ruleBase.getPackages()[0].getRules().length );
+        assertEquals( 0,
+                      ruleBase.getPackages()[1].getRules().length );
+        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Person.class) ) );
+        assertEquals( 0,
+                      list.size() );
+    }
+
+    public void testLogicalInsertionsUpdateEqual() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsUpdateEqual.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        List l;
+        final Person p = new Person( "person" );
+        p.setAge( 2 );
+        final FactHandle h = workingMemory.insert( p );
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.fireAllRules();
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        l = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( CheeseEqual.class) ) );
+        assertEquals( 1,
+                      l.size() );
+        assertEquals( 3,
+                      ((CheeseEqual) l.get( 0 )).getPrice() );
+
+        workingMemory.retract( h );
+        assertEquals( 0,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        TruthMaintenanceSystem tms = ((InternalWorkingMemory) workingMemory).getTruthMaintenanceSystem();
+
+        final java.lang.reflect.Field field = tms.getClass().getDeclaredField( "assertMap" );
+        field.setAccessible( true );
+        final ObjectHashMap m = (ObjectHashMap) field.get( tms );
+        field.setAccessible( false );
+        assertEquals( "assertMap should be empty",
+                      0,
+                      m.size() );
+    }
+
+    public void testLogicalInsertionsWithExists() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionWithExists.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final Person p1 = new Person( "p1",
+                                      "stilton",
+                                      20 );
+        p1.setStatus( "europe" );
+        final FactHandle c1FactHandle = workingMemory.insert( p1 );
+        final Person p2 = new Person( "p2",
+                                      "stilton",
+                                      30 );
+        p2.setStatus( "europe" );
+        final FactHandle c2FactHandle = workingMemory.insert( p2 );
+        final Person p3 = new Person( "p3",
+                                      "stilton",
+                                      40 );
+        p3.setStatus( "europe" );
+        final FactHandle c3FactHandle = workingMemory.insert( p3 );
+        workingMemory.fireAllRules();
+
+        // all 3 in europe, so, 2 cheese
+        List cheeseList = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 2,
+                      cheeseList.size() );
+
+        // europe=[ 1, 2 ], america=[ 3 ]
+        p3.setStatus( "america" );
+        workingMemory.update( c3FactHandle,
+                                    p3 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 1,
+                      cheeseList.size() );
+
+        // europe=[ 1 ], america=[ 2, 3 ]
+        p2.setStatus( "america" );
+        workingMemory.update( c2FactHandle,
+                                    p2 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 1,
+                      cheeseList.size() );
+
+        // europe=[ ], america=[ 1, 2, 3 ]
+        p1.setStatus( "america" );
+        workingMemory.update( c1FactHandle,
+                                    p1 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 2,
+                      cheeseList.size() );
+
+        // europe=[ 2 ], america=[ 1, 3 ]
+        p2.setStatus( "europe" );
+        workingMemory.update( c2FactHandle,
+                                    p2 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 1,
+                      cheeseList.size() );
+
+        // europe=[ 1, 2 ], america=[ 3 ]
+        p1.setStatus( "europe" );
+        workingMemory.update( c1FactHandle,
+                                    p1 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 1,
+                      cheeseList.size() );
+
+        // europe=[ 1, 2, 3 ], america=[ ]
+        p3.setStatus( "europe" );
+        workingMemory.update( c3FactHandle,
+                                    p3 );
+        workingMemory.fireAllRules();
+        cheeseList = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Cheese.class) ) );
+        assertEquals( 2,
+                      cheeseList.size() );
+    }
+    
+    public void testLogicalInsertions3() throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_logicalInsertions3.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        final List list = new ArrayList();
+        workingMemory.setGlobal( "events",
+                                 list );
+
+        // asserting the sensor object
+        final Sensor sensor = new Sensor( 150,
+                                          100 );
+        final FactHandle sensorHandle = workingMemory.insert( sensor );
+
+        workingMemory.fireAllRules();
+
+        // alarm must sound
+        assertEquals( 2,
+                      list.size() );
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        // modifying sensor
+        sensor.setTemperature( 125 );
+        workingMemory.update( sensorHandle,
+                                    sensor );
+        workingMemory.fireAllRules();
+
+        // alarm must continue to sound
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( 2,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        // modifying sensor
+        sensor.setTemperature( 80 );
+        workingMemory.update( sensorHandle,
+                                    sensor );
+        workingMemory.fireAllRules();
+
+        // no alarms anymore
+        assertEquals( 3,
+                      list.size() );
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+    }
+    
+    public void testLogicalInsertionsAccumulatorPattern() throws Exception {
+        // JBRULES-449
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsAccumulatorPattern.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        workingMemory.setGlobal( "ga", "a");
+        workingMemory.setGlobal( "gb", "b");
+        workingMemory.setGlobal( "gs", new Short((short)3));
+        
+        workingMemory.fireAllRules();
+
+        List l;
+        final FactHandle h = workingMemory.insert( new Integer( 6 ) );
+        assertEquals( 1,
+                      IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.fireAllRules();
+        l = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( CheeseEqual.class) ) );
+        assertEquals( "There should be 2 CheeseEqual in Working Memory, 1 justified, 1 stated", 2, l.size() );
+        assertEquals( 6, IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+
+        workingMemory.retract( h );
+        l = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( CheeseEqual.class) ) );
+        assertEquals( "There should be only 1 CheeseEqual in Working Memory, 1 stated (the justified should have been retracted). Check TruthMaintenanceSystem justifiedMap", 1, l.size() );
+        l = IteratorToList.convert( workingMemory.iterateObjects(new ClassObjectFilter( Short.class) ) );
+        assertEquals( 1, l.size() );
+        assertEquals( 2, IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+        
+        //clean-up
+        workingMemory.fireAllRules();
+        assertEquals( 0, IteratorToList.convert( workingMemory.iterateObjects() ).size() );
+    }    
+    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/AbstractEventListener.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/AbstractEventListener.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/AbstractEventListener.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator;
+
+import org.drools.WorkingMemory;
+
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public abstract class AbstractEventListener {
+
+	WorkingMemory wm;
+	
+	/**
+	 * @param wm
+	 */
+	public AbstractEventListener(WorkingMemory wm) {
+		this.wm = wm;
+	}
+
+	public void addEventToWM (Object event){
+		wm.insert(event);
+		wm.fireAllRules();	
+	}
+	
+	// send generated event and execute corresponding actions
+	public abstract void generatedEventSent(Object event);
+	
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/EVENT_TYPE.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/EVENT_TYPE.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/EVENT_TYPE.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.integrationtests.eventgenerator;
+
+import org.drools.integrationtests.eventgenerator.example.CheeseEvent;
+import org.drools.integrationtests.eventgenerator.example.PersonEvent;
+
+/**
+ * This enum represents all engine supported clocks
+ * 
+ * @author mgroch
+ */
+public enum EVENT_TYPE {
+
+	  /**
+	   * A System clock is a clock that returns the time based on the underlying
+	   * system clock. It is usually used for real time applications
+	   */
+	  PERSON_EVENT {
+		  public PersonEvent createInstance() {
+	          return new PersonEvent();
+	    	  //return SessionSystemClock.getInstance();
+	      }
+	  },
+	  
+	  /**
+	   * A Pseudo clock is a clock that is completely controlled by the
+	   * client application. It is usually used during simulations or tests
+	   */
+	  CHEESE_EVENT {
+	      public CheeseEvent createInstance() {
+	          return new CheeseEvent();
+	    	  //return SessionPseudoClock.getInstance();
+	      }
+	  };
+	  
+	  public abstract Object createInstance();
+	  
+	}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/Event.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/Event.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/Event.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,163 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class Event implements Cloneable{
+	
+	public enum EventType {CUSTOM, PRODUCTION, STATUSCHANGED, HEARTBEAT, FAILURE};
+	
+	private EventType eventId;
+	private String parentId;
+	private Map<String,String> parameters;
+	private long startTime, endTime;
+	
+	public Event() {
+		this.parameters = new HashMap <String, String>();
+	}
+
+	/**
+	 * @param eventId The name of the event.
+	 * @param parentId The id of the corresponding site, resource, ...
+	 */
+	public Event(EventType eventId, String parentId) {
+		this();
+		this.eventId = eventId;
+		this.parentId = parentId;
+	}
+	
+	/**
+	 * @param eventId The name of the event.
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 */
+	public Event(EventType eventId, String parentId, long start, long end) {
+		this(eventId, parentId);
+		this.startTime = start;
+		this.endTime = end;
+	}
+	
+	/**
+	 * @return the event id
+	 */
+	public EventType getEventId() {
+		return this.eventId;
+	}
+
+	/**
+	 * @param eventId the event name to set
+	 */
+	public void setEventType(EventType eventId) {
+		this.eventId = eventId;
+	}
+	
+	/**
+	 * @return the endTime
+	 */
+	public long getEndTime() {
+		return endTime;
+	}
+
+	/**
+	 * @param endTime the endTime to set
+	 *//*
+	public void setEndTime(Calendar endTime) {
+		this.endTime = (Calendar)endTime.clone();
+	}*/
+
+	/**
+	 * @return the startTime
+	 */
+	public long getStartTime() {
+		return startTime;
+	}
+
+	/**
+	 * @param startTime the startTime to set
+	 *//*
+	public void setStartTime(Calendar startTime) {
+		this.startTime = (Calendar)startTime.clone();
+	}*/
+	
+	/**
+	 * @param startTime the startTime to set
+	 * @param endTime the endTime to set
+	 */
+	public void setTimes(long startTime, long endTime) {
+		this.startTime = startTime;
+		this.endTime = endTime;
+	}
+	
+	/**
+	 * @param startTime the startTime to set
+	 * @param endTime the endTime to set
+	 */
+	// used for primitive events where start end end time are equal
+	public void setTimes(long startAndEndTime) {
+		this.startTime = startAndEndTime;
+		this.endTime = startAndEndTime;
+	}
+
+	/**
+	 * @return the parentId
+	 */
+	public String getParentId() {
+		return parentId;
+	}
+
+	/**
+	 * @param ressourceId the ressourceId to set
+	 */
+	public void setParentId(String parentId) {
+		this.parentId = parentId;
+	}
+
+	/**
+	 * @return the parameters
+	 */
+	public Map<String, String> getParameters() {
+		return parameters;
+	}
+	
+	/**
+	 * @param parameter name of the parameter
+	 * @return value of the specified parameter
+	 */
+	public String getParamValue(String parameter) {
+		return parameters.get(parameter);
+	}
+	
+	/**
+	 * @param parameters the parameters to set
+	 */
+	public void addParameters(Map<String, String> parameters) {
+		this.parameters.putAll(parameters);
+	}
+	
+	/**
+	 * @param paramName the name of the added parameter to set
+	 * @param paramValue the value of the added parameter to set
+	 */
+	public void addParameter(String paramName, String paramValue) {
+		this.parameters.put(paramName, paramValue);
+	}
+	
+	public Object clone(){
+	    try
+	    {
+	      return super.clone();
+	    }
+	    catch ( CloneNotSupportedException e ) {
+	      // this shouldn’t happen, since we are Cloneable
+	      throw new InternalError();
+	    }
+	  }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventGenerator.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventGenerator.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventGenerator.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,236 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.log4j.Logger;
+import org.drools.temporal.AbstractSessionClock;
+
+
+public class SimpleEventGenerator {
+	
+	private final Logger myLogger = Logger.getLogger(SimpleEventGenerator.class.getName());
+	
+	private long generationEndTime;
+	private AbstractEventListener sendListener;
+	private boolean endInfinite;
+	private int eventSourceIdCounter;
+	private Map<String, Integer> eventSourceIds;
+	private LinkedList<EventOccurrence> nextEventSource;
+	private AbstractSessionClock myClock;
+	
+	
+	/**
+	 * @param wm
+	 */
+	public SimpleEventGenerator(AbstractSessionClock clock, AbstractEventListener l) {
+		this (clock, l, 0);
+	}
+	
+	/**
+	 * @param wm
+	 * @param generationDuration
+	 * 
+	 */
+	public SimpleEventGenerator(AbstractSessionClock clock, AbstractEventListener l, long generationDuration) {
+		this.sendListener = l;
+		// add session clock to working memory
+		this.myClock = clock;
+		//this.clockHandle = wm.insert(myClock);
+		
+		this.generationEndTime = this.myClock.calcFuturePointInTime(generationDuration);
+		this.endInfinite = (generationDuration == 0);
+		this.eventSourceIdCounter = 0;
+		this.eventSourceIds = new HashMap<String, Integer>();
+		this.nextEventSource = new LinkedList<EventOccurrence>();
+	}
+	
+	/**
+	 * @return the endInfinite
+	 */
+	public boolean isEndInfinite() {
+		return endInfinite;
+	}
+	
+	// add source which will generate events from current clock time on, possibly forever (i.e. no boundaries)
+	public EventOccurrence addEventSource(String id, EVENT_TYPE evType, long minOccur, long avgOccur){
+		return addEventSource (id, evType, minOccur, avgOccur, 0, 0);
+	}
+	
+	// add source which will generate events from current clock time on, but only maxItems instances at the most AND not exceeding the time specified by maxDuration
+	public EventOccurrence addEventSource(String id, EVENT_TYPE evType, long minOccur, long avgOccur, long maxDuration, int maxItems){
+		if (!eventSourceIds.containsKey(id)){
+			this.eventSourceIds.put(id, new Integer(eventSourceIdCounter++));
+			EventOccurrence evOcc = new EventOccurrence(id, evType, minOccur, avgOccur, this.myClock.getCurrentTime(), maxDuration, maxItems);
+			this.nextEventSource.add (evOcc);
+			return evOcc;
+		}
+		return null;
+	}
+	
+	// add source which will generate events from the given start time on, possibly forever (i.e. no boundaries)
+	public EventOccurrence addDelayedEventSource(String id, EVENT_TYPE evType, long minOccur, long avgOccur, long startTime){
+		return addDelayedEventSource (id, evType, minOccur, avgOccur, startTime, 0, 0);
+	}
+	
+	// add source which will generate events from the given start time on, but only maxItems instances at the most AND not exceeding the time specified by maxDuration
+	public EventOccurrence addDelayedEventSource(String id, EVENT_TYPE evType, long minOccur, long avgOccur, long startTime, long maxDuration, int maxItems){
+		if (!eventSourceIds.containsKey(id)){
+			this.eventSourceIds.put(id, new Integer(eventSourceIdCounter++));
+			EventOccurrence evOcc = new EventOccurrence(id, evType, minOccur, avgOccur, startTime, maxDuration, maxItems);
+			this.nextEventSource.add (evOcc);
+			return evOcc;
+		}
+		return null;
+	}
+	
+	public void removeEventSource(String id){
+		Integer hashValue = eventSourceIds.get(id);
+		if (hashValue != null){
+			this.nextEventSource.remove(hashValue.intValue());
+			this.eventSourceIds.remove(id);
+			this.eventSourceIdCounter--;
+		}
+	}
+	
+	public void sendGeneratedEvent(Object ev){
+		sendListener.generatedEventSent(ev);
+	}
+	
+
+	public void generate() {
+		EventOccurrence currentEGT;
+		
+		//sort all events according to their first occurrence
+		Collections.sort(nextEventSource, new EventGenerationTimeComparator());
+		
+		// simulate ongoing simulation time and upcoming events
+		while (!nextEventSource.isEmpty()) {
+			
+			// get next event generation time from queue
+			currentEGT = nextEventSource.removeFirst();
+			
+			// advance clock to time of currentEGT 
+			myClock.jumpTo(currentEGT.getNextOccurrenceTime());
+			
+			// send event corresponding to currentEGT
+			sendGeneratedEvent(currentEGT.createNewEvent());
+			//System.out.println ("Sender "+currentEGT.getEventSenderId() + ": Sent "+currentEvent.getEventId()+" event for parent id " + currentEvent.getParentId() + " at " + Tools.formattedDate(currentEGT.getNextOccurrenceTime()));
+			
+			// determine new event generation time for this event type
+			boolean occIsValid = currentEGT.calculateNextEventOccurrence();
+			// add the new generation time to the right position in the queue, 
+			// but only if the generated event met its local restrictions plus
+			// it is going to occur within the global time boundaries (or there are no such boundaries, respectively)
+			if (occIsValid && (isEndInfinite() || currentEGT.getNextOccurrenceTime() < this.generationEndTime)) {
+				int index = Collections.binarySearch(nextEventSource, currentEGT, new EventGenerationTimeComparator());
+				if (index < 0)
+					nextEventSource.add(-index-1, currentEGT);
+			}
+			//session.out.print ("\nQueue nach Bearbeitung: ");
+			//for (int i = 0; i < nextEventSource.size(); i++)
+			//	session.out.print (Tools.formattedDate(nextEventSource.get(i).getGenerationTime())+"\""+nextEventSource.get(i).getEventSenderId()+"; ");
+
+		};
+		
+		myLogger.debug ("\nSending of messages finished");
+	}
+	
+}
+
+class EventOccurrence{
+	
+	private final Logger myLogger = Logger.getLogger(EventOccurrence.class.getName());
+	private static Random myRandom = new Random();;
+	
+	private String eventSenderId;
+	private EVENT_TYPE evType;
+	private long evDeviation, evMinDur;
+	private int itemCounter, maxItems;
+	private long nextOccurrence;
+	private long latestEnd;
+	private boolean infinite;
+	
+	public EventOccurrence(String eventSenderId, EVENT_TYPE evType, long evMinDur, long avgOccur, long earliestStart, long maxDuration, int maxItems) {
+		this.eventSenderId = eventSenderId;
+		this.evType = evType;
+		this.evMinDur = evMinDur;
+		this.evDeviation = 2*(avgOccur-evMinDur); 
+		this.nextOccurrence = earliestStart;
+		this.latestEnd = earliestStart+maxDuration;
+		this.maxItems = maxItems;
+		this.itemCounter = 0;
+		this.infinite = maxDuration<=0;
+		calculateNextEventOccurrence();
+	}
+
+	// returns true if event source has no boundaries or all restrictions (i.e. a generation duration or max. number of event instances) are met, false otherwise
+	public boolean calculateNextEventOccurrence (){
+		
+		// if only a maximum number of events should be created, count them; 
+		// if maximum number of items has been reached already, return fasle
+		if (maxItems > 0){
+			this.itemCounter++;
+			if (this.itemCounter>this.maxItems)
+				return false;
+		}
+		
+		// calculate next event occurrence time
+		this.nextOccurrence = (this.nextOccurrence+myRandom.nextInt((int)this.evDeviation)+this.evMinDur);
+		
+		// return calculated occurrence time  if restrictions are met
+		if (isInfinite() || this.nextOccurrence < this.latestEnd)
+			return true;
+		
+		// if above restrictions are not met, return null
+		return false;
+	}
+	
+	/**
+	 * @return the infinite
+	 */
+	private boolean isInfinite() {
+		return infinite;
+	}
+	
+	/**
+	 * @return the eventSenderId
+	 */
+	public String getEventSenderId() {
+		return eventSenderId;
+	}
+
+	/**
+	 * @return the time
+	 */
+	public long getNextOccurrenceTime() {
+		return this.nextOccurrence;
+	}
+	
+	public Object createNewEvent(){
+		Object newEvent = this.evType.createInstance();
+		myLogger.info ("\n"+AbstractSessionClock.millisecsToString(this.nextOccurrence)+": Created new event: "+newEvent.toString());
+		return newEvent;
+	}
+	
+}
+
+class EventGenerationTimeComparator implements Comparator<EventOccurrence>{
+
+	public int compare(EventOccurrence o1, EventOccurrence o2) {
+		return (int)(o1.getNextOccurrenceTime()-o2.getNextOccurrenceTime());
+	}
+	
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventListener.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventListener.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/SimpleEventListener.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator;
+
+import org.drools.WorkingMemory;
+
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class SimpleEventListener extends AbstractEventListener {
+
+	public SimpleEventListener(WorkingMemory wm) {
+		super(wm);
+		// TODO Auto-generated constructor stub
+	}
+
+	/* (non-Javadoc)
+	 * @see com.event.AbstractEventListener#generatedEventSent(com.event.Event)
+	 */
+	@Override
+	public void generatedEventSent(Object event) {
+		addEventToWM(event);
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/CheeseEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/CheeseEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/CheeseEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,129 @@
+package org.drools.integrationtests.eventgenerator.example;
+
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Random;
+
+import org.apache.log4j.Logger;
+import org.drools.integrationtests.AccumulateEventTest_pseudoClock;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class CheeseEvent
+    implements
+    Serializable {
+
+	private final Logger myLogger = Logger.getLogger(AccumulateEventTest_pseudoClock.class.getName());;
+	private static Random myRandom = new Random();
+	private static String[] cheeseType = {"stilton", "provolone", "brie"};
+	
+    /**
+     *
+     */
+    private static final long serialVersionUID = 400L;
+    private String            type;
+    private int               price;
+    private int               oldPrice;
+    private Date              usedBy;
+
+    // create cheese event with random type and random price
+    public CheeseEvent() {
+    	this(getRandomType(), getRandomPrice());
+    }
+
+    public CheeseEvent(final String type,
+                  final int price) {
+        super();
+        this.type = type;
+        this.price = price;
+    }
+
+    public CheeseEvent(final String type,
+                  final int price,
+                  final int oldPrice ) {
+        super();
+        this.type = type;
+        this.price = price;
+        this.oldPrice = oldPrice;
+    }
+
+    public int getPrice() {
+        return this.price;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public void setPrice(final int price) {
+        this.price = price;
+    }
+
+    public String toString() {
+        return "Cheese( type='" + this.type + "', price=" + this.price + " )";
+    }
+
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + price;
+        result = PRIME * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final CheeseEvent other = (CheeseEvent) obj;
+        if ( price != other.price ) return false;
+        if ( type == null ) {
+            if ( other.type != null ) return false;
+        } else if ( !type.equals( other.type ) ) return false;
+        return true;
+    }
+
+    public int getOldPrice() {
+        return oldPrice;
+    }
+
+    public void setOldPrice(int oldPrice) {
+        this.oldPrice = oldPrice;
+    }
+
+    public Date getUsedBy() {
+        return usedBy;
+    }
+
+    public void setUsedBy(Date usedBy) {
+        this.usedBy = usedBy;
+    }
+
+    private static int getRandomPrice(){
+    	return myRandom.nextInt(91)+10;
+    }
+    
+    public static String getRandomType(){
+    	return cheeseType[myRandom.nextInt(cheeseType.length)];
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/PersonEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/PersonEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/PersonEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,246 @@
+package org.drools.integrationtests.eventgenerator.example;
+
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.drools.PersonInterface;
+import org.drools.integrationtests.AccumulateEventTest_pseudoClock;
+
+public class PersonEvent
+    implements
+    Serializable,
+    PersonInterface {
+    /**
+     * 
+     */
+	
+	private final Logger myLogger = Logger.getLogger(PersonEvent.class.getName());
+	
+    private static final long serialVersionUID = 400L;
+    
+    private static int uniqueIdCounter = 0;
+    
+    private String            name;
+    private String            likes;
+    private int               age;
+    private BigDecimal        bigDecimal;
+    private BigInteger        bigInteger;
+    private String            hair;
+
+    private char              sex;
+
+    private boolean           alive;
+
+    private String            status;
+
+
+    private List              addresses = new ArrayList();
+    
+    public List getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List addresses) {
+        this.addresses = addresses;
+    }
+
+    // create person with unique name and random favorite cheese
+    public PersonEvent() {
+    	this("person"+(++uniqueIdCounter), CheeseEvent.getRandomType());
+    }
+
+    public PersonEvent(String name,
+                  int age) {
+        super();
+        this.name = name;
+        this.age = age;
+    }
+
+    public PersonEvent(final String name) {
+        this( name,
+              "",
+              0 );
+    }
+
+    public PersonEvent(final String name,
+                  final String likes) {
+        this( name,
+              likes,
+              0 );
+    }
+
+    public PersonEvent(final String name,
+                  final String likes,
+                  final int age) {
+        this.name = name;
+        this.likes = likes;
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getStatus()
+     */
+    public String getStatus() {
+        return this.status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setStatus(java.lang.String)
+     */
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getLikes()
+     */
+    public String getLikes() {
+        return this.likes;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getAge()
+     */
+    public int getAge() {
+        return this.age;
+    }
+
+    public void setAge(final int age) {
+        this.age = age;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#isAlive()
+     */
+    public boolean isAlive() {
+        return this.alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setAlive(boolean)
+     */
+    public void setAlive(final boolean alive) {
+        this.alive = alive;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getSex()
+     */
+    public char getSex() {
+        return this.sex;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setSex(char)
+     */
+    public void setSex(final char sex) {
+        this.sex = sex;
+    }
+
+    public String getHair() {
+        return this.hair;
+    }
+
+    public void setHair(final String hair) {
+        this.hair = hair;
+    }
+
+    public String toString() {
+        return "Person ( name='" + this.name + "', likes ='" + this.likes + "' )";
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + this.age;
+        result = PRIME * result + (this.alive ? 1231 : 1237);
+        result = PRIME * result + ((this.name == null) ? 0 : this.name.hashCode());
+        result = PRIME * result + this.sex;
+        return result;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean equals(final Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final PersonEvent other = (PersonEvent) obj;
+        if ( this.age != other.age ) {
+            return false;
+        }
+        if ( this.alive != other.alive ) {
+            return false;
+        }
+        if ( this.name == null ) {
+            if ( other.name != null ) {
+                return false;
+            }
+        } else if ( !this.name.equals( other.name ) ) {
+            return false;
+        }
+        if ( this.sex != other.sex ) {
+            return false;
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigDecimal()
+     */
+    public BigDecimal getBigDecimal() {
+        return this.bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigDecimal(java.math.BigDecimal)
+     */
+    public void setBigDecimal(final BigDecimal bigDecimal) {
+        this.bigDecimal = bigDecimal;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#getBigInteger()
+     */
+    public BigInteger getBigInteger() {
+        return this.bigInteger;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.PersonInterface#setBigInteger(java.math.BigInteger)
+     */
+    public void setBigInteger(final BigInteger bigInteger) {
+        this.bigInteger = bigInteger;
+    }
+
+    public void setLikes(final String likes) {
+        this.likes = likes;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ExampleScenario_FIXME.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ExampleScenario_FIXME.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ExampleScenario_FIXME.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,132 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.integrationtests.eventgenerator.SimpleEventGenerator;
+import org.drools.integrationtests.eventgenerator.SimpleEventListener;
+import org.drools.rule.Package;
+import org.drools.temporal.SessionPseudoClock;
+
+
+public class ExampleScenario_FIXME {
+	
+	// constants
+	public final static String FILE_NAME_RULES = "../example_scenario.drl";
+	//public final static String FILE_NAME_LOGGER = "log/event";
+	private static int NUMBER_RESOURCES = 3;
+	
+	// event occurrence probabilities 
+	public final static int AVG_OCCUR_PRODUCTION_EVENT = 7000; // average time in milliseconds after which another item is manufactured by one resource; default: 700 ms
+	public final static int MIN_OCCUR_PRODUCTION_EVENT = 4000; // minimum time in milliseconds after which another item is manufactured by one resource; default: 700 ms
+	public final static int AVG_OCCUR_HEARTBEAT_EVENT = 90000; // average time in milliseconds after which a resource sends another heartbeat; default: 60000 ms
+	public final static int MIN_OCCUR_HEARTBEAT_EVENT = 45000; // average time in milliseconds after which a resource sends another heartbeat; default: 60000 ms
+	public final static int AVG_OCCUR_ALERT_EVENT = 1800000; // average time in milliseconds after which an alarm is sent; default: 1800000 = 30 mis
+	public final static int MIN_OCCUR_ALERT_EVENT = 0; // average time in milliseconds after which an alarm is sent; default: 1800000 = 30 mis
+	
+	private static WorkingMemory wm;
+	//private static WorkingMemoryFileLogger logger;
+	
+	public static void setup(){
+		// read in the source
+		Reader source = new InputStreamReader (ExampleScenario_FIXME.class.getResourceAsStream(FILE_NAME_RULES));
+		// Use package builder to build up a rule package.
+		// An alternative lower level class called DrlParser can also be used ...
+		PackageBuilder builder = new PackageBuilder();
+		// this will parse and compile in one step
+		// NOTE: There are 2 methods here, the one argument one is for normal DRL.
+		try {
+				builder.addPackageFromDrl(source);
+		} catch (DroolsParserException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		// get the compiled package (which is serializable)
+		Package pkg = builder.getPackage();
+		
+		// add defined object types
+		//FactTemplate ftEvent = new FactTemplateImpl();
+		//pkg.addFactTemplate(ftEvent);
+		
+		//	add the package to a rulebase (deploy the rule package).
+		RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+		try {
+			ruleBase.addPackage (pkg);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		wm = ruleBase.newStatefulSession();
+		// create a new Working Memory Logger, that logs to file.
+	    //logger = new WorkingMemoryFileLogger(wm);
+	    // an event.log file is created in the log dir (which must exist)
+	    // in the working directory
+	    //logger.setFileName(FILE_NAME_LOGGER);
+	}
+	
+	public static final void main (String[] args) {
+		   
+		setup();
+		
+		System.out.println("Waiting for messages...");
+        System.out.println("Press [return] to quit\n");
+        
+        ArrayList<Resource> resources = new ArrayList<Resource>();
+        
+        // 
+        SimpleEventGenerator myGenerator =  new SimpleEventGenerator(new SessionPseudoClock(), new SimpleEventListener(wm), SessionPseudoClock.timeInMinutes(15));
+        
+        //create fab resources and add them to working memory
+		for (int i = 0; i < NUMBER_RESOURCES; i++){
+			
+			Resource res = new Resource("mach"+i);
+			resources.add(res);
+			wm.insert(res.getOpStatus());
+			
+			SlidingWindow sw = new SlidingWindow(0, res.getId(), SessionPseudoClock.timeInMinutes(10), SessionPseudoClock.timeInMinutes(2));
+			//GlobalWorkingMemory.getInstance().insert(new Event(Event.SLIDING_WINDOW, res.getId(), systemTime, systemTime));
+			wm.insert(sw);
+			
+			// add eventSenders to EventGenerator
+			
+			/*FIXME 
+			myGenerator.addEventSource("Conveyor"+i, new ProductionEvent(res.getId()), MIN_OCCUR_PRODUCTION_EVENT, AVG_OCCUR_PRODUCTION_EVENT, 0, 0);
+			*/
+		}
+		
+		// start generating events
+        myGenerator.generate();
+        
+        BufferedReader waiter = new BufferedReader(new InputStreamReader(System.in));
+        try {
+			waiter.readLine();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        // stop logging
+        //logger.writeToDisk();
+        //System.out.println("Application terminated - Audit log written to disk");
+	
+	}
+		
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/FailureEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/FailureEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/FailureEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import org.drools.integrationtests.eventgenerator.Event;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class FailureEvent extends Event {
+	
+	/**
+	 * Special constructor for a failure event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 */
+	public FailureEvent(String parentId) {
+		super(EventType.FAILURE, parentId);
+	}
+	
+	/**
+	 * Special constructor for a faliure event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 * @param parameters The event parameters.
+	 */
+	public FailureEvent(String parentId, long start, long end) {
+		super(EventType.FAILURE, parentId, start, end);
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/HeartbeatEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/HeartbeatEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/HeartbeatEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import org.drools.integrationtests.eventgenerator.Event;
+
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class HeartbeatEvent extends Event {
+	
+	/**
+	 * Special constructor for a heartbeat event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 */
+	public HeartbeatEvent(String parentId) {
+		super(EventType.HEARTBEAT, parentId);
+	}
+	
+	/**
+	 * Special constructor for a heartbeat event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 * @param parameters The event parameters.
+	 */
+	public HeartbeatEvent(String parentId, long start, long end) {
+		super(EventType.HEARTBEAT, parentId, start, end);
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ProductionEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ProductionEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/ProductionEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import org.drools.integrationtests.eventgenerator.Event;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class ProductionEvent extends Event {
+	
+	/**
+	 * Special constructor for a production event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 */
+	public ProductionEvent(String parentId) {
+		super(EventType.PRODUCTION, parentId);
+	}
+	
+	/**
+	 * Special constructor for a production event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 * @param parameters The event parameters.
+	 */
+	public ProductionEvent(String parentId, long start, long end) {
+		super(EventType.PRODUCTION, parentId, start, end);
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Resource.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Resource.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Resource.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,121 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import java.util.Calendar;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class Resource {
+	
+	public static final String[] OPERATIONAL_STATUS_VALUES = {"RED", "YELLOW", "GREEN"};
+	
+	public static final int STATUS_RED = 0;
+	public static final int STATUS_YELLOW = 1;
+	public static final int STATUS_GREEN = 2;
+	
+	private static int idCounter = 0;
+	
+	private String id;
+	private String name;
+	private double pressure, temperature;
+	private Calendar lastHeartBeat;
+	private Status opStatus;
+	
+	public Resource(String name) {
+		this.id = String.valueOf(idCounter++);
+		this.name = name;
+		this.pressure = 0;
+		this.temperature = 0;
+		this.lastHeartBeat = null;
+		this.opStatus = new Status(Status.OPERATIONAL, this.id, OPERATIONAL_STATUS_VALUES, STATUS_RED);
+	}
+
+	/**
+	 * @return the id
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * @param id the id to set
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * @return the resource type
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * @param type the resource type to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * @return the opStatus
+	 */
+	public Status getOpStatus() {
+		return opStatus;
+	}
+
+	/**
+	 * @param opStatus the opStatus to set
+	 */
+	public void setOpStatus(Status status) {
+		this.opStatus = status;
+	}
+
+	/**
+	 * @return the pressure
+	 */
+	public double getPressure() {
+		return pressure;
+	}
+
+	/**
+	 * @param pressure the pressure to set
+	 */
+	public void setPressure(double pressure) {
+		this.pressure = pressure;
+	}
+
+	/**
+	 * @return the temperature
+	 */
+	public double getTemperature() {
+		return temperature;
+	}
+
+	/**
+	 * @param temperature the temperature to set
+	 */
+	public void setTemperature(double temperature) {
+		this.temperature = temperature;
+	}
+
+	/**
+	 * @return the lastHeartBeat
+	 */
+	public Calendar getLastHeartBeat() {
+		return lastHeartBeat;
+	}
+
+	/**
+	 * @param lastHeartBeat the lastHeartBeat to set
+	 */
+	public void setLastHeartBeat(Calendar lastHeartBeat) {
+		this.lastHeartBeat = lastHeartBeat;
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SimpleEventGeneratorTest_FIXME.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SimpleEventGeneratorTest_FIXME.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SimpleEventGeneratorTest_FIXME.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,169 @@
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.integrationtests.eventgenerator.Event.EventType;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.temporal.SessionPseudoClock;
+
+
+public class SimpleEventGeneratorTest_FIXME extends TestCase {
+	
+	private final static String TEST_RULE_FILE = "test_eventGenerator.drl";
+	
+	protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+	
+	private RuleBase loadRuleBase(final Reader reader) throws IOException,
+	    DroolsParserException,
+	    Exception {
+		final DrlParser parser = new DrlParser();
+		final PackageDescr packageDescr = parser.parse( reader );
+		if ( parser.hasErrors() ) {
+			System.out.println( parser.getErrors() );
+			Assert.fail( "Error messages in parser, need to sort this our (or else collect error messages)" );
+		}
+		// pre build the package
+		final PackageBuilder builder = new PackageBuilder();
+		builder.addPackage( packageDescr );
+		final Package pkg = builder.getPackage();
+	
+		// add the package to a rulebase
+		final RuleBase ruleBase = getRuleBase();
+		ruleBase.addPackage( pkg );
+		// load up the rulebase
+		return ruleBase;
+	}
+    
+	/*public void testEventGenerationMaxItems() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate 10 events, starting from the session clock
+		myGenerator.addEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), 0, 10);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), 10);
+	}
+	
+	public void testEventGenerationMaxTime() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate events for 1 min, starting from the session clock
+		myGenerator.addEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(1), 0);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), wm.getQueryResults("all inserted events with generation time < 1 min").size());
+	}
+	
+	public void testEventGenerationMaxTimeAndMaxItems() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate at most 10 events not exceeding 1 min, starting from the session clock
+		myGenerator.addEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(1), 10);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), wm.getQueryResults("all inserted events with generation time < 1 min").size());
+		assertTrue(wm.getQueryResults("all inserted events with generation time < 1 min").size()<=10);
+	}
+	
+	public void testEventGenerationDelayedMaxItems() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate 10 events, delayed by 2 minutes from start session clock 
+		myGenerator.addDelayedEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(2), 0, 10);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), 10);
+	}
+	
+	public void testEventGenerationDelayedMaxTime() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate events for 1 min, delayed by 2 minutes from start session clock
+		myGenerator.addDelayedEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(2), SessionPseudoClock.timeInMinutes(1), 0);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), wm.getQueryResults("all inserted events with 2 min < generation time < 3 min").size());
+	}
+	
+	public void testEventGenerationDelayedMaxTimeAndMaxItems() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate at most 10 events not exceeding 1 min, delayed by 2 minutes from start session clock
+		myGenerator.addDelayedEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(2), SessionPseudoClock.timeInMinutes(1), 10);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), wm.getQueryResults("all inserted events with 2 min < generation time < 3 min").size());
+		assertTrue(wm.getQueryResults("all inserted events with 2 min < generation time < 3 min").size()<=10);
+	}
+	
+	public void testEventGenerationGlobalMaxTime() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm), SessionPseudoClock.timeInMinutes(1));
+		// generate events for 1 min, starting from the session clock
+		myGenerator.addEventSource("Conveyor1", new Event(EventType.CUSTOM, null), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), SessionPseudoClock.timeInMinutes(3), 0);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events").size(), wm.getQueryResults("all inserted events with generation time < 1 min").size());
+	}
+	
+	public void testEventGenerationMultipleSources() throws DroolsParserException, IOException, Exception{
+		final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+		final WorkingMemory wm = ruleBase.newStatefulSession();
+		final SimpleEventGenerator myGenerator;
+		
+		// create unrestricted event generator
+		myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
+		// generate 15 events with parent resource A and 20 events with parent resource B
+		myGenerator.addEventSource("Conveyor1", new Event(EventType.CUSTOM, "resA"), SessionPseudoClock.timeInSeconds(4), SessionPseudoClock.timeInSeconds(6), 0, 15);
+		myGenerator.addEventSource("Conveyor2", new Event(EventType.CUSTOM, "resB"), SessionPseudoClock.timeInSeconds(3), SessionPseudoClock.timeInSeconds(5), 0, 20);
+		myGenerator.generate();
+		assertEquals(wm.getQueryResults("all inserted events with parent resource A").size(), 15);
+		assertEquals(wm.getQueryResults("all inserted events with parent resource B").size(), 20);
+	}*/
+	
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SlidingWindow.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SlidingWindow.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/SlidingWindow.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,312 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class SlidingWindow {
+	
+	// Sliding window states names
+	public static final String[] SW_STATES = {"Default", "Collecting", "Evaluating", "Advancing"};
+	
+	public static final int DEFAULT = 0;
+	public static final int COLLECT = 1;
+	public static final int EVALUATE = 2;
+	public static final int ADVANCE = 3;
+	
+	private static int idCounter = 0;
+	
+	private int id, state;
+	private boolean readyToEvaluate;
+	private String parentId;
+	private long windowStart, windowEnd, lastUpdate;
+	private long windowLength, windowShift;
+	//private List<Event> eventsInWindow;
+	int numberEvents;
+	/*private int defectiveFridgesCount, defectiveFreezersCount;
+	private int workingFridgesCount, workingFreezersCount;*/
+	
+	public SlidingWindow(long wStart, String parentId, long windowLength, long windowShift) {
+		this.id = idCounter++;
+		this.readyToEvaluate = false;
+		this.state = DEFAULT;
+		this.parentId = parentId;
+		this.windowStart = wStart;
+		this.windowEnd = this.windowStart + windowLength;
+		this.lastUpdate = wStart;
+		this.windowLength = windowLength;
+		this.windowShift = windowShift;
+		//this.eventsInWindow = new ArrayList<Event>();
+		this.numberEvents = 0;
+		//System.out.println ("Sliding window "+this.id+" expires at "+Tools.formattedDate(this.windowEnd));
+	}
+
+	/**
+	 * @return the id
+	 */
+	public String getId() {
+		return "sw"+id;
+	}
+	
+	public long getWindowStart() {
+		return windowStart;
+	}
+	
+	public void setWindowStart(long start) {
+		this.windowStart = start;
+	}
+	
+	public long getWindowEnd() {
+		return windowEnd;
+	}
+	
+	public void setWindowEnd(long end) {
+		this.windowEnd = end;
+	}
+
+	/**
+	 * @return the windowLength
+	 */
+	public long getWindowLength() {
+		return windowLength;
+	}
+
+	/**
+	 * @param windowLength the windowLength to set
+	 */
+	public void setWindowLength(int windowLength) {
+		this.windowLength = windowLength;
+	}
+
+	/**
+	 * @return the shift
+	 */
+	public long getWindowShift() {
+		return windowShift;
+	}
+
+	/**
+	 * @param shift the shift to set
+	 */
+	public void setShift(int windowShift) {
+		this.windowShift = windowShift;
+	}
+
+	/**
+	 * @return the numberEvents
+	 */
+	public int getNumberEvents() {
+		return numberEvents;
+	}
+	
+	/**
+	 * @param numberEvents the numberEvents to set
+	 */
+	public void setNumberEvents(int numberEvents) {
+		this.numberEvents = numberEvents;
+	}
+	
+/*	*//**
+	 * @return the eventsInWindow
+	 *//*
+	public int getNumberEventsInWindow() {
+		return this.eventsInWindow.size();
+	}
+
+	*//**
+	 * @return the eventsInWindow
+	 *//*
+	public List<Event> getEventsInWindow() {
+		return eventsInWindow;
+	}
+	
+	*//**
+	 * @param eventsInWindow the eventsInWindow to set
+	 *//*
+	public void setEventsInWindow(List<Event> eventsInWindow) {
+		this.eventsInWindow = eventsInWindow;
+	}
+	
+	*//**
+	 * @param additionalEventsInWindow the additional events in window to add
+	 *//*
+	public void addEventsInWindow(List<Event> additionalEventsInWindow) {
+		this.eventsInWindow.addAll(additionalEventsInWindow);
+	}
+	
+	*//**
+	 * @param expiredEventsInWindow the events in window to remove
+	 *//*
+	public void removeEventsInWindow(List<Event> expiredEventsInWindow) {
+		this.eventsInWindow.removeAll(expiredEventsInWindow);
+	}*/
+
+	/**
+	 * @return the parentId
+	 */
+	public String getParentId() {
+		return parentId;
+	}
+
+	/**
+	 * @param parentId the parentId to set
+	 */
+	public void setParentId(String parentId) {
+		this.parentId = parentId;
+	}
+	
+	/**
+	 * Advances the sliding window
+	 */
+	public void advance() {
+		this.windowStart += this.windowShift;
+		this.windowEnd += this.windowShift;
+		//System.out.println ("Sliding window "+this.getId()+" is reset to "+Tools.formattedInterval(this.windowStart, this.windowEnd));
+	}
+
+	/**
+	 * @return the lastUpdate
+	 */
+	public long getLastUpdate() {
+		return lastUpdate;
+	}
+
+	/**
+	 * @param lastUpdate the lastUpdate to set
+	 */
+	public void setLastUpdate(long lastUpdate) {
+		this.lastUpdate = lastUpdate;
+	}
+
+	/**
+	 * @return the state
+	 */
+	public int getState() {
+		return state;
+	}
+
+	/**
+	 * @param state the state to set
+	 */
+	public void setState(int state) {
+		this.state = state;
+	}
+
+	/**
+	 * @return the readyForAction
+	 */
+	public boolean isReadyToEvaluate() {
+		return readyToEvaluate;
+	}
+
+	/**
+	 * @param readyForAction the readyForAction to set
+	 */
+	public void setReadyToEvaluate(boolean readyToEvaluate) {
+		this.readyToEvaluate = readyToEvaluate;
+	}
+	
+	/**
+	 * @return the workingFreezersCount
+	 *//*
+	public int getWorkingFreezersCount() {
+		return workingFreezersCount;
+	}
+
+	*//**
+	 * @param workingFreezersCount the workingFreezersCount to set
+	 *//*
+	public void setWorkingFreezersCount(int workingFreezersCount) {
+		this.workingFreezersCount = workingFreezersCount;
+	}
+
+	*//**
+	 * @return the workingFridgesCount
+	 *//*
+	public int getWorkingFridgesCount() {
+		return workingFridgesCount;
+	}
+
+	*//**
+	 * @param workingFridgesCount the workingFridgesCount to set
+	 *//*
+	public void setWorkingFridgesCount(int workingFridgesCount) {
+		this.workingFridgesCount = workingFridgesCount;
+	}
+
+	public int getDefectiveFridgesCount() {
+		return defectiveFridgesCount;
+	}
+	
+	public void setDefectiveFridgesCount(int defectiveFridgesCount) {
+		this.defectiveFridgesCount = defectiveFridgesCount;
+	}
+
+	public int getDefectiveFreezersCount() {
+		return defectiveFreezersCount;
+	}
+
+	public void setDefectiveFreezersCount(int defectiveFreezersCount) {
+		this.defectiveFreezersCount = defectiveFreezersCount;
+	}
+	
+	public int getWorkingDevicesCount() {
+		return workingFridgesCount+workingFreezersCount;
+	}
+	
+	public int getDefectiveDevicesCount() {
+		return defectiveFridgesCount+defectiveFreezersCount;
+	}
+	
+	public int getOverallFridgesCount() {
+		return getWorkingFridgesCount()+getDefectiveFridgesCount();
+	}
+	
+	public int getOverallFreezersCount() {
+		return getWorkingFreezersCount()+getDefectiveFreezersCount();
+	}
+	
+	public int getOverallDevicesCount() {
+		return getWorkingDevicesCount()+getDefectiveDevicesCount();
+	}
+	
+	public double getWorkingFridgesRatio() {
+		if (getOverallFridgesCount() == 0)
+			return 0;
+		return (double)getWorkingFridgesCount()/getOverallFridgesCount();
+	}
+	
+	public double getDefectiveFridgesRatio() {
+		if (getOverallFridgesCount() == 0)
+			return 0;
+		return (double)getDefectiveFridgesCount()/getOverallFridgesCount();
+	}
+	
+	public double getWorkingFreezersRatio() {
+		if (getOverallFreezersCount() == 0)
+			return 0;
+		return (double)getWorkingFreezersCount()/getOverallFreezersCount();
+	}
+	
+	public double getDefectiveFreezersRatio() {
+		if (getOverallFreezersCount() == 0)
+			return 0;
+		return (double)getDefectiveFreezersCount()/getOverallFreezersCount();
+	}
+	
+	public double getWorkingDevicesRatio() {
+		if (getOverallDevicesCount() == 0)
+			return 0;
+		return (double)getWorkingDevicesCount()/getOverallDevicesCount();
+	}
+	
+	public double getDefectiveDevicesRatio() {
+		if (getOverallDevicesCount() == 0)
+			return 0;
+		return (double)getDefectiveDevicesCount()/getOverallDevicesCount();
+	}*/
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Status.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Status.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Status.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,149 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class Status {
+	
+	// Status names
+	public static final String[] STATUS_NAMES = {"Operational status"};
+	
+	public static final int OPERATIONAL = 0;
+	
+	////////////////////////////////////////////////////////////////////
+	
+	private int id;
+	private String resourceId;
+	private List<String> valueList;
+	private int currentValue;
+	private long hasValueSince;
+	
+	/**
+	 * @param id The status name.
+	 * @param resourceId The id of the corresponding resource.
+	 */
+	public Status(int id, String resourceId) {
+		this.id = id;
+		this.resourceId = resourceId;
+		this.valueList = new ArrayList<String>();
+		this.hasValueSince = 0;
+	}
+	
+	/**
+	 * @param id The status name.
+	 * @param resourceId The id of the corresponding resource.
+	 * @param currentValue current value of the status.
+	 */
+	public Status(int id, String resourceId, int currentValue) {
+		this (id, resourceId);
+		this.currentValue = currentValue;
+	}
+	
+	/**
+	 * @param id The status name.
+	 * @param resourceId The id of the corresponding resource.
+	 * @param valueList The values this status can have.
+	 * @param currentValue current value of the status.
+	 */
+	public Status(int id, String resourceId, String[] valueList, int currentValue) {
+		this (id, resourceId, currentValue);
+		this.addValues(valueList);
+	}
+
+	/**
+	 * @return the status id
+	 */
+	public int getId() {
+		return this.id;
+	}
+
+	/**
+	 * @param name the status id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	/**
+	 * @return the resourceId
+	 */
+	public String getResourceId() {
+		return resourceId;
+	}
+
+	/**
+	 * @param resourceId the resourceId to set
+	 */
+	public void setResourceId(String resourceId) {
+		this.resourceId = resourceId;
+	}
+
+	/**
+	 * @return the currentValue
+	 */
+	public int getCurrentValue() {
+		return currentValue;
+	}
+
+	/**
+	 * @param currentValue the currentValue to set
+	 */
+	public void setCurrentValue(int currentValue, long sinceWhen) {
+		this.currentValue = currentValue;
+		this.hasValueSince = sinceWhen;
+	}
+	
+	/**
+	 * @param oldValue the oldValue to set
+	 * @param newValue the newValue to set
+	 */
+	public void switchCurrentValue(int oldValue, int newValue, long sinceWhen) {
+		if (this.currentValue == oldValue)
+			this.setCurrentValue(newValue, sinceWhen);
+	}
+	
+	/**
+	 * @param oldValue the oldValue to set
+	 * @param newValue the newValue to set
+	 */
+	public void switchCurrentValue(String oldValue, String newValue, long sinceWhen) {
+		this.switchCurrentValue (Integer.parseInt(oldValue), Integer.parseInt(newValue), sinceWhen);
+	}
+	
+	/**
+	 * @param currentValue the currentValue to set
+	 *//*
+	public void setCurrentValue(int currentValue) {
+		setCurrentValue (currentValue, (Calendar)Calendar.getInstance().clone());
+	}*/
+	
+	/**
+	 * @return the valueList
+	 */
+	public String[] getValueList() {
+		return (String[]) valueList.toArray();
+	}
+
+	/**
+	 * @param valueList the valueList to set
+	 */
+	public void addValues(String[] valueList) {
+		this.valueList.addAll(Arrays.asList(valueList));
+	}
+	
+	/**
+	 * @return the hasValueSince
+	 */
+	public long getHasValueSince() {
+		return hasValueSince;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/StatusChangedEvent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/StatusChangedEvent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/StatusChangedEvent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.integrationtests.eventgenerator.Event;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class StatusChangedEvent extends Event {
+	
+	public static final String[] PROPERTY_FIELD_NAMES = {"OldValue", "NewValue"};
+	
+	public static final int OLD_VALUE = 0;
+	public static final int NEW_VALUE = 1;
+	
+	/**
+	 * Special constructor for a statusChanged event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 */
+	public StatusChangedEvent(String parentId, int oldValue, int newValue) {
+		super(EventType.STATUSCHANGED, parentId);
+		addParameters(createStatusChangedParameters(oldValue, newValue));
+	}
+	
+	/**
+	 * Special constructor for a statusChanged event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 * @param parameters The event parameters.
+	 */
+	public StatusChangedEvent(String parentId, long start, long end) {
+		super(EventType.STATUSCHANGED, parentId, start, end);
+	}
+	
+	/**
+	 * Special constructor for a statusChanged event  
+	 * @param parentId The id of the corresponding site, resource, ...
+	 * @param start The start instance of the event.
+	 * @param end The end instance of the event.
+	 * @param parameters The event parameters.
+	 */
+	public StatusChangedEvent(String parentId, int oldValue, int newValue, long start, long end) {
+		super(EventType.STATUSCHANGED, parentId, start, end);
+		addParameters(createStatusChangedParameters(oldValue, newValue));
+	}
+	
+	private static Map<String, String> createStatusChangedParameters(int oldValue, int newValue){
+		Map<String, String> params = new HashMap<String, String>();
+		params.put(PROPERTY_FIELD_NAMES[OLD_VALUE], String.valueOf(oldValue));
+		params.put(PROPERTY_FIELD_NAMES[NEW_VALUE], String.valueOf(newValue));
+		return params;
+	}
+	
+	/**
+	 * @return value of the oldValue parameter if such a parameter exists, null otherwise
+	 */
+	public String getParamOldValue() {
+		if (this.getParameters().containsKey(PROPERTY_FIELD_NAMES[OLD_VALUE]))
+			return this.getParamValue(PROPERTY_FIELD_NAMES[OLD_VALUE]);
+		return null;
+	}
+	
+	/**
+	 * @return value of the newValue parameter if such a parameter exists, null otherwise
+	 */
+	public String getParamNewValue() {
+		if (this.getParameters().containsKey(PROPERTY_FIELD_NAMES[NEW_VALUE]))
+			return this.getParamValue(PROPERTY_FIELD_NAMES[NEW_VALUE]);
+		return null;
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Tools.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Tools.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/eventgenerator/example/deprecated/Tools.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+/**
+ * 
+ */
+package org.drools.integrationtests.eventgenerator.example.deprecated;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+/**
+ * @author Matthias Groch
+ *
+ */
+public class Tools {
+	
+	// Utitlity functions for console output
+	public static String formattedDate (Calendar date){
+		return 
+			((date.get(Calendar.HOUR_OF_DAY) < 10)?  "0" : "") + date.get(Calendar.HOUR_OF_DAY) + ":" +
+			((date.get(Calendar.MINUTE) < 10)?       "0" : "") + date.get(Calendar.MINUTE)      + ":" +
+			((date.get(Calendar.SECOND) < 10)?       "0" : "") + date.get(Calendar.SECOND) + "." +
+			((date.get(Calendar.MILLISECOND) < 10)? "0" : "") + ((date.get(Calendar.MILLISECOND) < 100)? "0" : "") + date.get(Calendar.MILLISECOND);
+	}
+	
+	public static String formattedDate (long dateInMillis){
+		Calendar date = new GregorianCalendar();
+		date.setTimeInMillis(dateInMillis);
+		return formattedDate(date);
+	}
+	
+	public static String formattedInterval(Calendar start, Calendar end){	
+		return "["+Tools.formattedDate(start)+".."+Tools.formattedDate(end)+"]";
+	}
+	
+	public static String formattedInterval(long start, long end){	
+		return "["+Tools.formattedDate(start)+".."+Tools.formattedDate(end)+"]";
+	}
+	
+	public static void drawLine(){
+		System.out.println("----------------------------------------------------------------------------------------------------------------------------------");
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,193 @@
+package org.drools.integrationtests.sequential;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.StatelessSession;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+
+public class SequentialTest extends TestCase {
+    public void testBasicOperation() throws Exception {
+
+        // postponed while I sort out KnowledgeHelperFixer
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "simpleSequential.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setSequential( true );
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+        final StatelessSession session = ruleBase.newStatelessSession();
+
+        final List list = new ArrayList();
+        session.setGlobal( "list",
+                           list );
+
+        final Person p1 = new Person( "p1",
+                                      "stilton" );
+        final Person p2 = new Person( "p2",
+                                      "cheddar" );
+        final Person p3 = new Person( "p3",
+                                      "stilton" );
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           15 );
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           15 );
+
+        session.execute( new Object[]{p1, stilton, p2, cheddar, p3} );
+
+        assertEquals( 3,
+                      list.size() );
+
+    }
+
+    public void XXtestProfileSequential() throws Exception {
+
+        runTestProfileManyRulesAndFacts( true,
+                                         "Sequential mode",
+                                         0, "sequentialProfile.drl"  );
+        runTestProfileManyRulesAndFacts( true,
+                                         "Sequential mode",
+                                         0, "sequentialProfile.drl"  );
+
+        System.gc();
+        Thread.sleep( 100 );
+    }
+
+    public void XXtestProfileRETE() throws Exception {
+        runTestProfileManyRulesAndFacts( false,
+                                         "Normal RETE mode",
+                                         0, "sequentialProfile.drl"  );
+        runTestProfileManyRulesAndFacts( false,
+                                         "Normal RETE mode",
+                                         0, "sequentialProfile.drl"  );
+
+        System.gc();
+        Thread.sleep( 100 );
+    }
+
+    public void testNumberofIterationsSeq() throws Exception {
+        //test throughput
+        runTestProfileManyRulesAndFacts( true,
+                                         "SEQUENTIAL",
+                                         2000, "sequentialProfile.drl"  );
+    }
+
+    public void testNumberofIterationsRETE() throws Exception {
+        //test throughput
+        runTestProfileManyRulesAndFacts( false,
+                                         "RETE",
+                                         2000, "sequentialProfile.drl"  );
+
+    }
+    
+    public void XXtestPerfJDT() throws Exception {
+        runTestProfileManyRulesAndFacts( true,
+                                         "JDT",
+                                         2000, "sequentialProfile.drl"  );
+        
+    }    
+    
+    public void XXtestPerfMVEL() throws Exception {
+        runTestProfileManyRulesAndFacts( true,
+                                         "MVEL",
+                                         2000, "sequentialProfileMVEL.drl"  );
+        
+    }
+    
+
+    
+
+    private void runTestProfileManyRulesAndFacts(boolean sequentialMode,
+                                                 String message,
+                                                 int timetoMeasureIterations, String file) throws DroolsParserException,
+                                                                             IOException,
+                                                                             Exception {
+        // postponed while I sort out KnowledgeHelperFixer
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( file ) ) );
+        final Package pkg = builder.getPackage();
+
+        Properties properties = new Properties();
+        properties.setProperty( "drools.shadowProxyExcludes",
+                                "org.drools.*" );
+
+        RuleBaseConfiguration conf = new RuleBaseConfiguration( properties );
+        conf.setSequential( sequentialMode );
+
+        final RuleBase ruleBase = getRuleBase( conf );
+        ruleBase.addPackage( pkg );
+        final StatelessSession session = ruleBase.newStatelessSession();
+
+        final List list = new ArrayList();
+        session.setGlobal( "list",
+                           list );
+
+        Object[] data = new Object[50000];
+        for ( int i = 0; i < data.length; i++ ) {
+
+            if ( i % 2 == 0 ) {
+                final Person p = new Person( "p" + i,
+                                             "stilton" );
+                data[i] = p;
+            } else {
+                data[i] = new Cheese( "cheddar",
+                                      i );
+            }
+        }
+
+        if ( timetoMeasureIterations == 0 ) {
+            //one shot measure
+            long start = System.currentTimeMillis();
+            session.execute( data );
+            System.out.println( "Time for " + message + ":" + (System.currentTimeMillis() - start) );
+            assertTrue( list.size() > 0 );
+
+        } else {
+            //lots of shots
+            //test throughput
+            long start = System.currentTimeMillis();
+            long end = start + timetoMeasureIterations;
+            int count = 0;
+            while ( System.currentTimeMillis() < end ) {
+                StatelessSession sess2 = ruleBase.newStatelessSession();
+                List list2 = new ArrayList();
+                sess2.setGlobal( "list",
+                                 list2 );
+
+                sess2.execute( data );
+                //session.execute( data );
+                count++;
+            }
+            System.out.println( "Iterations in for " + message + " : " + count );
+
+        }
+
+    }
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/rule_generator.rb
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/rule_generator.rb	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/sequential/rule_generator.rb	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+OUTPUT="rules.drl"
+
+if File.exists? OUTPUT then File.delete(OUTPUT) end
+
+f = File.new(OUTPUT, "w")
+
+
+for i in 1..200
+
+	s =  "
+	
+	rule \"Cheese_#{i}\"	
+		when
+			$c : Cheese( price == #{i} )
+		then 
+			list.add( $c.getType() );
+	end
+	
+	rule \"Person and cheese_#{i}\"
+		when 
+			$p : Person(name == \"p#{i}\")
+			$c : Cheese(price == 1)
+		then
+			list.add($p.getName());
+		
+	end
+	"
+	f.write s
+
+
+
+end
+
+f.close
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Edge.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Edge.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Edge.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,101 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Bagerman
+ * 
+ */
+public class Edge {
+    private int                p1;
+
+    private int                p2;
+
+    private boolean            joined;
+
+    private String             label;
+
+    private boolean            plotted;
+
+    final public static String NIL   = "empty";
+
+    final public static String B     = "B";
+
+    final public static String PLUS  = "+";
+
+    final public static String MINUS = "-";
+
+    public Edge() {
+
+    }
+
+    public Edge(final int p1,
+                final int p2,
+                final boolean joined,
+                final String label,
+                final boolean plotted) {
+        this.p1 = p1;
+        this.p2 = p2;
+        this.joined = joined;
+        this.label = label;
+        this.plotted = plotted;
+    }
+
+    public int getP1() {
+        return this.p1;
+    }
+
+    public void setP1(final int p1) {
+        this.p1 = p1;
+    }
+
+    public int getP2() {
+        return this.p2;
+    }
+
+    public void setP2(final int p2) {
+        this.p2 = p2;
+    }
+
+    public String toString() {
+        return "( Edge p1=" + this.p1 + ", p2=" + this.p2 + ", joined=" + this.joined + ", label=" + this.label + ", plotted=" + this.plotted + " )";
+    }
+
+    public boolean isJoined() {
+        return this.joined;
+    }
+
+    public void setJoined(final boolean joined) {
+        this.joined = joined;
+    }
+
+    public String getLabel() {
+        return this.label;
+    }
+
+    public void setLabel(final String label) {
+        this.label = label;
+    }
+
+    public boolean getPlotted() {
+        return this.plotted;
+    }
+
+    public void setPlotted(final boolean plotted) {
+        this.plotted = plotted;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Junction.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Junction.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Junction.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,102 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Bagerman
+ * 
+ */
+
+public class Junction {
+    public static String TEE   = "tee";
+
+    public static String FORK  = "fork";
+
+    public static String ARROW = "arrow";
+
+    public static String L     = "L";
+
+    private int          p1;
+
+    private int          p2;
+
+    private int          p3;
+
+    private int          basePoint;
+
+    private String       type;
+
+    public Junction() {
+
+    }
+
+    public Junction(final int p1,
+                    final int p2,
+                    final int p3,
+                    final int basePoint,
+                    final String type) {
+        this.p1 = p1;
+        this.p2 = p2;
+        this.p3 = p3;
+        this.basePoint = basePoint;
+        this.type = type;
+    }
+
+    public int getP1() {
+        return this.p1;
+    }
+
+    public void setP1(final int p1) {
+        this.p1 = p1;
+    }
+
+    public int getP2() {
+        return this.p2;
+    }
+
+    public void setP2(final int p2) {
+        this.p2 = p2;
+    }
+
+    public String toString() {
+        return "{Junction p1=" + this.p1 + ", p2=" + this.p2 + ", p3=" + this.p3 + ", basePoint=" + this.basePoint + ", type=" + this.type + "}";
+    }
+
+    public int getBasePoint() {
+        return this.basePoint;
+    }
+
+    public void setBasePoint(final int basePoint) {
+        this.basePoint = basePoint;
+    }
+
+    public int getP3() {
+        return this.p3;
+    }
+
+    public void setP3(final int p3) {
+        this.p3 = p3;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Line.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Line.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Line.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,58 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Bagerman
+ * 
+ */
+
+public class Line {
+    private int p1;
+
+    private int p2;
+
+    public Line() {
+
+    }
+
+    public Line(final int p1,
+                final int p2) {
+        this.p1 = p1;
+        this.p2 = p2;
+    }
+
+    public int getP1() {
+        return this.p1;
+    }
+
+    public void setP1(final int p1) {
+        this.p1 = p1;
+    }
+
+    public int getP2() {
+        return this.p2;
+    }
+
+    public void setP2(final int p2) {
+        this.p2 = p2;
+    }
+
+    public String toString() {
+        return "{Line p1=" + this.p1 + ", p2=" + this.p2 + "}";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/ReteOOWaltzTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/ReteOOWaltzTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/ReteOOWaltzTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+
+public class ReteOOWaltzTest extends Waltz {
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO );
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Stage.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Stage.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Stage.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,102 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Bagerman
+ * 
+ */
+
+import java.io.Serializable;
+
+/**
+ * 
+ * @author Alexander Bagerman
+ *
+ */
+public class Stage
+    implements
+    Serializable {
+    private static final long serialVersionUID      = 400L;
+
+    final public static int   START                 = 0;
+
+    final public static int   DUPLICATE             = 1;
+
+    final public static int   DETECT_JUNCTIONS      = 2;
+
+    final public static int   FIND_INITIAL_BOUNDARY = 3;
+
+    final public static int   FIND_SECOND_BOUNDARY  = 4;
+
+    final public static int   LABELING              = 5;
+
+    final public static int   PLOT_REMAINING_EDGES  = 9;
+
+    final public static int   DONE                  = 10;
+
+    private int               value;
+
+    public Stage() {
+
+    }
+
+    public Stage(final int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    public void setValue(final int value) {
+        this.value = value;
+    }
+
+    public static int resolveStageValue(final String str) {
+        if ( str.equals( "start" ) ) {
+            return 0;
+
+        } else if ( str.equals( "duplicate" ) ) {
+            return 1;
+
+        } else if ( str.equals( "detect_junctions" ) ) {
+            return 2;
+
+        } else if ( str.equals( "find_initial_boundary" ) ) {
+            return 3;
+
+        } else if ( str.equals( "find_second_boundary" ) ) {
+            return 4;
+
+        } else if ( str.equals( "labeling" ) ) {
+            return 5;
+
+        } else if ( str.equals( "plot_remaining_edges" ) ) {
+            return 9;
+
+        } else if ( str.equals( "done" ) ) {
+            return 10;
+        } else {
+            return -9999999;
+        }
+    }
+
+    public String toString() {
+        return "{Stage value=" + this.value + "}";
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Waltz.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Waltz.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/Waltz.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,123 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+
+import org.drools.PackageIntegrationException;
+import org.drools.RuleBase;
+import org.drools.RuleIntegrationException;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.InvalidPatternException;
+import org.drools.rule.Package;
+
+/**
+ * This is a sample file to launch a rule package from a rule source file.
+ */
+public abstract class Waltz extends TestCase {
+
+    protected abstract RuleBase getRuleBase() throws Exception;
+
+    public void testWaltz() {
+        try {
+
+            //load up the rulebase
+            final RuleBase ruleBase = readRule();
+            final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+            workingMemory.setGlobal( "sysout",
+                                     System.out );
+
+            //            DebugWorkingMemoryEventListener wmListener = new DebugWorkingMemoryEventListener();
+            //            DebugAgendaEventListener agendaListener = new DebugAgendaEventListener();
+            //            workingMemory.addEventListener( wmListener );
+            //            workingMemory.addEventListener( agendaListener );
+
+            //go !     
+            this.loadLines( workingMemory,
+                            "waltz50.dat" );
+
+            //final Stage stage = new Stage( Stage.START );
+            //workingMemory.assertObject( stage );
+
+            final long start = System.currentTimeMillis();
+
+            final Stage stage = new Stage( Stage.DUPLICATE );
+            workingMemory.insert( stage );
+            workingMemory.fireAllRules();
+
+            final long end = System.currentTimeMillis();
+            System.out.println( end - start );
+        } catch ( final Throwable t ) {
+            t.printStackTrace();
+            fail( t.getMessage() );
+        }
+    }
+
+    /**
+     * Please note that this is the "low level" rule assembly API.
+     */
+    private RuleBase readRule() throws Exception,
+                               DroolsParserException,
+                               RuleIntegrationException,
+                               PackageIntegrationException,
+                               InvalidPatternException {
+        //read in the source
+        final Reader reader = new InputStreamReader( Waltz.class.getResourceAsStream( "waltz.drl" ) );
+        final DrlParser parser = new DrlParser();
+        final PackageDescr packageDescr = parser.parse( reader );
+
+        //pre build the package
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( packageDescr );
+        final Package pkg = builder.getPackage();
+
+        //add the package to a rulebase
+        final RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        return ruleBase;
+    }
+
+    private void loadLines(final WorkingMemory wm,
+                           final String filename) throws IOException {
+        final BufferedReader reader = new BufferedReader( new InputStreamReader( Waltz.class.getResourceAsStream( filename ) ) );
+        final Pattern pat = Pattern.compile( ".*make line \\^p1 ([0-9]*) \\^p2 ([0-9]*).*" );
+        String line = reader.readLine();
+        while ( line != null ) {
+            final Matcher m = pat.matcher( line );
+            if ( m.matches() ) {
+                final Line l = new Line( Integer.parseInt( m.group( 1 ) ),
+                                         Integer.parseInt( m.group( 2 ) ) );
+                wm.insert( l );
+            }
+            line = reader.readLine();
+        }
+        reader.close();
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/WaltzUtil.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/WaltzUtil.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/integrationtests/waltz/WaltzUtil.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,178 @@
+package org.drools.integrationtests.waltz;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Bagerman
+ * 
+ */
+public class WaltzUtil {
+    private static double    PI      = 3.1415927;
+
+    private static final int MOD_NUM = 10000;
+
+    private static int get_y(final int val) {
+        return val % WaltzUtil.MOD_NUM;
+    }
+
+    private static int get_x(final int val) {
+        return (val / WaltzUtil.MOD_NUM);
+    }
+
+    /***************************************************************************
+     * This function is passed two points and calculates the angle between the
+     * line defined by these points and the x-axis.
+     **************************************************************************/
+    private static double get_angle(final int p1,
+                                    final int p2) {
+        int delta_x, delta_y;
+        double ret = 0.0;
+        /*
+         * Calculate (x2 - x1) and (y2 - y1). The points are passed in the form
+         * x1y1 and x2y2. get_x() and get_y() are passed these points and return
+         * the x and y values respectively. For example, get_x(1020) returns 10.
+         */
+        delta_x = get_x( p2 ) - get_x( p1 );
+        delta_y = get_y( p2 ) - get_y( p1 );
+
+        if ( delta_x == 0 ) {
+            if ( delta_y > 0 ) {
+                ret = WaltzUtil.PI / 2;
+            } else if ( delta_y < 0 ) {
+                ret = -WaltzUtil.PI / 2;
+            }
+        } else if ( delta_y == 0 ) {
+            if ( delta_x > 0 ) {
+                ret = 0.0;
+            } else if ( delta_x < 0 ) {
+                ret = WaltzUtil.PI;
+            }
+        } else {
+            ret = Math.atan2( delta_y,
+                              delta_x );
+        }
+        return ret;
+    }
+
+    /***************************************************************************
+     * This procedure is passed the basepoint of the intersection of two lines
+     * as well as the other two endpoints of the lines and calculates the angle
+     * inscribed by these three points.
+     **************************************************************************/
+    private static double inscribed_angle(final int basepoint,
+                                          final int p1,
+                                          final int p2) {
+        double angle1, angle2, temp;
+
+        /*
+         * Get the angle between line #1 and the origin and the angle between
+         * line #2 and the origin, and then subtract these values.
+         */
+        angle1 = get_angle( basepoint,
+                            p1 );
+        angle2 = get_angle( basepoint,
+                            p2 );
+        temp = angle1 - angle2;
+        if ( temp < 0.0 ) {
+            temp = -temp;
+        }
+
+        /*
+         * We always want the smaller of the two angles inscribed, so if the
+         * answer is greater than 180 degrees, calculate the smaller angle and
+         * return it.
+         */
+        if ( temp > WaltzUtil.PI ) {
+            temp = 2 * WaltzUtil.PI - temp;
+        }
+        if ( temp < 0.0 ) {
+            return (-temp);
+        }
+        return (temp);
+    }
+
+    public static Junction make_3_junction(final int basepoint,
+                                           final int p1,
+                                           final int p2,
+                                           final int p3) {
+        int shaft, barb1, barb2;
+        double angle12, angle13, angle23;
+        double sum, sum1213, sum1223, sum1323;
+        double delta;
+        String j_type;
+
+        angle12 = inscribed_angle( basepoint,
+                                   p1,
+                                   p2 );
+        angle13 = inscribed_angle( basepoint,
+                                   p1,
+                                   p3 );
+        angle23 = inscribed_angle( basepoint,
+                                   p2,
+                                   p3 );
+
+        sum1213 = angle12 + angle13;
+        sum1223 = angle12 + angle23;
+        sum1323 = angle13 + angle23;
+
+        if ( sum1213 < sum1223 ) {
+            if ( sum1213 < sum1323 ) {
+                sum = sum1213;
+                shaft = p1;
+                barb1 = p2;
+                barb2 = p3;
+            } else {
+                sum = sum1323;
+                shaft = p3;
+                barb1 = p1;
+                barb2 = p2;
+            }
+        } else {
+            if ( sum1223 < sum1323 ) {
+                sum = sum1223;
+                shaft = p2;
+                barb1 = p1;
+                barb2 = p3;
+            } else {
+                sum = sum1323;
+                shaft = p3;
+                barb1 = p1;
+                barb2 = p2;
+            }
+        }
+
+        delta = sum - WaltzUtil.PI;
+        if ( delta < 0.0 ) {
+            delta = -delta;
+        }
+
+        if ( delta < 0.001 ) {
+            j_type = Junction.TEE;
+        } else if ( sum > WaltzUtil.PI ) {
+            j_type = Junction.FORK;
+        } else {
+            j_type = Junction.ARROW;
+        }
+
+        return new Junction( barb1,
+                             shaft,
+                             barb2,
+                             basepoint,
+                             j_type );
+
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MVELDumperTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MVELDumperTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MVELDumperTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,85 @@
+package org.drools.lang;
+
+import junit.framework.TestCase;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.Lexer;
+import org.antlr.runtime.TokenStream;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.PatternDescr;
+
+public class MVELDumperTest extends TestCase {
+
+    private MVELDumper dumper;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        dumper = new MVELDumper();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void xxxtestDump() throws Exception {
+        String input = "Cheese( price > 10 && < 20 || == $val || == 30 )";
+        String expected = "( ( price > 10 && price < 20 ) || price == $val || price == 30 )" ;
+        DRLParser parser = parse( input );
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        
+        FieldConstraintDescr fieldDescr = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        String result = dumper.dump( fieldDescr );
+        
+        assertEquals( expected, result );
+    }
+    
+    public void testDumpMatches() throws Exception {
+        String input = "Cheese( type.toString matches \"something\\swith\\tsingle escapes\" )";
+        String expected = "type.toString ~= \"something\\\\swith\\\\tsingle escapes\"" ;
+        DRLParser parser = parse( input );
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        
+        FieldConstraintDescr fieldDescr = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        String result = dumper.dump( fieldDescr );
+        
+        assertEquals( expected, result );
+    }
+
+    public void testDumpMatches2() throws Exception {
+        String input = "Cheese( type.toString matches 'something\\swith\\tsingle escapes' )";
+        String expected = "type.toString ~= \"something\\\\swith\\\\tsingle escapes\"" ;
+        DRLParser parser = parse( input );
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        
+        FieldConstraintDescr fieldDescr = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        String result = dumper.dump( fieldDescr );
+        
+        assertEquals( expected, result );
+    }
+
+    
+    private DRLParser parse(final String text) throws Exception {
+        return newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+    }
+
+    private CharStream newCharStream(final String text) {
+        return new ANTLRStringStream( text );
+    }
+
+    private DRLLexer newLexer(final CharStream charStream) {
+        return new DRLLexer( charStream );
+    }
+
+    private TokenStream newTokenStream(final Lexer lexer) {
+        return new CommonTokenStream( lexer );
+    }
+
+    private DRLParser newParser(final TokenStream tokenStream) {
+        final DRLParser p = new DRLParser( tokenStream );
+        //p.setParserDebug( true );
+        return p;
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpander.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpander.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpander.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,72 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.drools.lang.dsl.DSLMapping;
+
+public class MockExpander
+    implements
+    Expander {
+
+    private int timesCalled = 0;
+    public Set  patterns    = new HashSet();
+
+    public String expand(final String scope,
+                         final String pattern) {
+
+        this.patterns.add( scope + "," + pattern );
+
+        final int grist = (++this.timesCalled);
+        return "foo" + grist + " : Bar(a==" + grist + ")";
+    }
+
+    public boolean checkPattern(final String pat) {
+        return this.patterns.contains( pat );
+    }
+
+    public void addDSLMapping(final DSLMapping mapping) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public String expand(final Reader drl) throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String expand(final String source) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List getErrors() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean hasErrors() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpanderResolver.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpanderResolver.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/MockExpanderResolver.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,50 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class MockExpanderResolver
+    implements
+    ExpanderResolver {
+
+    private final Map          resolveCalls = new HashMap();
+    private final MockExpander expander     = new MockExpander();
+
+    public Expander get(final String name,
+                        final String config) {
+        this.resolveCalls.put( name,
+                               config );
+        return this.expander;
+    }
+
+    /**
+     * Check if it was called.
+     */
+    public boolean checkCalled(final String name) {
+        return this.resolveCalls.containsKey( name );
+    }
+
+    public String getConfigFor(final String name) {
+        return (String) this.resolveCalls.get( name );
+    }
+
+    public boolean checkExpanded(final String patternOriginal) {
+        return this.expander.checkPattern( patternOriginal );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/RuleParserTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/RuleParserTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/RuleParserTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3867 @@
+package org.drools.lang;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonToken;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.Lexer;
+import org.antlr.runtime.MismatchedTokenException;
+import org.antlr.runtime.NoViableAltException;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.TokenStream;
+import org.drools.compiler.DrlParser;
+import org.drools.lang.DRLParser.paren_chunk_return;
+import org.drools.lang.descr.AccessorDescr;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EntryPointDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FieldAccessDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.FieldTemplateDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QualifiedIdentifierRestrictionDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.TypeDeclarationDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.lang.dsl.DefaultExpander;
+
+public class RuleParserTest extends TestCase {
+
+    private DRLParser parser;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.parser = null;
+    }
+
+    protected void tearDown() throws Exception {
+        this.parser = null;
+        super.tearDown();
+    }
+
+    public void testPackage_OneSegment() throws Exception {
+        final String packageName = parse( "package foo" ).package_statement();
+        assertEquals( "foo",
+                      packageName );
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testPackage_MultipleSegments() throws Exception {
+        final String packageName = parse( "package foo.bar.baz;" ).package_statement();
+        assertEquals( "foo.bar.baz",
+                      packageName );
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testEmptyPackage() throws Exception {
+        final String source = "package foo.bar.baz";
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( new StringReader( source ) );
+        assertFalse( parser.hasErrors() );
+        assertEquals( "foo.bar.baz",
+                      pkg.getName() );
+    }
+
+    public void testCompilationUnit() throws Exception {
+        final String source = "package foo; import com.foo.Bar; import com.foo.Baz;";
+        parse( source ).compilation_unit();
+        assertEquals( "foo",
+                      this.parser.getPackageDescr().getName() );
+        assertEquals( 2,
+                      this.parser.getPackageDescr().getImports().size() );
+        ImportDescr impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 0 );
+        assertEquals( "com.foo.Bar",
+                      impdescr.getTarget() );
+        assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
+                      impdescr.getStartCharacter() );
+        assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
+                      impdescr.getEndCharacter() );
+
+        impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 1 );
+        assertEquals( "com.foo.Baz",
+                      impdescr.getTarget() );
+        assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
+                      impdescr.getStartCharacter() );
+        assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
+                      impdescr.getEndCharacter() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testEmptyRule() throws Exception {
+        final RuleDescr rule = parseResource( "empty_rule.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "empty",
+                      rule.getName() );
+        assertNotNull( rule.getLhs() );
+        assertNotNull( rule.getConsequence() );
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+    }
+
+    public void testKeywordCollisions() throws Exception {
+        final DRLParser parser = parseResource( "eol_funny_business.drl" );
+
+        parser.compilation_unit();
+        final PackageDescr pkg = parser.getPackageDescr();
+
+        assertEquals( 1,
+                      pkg.getRules().size() );
+
+        assertFalse( parser.getErrors().toString(),
+                     parser.hasErrors() );
+
+    }
+
+    public void testPartialAST() throws Exception {
+        parseResource( "pattern_partial.drl" );
+
+        this.parser.compilation_unit();
+
+        assertTrue( this.parser.hasErrors() );
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+        assertEquals( 1,
+                      pkg.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+
+        assertNotNull( pattern );
+        assertEquals( "Bar",
+                      pattern.getObjectType() );
+        assertEquals( "foo3",
+                      pattern.getIdentifier() );
+
+    }
+
+    public void testTemplates() throws Exception {
+
+        final DRLParser parser = parseResource( "test_Templates.drl" );
+
+        parser.compilation_unit();
+        final PackageDescr pkg = parser.getPackageDescr();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( "FACT TEMPLATES FAILED: " + parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+
+        assertEquals( 1,
+                      pkg.getRules().size() );
+        assertEquals( 2,
+                      pkg.getFactTemplates().size() );
+
+        FactTemplateDescr fact1 = (FactTemplateDescr) pkg.getFactTemplates().get( 0 );
+        assertEquals( "Cheese",
+                      fact1.getName() );
+        assertEquals( 2,
+                      fact1.getFields().size() );
+
+        assertEquals( "name",
+                      ((FieldTemplateDescr) fact1.getFields().get( 0 )).getName() );
+        assertEquals( "String",
+                      ((FieldTemplateDescr) fact1.getFields().get( 0 )).getClassType() );
+
+        assertEquals( "age",
+                      ((FieldTemplateDescr) fact1.getFields().get( 1 )).getName() );
+        assertEquals( "Integer",
+                      ((FieldTemplateDescr) fact1.getFields().get( 1 )).getClassType() );
+
+        fact1 = null;
+
+        final FactTemplateDescr fact2 = (FactTemplateDescr) pkg.getFactTemplates().get( 1 );
+        assertEquals( "Wine",
+                      fact2.getName() );
+        assertEquals( 3,
+                      fact2.getFields().size() );
+
+        assertEquals( "name",
+                      ((FieldTemplateDescr) fact2.getFields().get( 0 )).getName() );
+        assertEquals( "String",
+                      ((FieldTemplateDescr) fact2.getFields().get( 0 )).getClassType() );
+
+        assertEquals( "year",
+                      ((FieldTemplateDescr) fact2.getFields().get( 1 )).getName() );
+        assertEquals( "String",
+                      ((FieldTemplateDescr) fact2.getFields().get( 1 )).getClassType() );
+
+        assertEquals( "accolades",
+                      ((FieldTemplateDescr) fact2.getFields().get( 2 )).getName() );
+        assertEquals( "String[]",
+                      ((FieldTemplateDescr) fact2.getFields().get( 2 )).getClassType() );
+    }
+
+    public void testTernaryExpression() throws Exception {
+
+        final DRLParser parser = parseResource( "ternary_expression.drl" );
+
+        parser.compilation_unit();
+        final PackageDescr pkg = parser.getPackageDescr();
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 1,
+                      pkg.getRules().size() );
+
+        assertFalse( parser.hasErrors() );
+        assertEqualsIgnoreWhitespace( "if (speed > speedLimit ? true : false;) pullEmOver();",
+                                      (String) rule.getConsequence() );
+    }
+
+    public void FIXME_testLatinChars() throws Exception {
+        final DrlParser parser = new DrlParser();
+        final Reader drl = new InputStreamReader( this.getClass().getResourceAsStream( "latin-sample.dslr" ) );
+        final Reader dsl = new InputStreamReader( this.getClass().getResourceAsStream( "latin.dsl" ) );
+
+        final PackageDescr pkg = parser.parse( drl,
+                                               dsl );
+
+        //MN: will get some errors due to the char encoding on my FC5 install
+        //others who use the right encoding may not see this, feel free to uncomment
+        //the following assertion.
+        assertFalse( parser.hasErrors() );
+
+        assertEquals( "br.com.auster.drools.sample",
+                      pkg.getName() );
+        assertEquals( 1,
+                      pkg.getRules().size() );
+
+    }
+
+    public void testFunctionWithArrays() throws Exception {
+        final DRLParser parser = parseResource( "function_arrays.drl" );
+
+        parser.compilation_unit();
+        final PackageDescr pkg = parser.getPackageDescr();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+        assertEquals( "foo",
+                      pkg.getName() );
+        assertEquals( 1,
+                      pkg.getRules().size() );
+
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+
+        assertEqualsIgnoreWhitespace( "yourFunction(new String[3] {\"a\",\"b\",\"c\"});",
+                                      (String) rule.getConsequence() );
+        final FunctionDescr func = (FunctionDescr) pkg.getFunctions().get( 0 );
+
+        assertEquals( "String[]",
+                      func.getReturnType() );
+        assertEquals( "args[]",
+                      func.getParameterNames().get( 0 ) );
+        assertEquals( "String",
+                      func.getParameterTypes().get( 0 ) );
+    }
+
+    public void testAlmostEmptyRule() throws Exception {
+        final RuleDescr rule = parseResource( "almost_empty_rule.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "almost_empty",
+                      rule.getName() );
+        assertNotNull( rule.getLhs() );
+        assertEquals( "",
+                      ((String) rule.getConsequence()).trim() );
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testQuotedStringNameRule() throws Exception {
+        final RuleDescr rule = parseResource( "quoted_string_name_rule.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "quoted string name",
+                      rule.getName() );
+        assertNotNull( rule.getLhs() );
+        assertEquals( "",
+                      ((String) rule.getConsequence()).trim() );
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testNoLoop() throws Exception {
+        final RuleDescr rule = parseResource( "no-loop.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "rule1",
+                      rule.getName() );
+        final AttributeDescr att = (AttributeDescr) rule.getAttributes().get( 0 );
+        assertEquals( "false",
+                      att.getValue() );
+        assertEquals( "no-loop",
+                      att.getName() );
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+    }
+
+    public void testAutofocus() throws Exception {
+        final RuleDescr rule = parseResource( "autofocus.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "rule1",
+                      rule.getName() );
+        final AttributeDescr att = (AttributeDescr) rule.getAttributes().get( 0 );
+        assertEquals( "true",
+                      att.getValue() );
+        assertEquals( "auto-focus",
+                      att.getName() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testRuleFlowGroup() throws Exception {
+        final RuleDescr rule = parseResource( "ruleflowgroup.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "rule1",
+                      rule.getName() );
+        final AttributeDescr att = (AttributeDescr) rule.getAttributes().get( 0 );
+        assertEquals( "a group",
+                      att.getValue() );
+        assertEquals( "ruleflow-group",
+                      att.getName() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testConsequenceWithDeclaration() throws Exception {
+        final RuleDescr rule = parseResource( "declaration-in-consequence.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "myrule",
+                      rule.getName() );
+
+        final String expected = "int i = 0; i = 1; i / 1; i == 1; i(i); i = 'i'; i.i.i; i\\i; i<i; i>i; i=\"i\";  ++i;" + "i++; --i; i--; i += i; i -= i; i *= i; i /= i;" + "int i = 5;" + "for(int j; j<i; ++j) {" + "System.out.println(j);}"
+                                + "Object o = new String(\"Hello\");" + "String s = (String) o;";
+
+        assertEqualsIgnoreWhitespace( expected,
+                                      (String) rule.getConsequence() );
+        assertTrue( ((String) rule.getConsequence()).indexOf( "++" ) > 0 );
+        assertTrue( ((String) rule.getConsequence()).indexOf( "--" ) > 0 );
+        assertTrue( ((String) rule.getConsequence()).indexOf( "+=" ) > 0 );
+        assertTrue( ((String) rule.getConsequence()).indexOf( "==" ) > 0 );
+
+        //System.out.println(( String ) rule.getConsequence());
+        //note, need to assert that "i++" is preserved as is, no extra spaces.
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testRuleParseLhs() throws Exception {
+        final String text = "Person(age < 42, location==\"atlanta\") \nor\nPerson(name==\"bob\") \n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testLiteralBoolAndNegativeNumbersRule() throws Exception {
+        final DRLParser parser = parseResource( "literal_bool_and_negative.drl" );
+        final RuleDescr rule = parser.rule();
+        assertFalse( parser.hasErrors() );
+
+        assertNotNull( rule );
+
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertNotNull( rule.getLhs() );
+        assertEqualsIgnoreWhitespace( "cons();",
+                                      (String) rule.getConsequence() );
+
+        final AndDescr lhs = rule.getLhs();
+        assertEquals( 3,
+                      lhs.getDescrs().size() );
+
+        PatternDescr pattern = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+        AndDescr fieldAnd = (AndDescr) pattern.getConstraint();
+        FieldConstraintDescr fld = (FieldConstraintDescr) fieldAnd.getDescrs().get( 0 );
+        LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "false",
+                      lit.getText() );
+        assertEquals( "bar",
+                      fld.getFieldName() );
+
+        pattern = (PatternDescr) lhs.getDescrs().get( 1 );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        fieldAnd = (AndDescr) pattern.getConstraint();
+        fld = (FieldConstraintDescr) fieldAnd.getDescrs().get( 0 );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( ">",
+                      lit.getEvaluator() );
+        assertEquals( "-42",
+                      lit.getText() );
+        assertEquals( "boo",
+                      fld.getFieldName() );
+
+        pattern = (PatternDescr) lhs.getDescrs().get( 2 );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        //lit = (LiteralDescr) col.getDescrs().get( 0 );
+
+        fieldAnd = (AndDescr) pattern.getConstraint();
+        fld = (FieldConstraintDescr) fieldAnd.getDescrs().get( 0 );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( ">",
+                      lit.getEvaluator() );
+        assertEquals( "-42.42",
+                      lit.getText() );
+        assertEquals( "boo",
+                      fld.getFieldName() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testChunkWithoutParens() throws Exception {
+        String input = "( foo )";
+        paren_chunk_return ret = parse( input ).paren_chunk();
+        final String chunk = input.substring( ((CommonToken) ret.start).getStartIndex(),
+                                              ((CommonToken) ret.stop).getStopIndex() + 1 );
+
+        assertEquals( "( foo )",
+                      chunk );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testChunkWithParens() throws Exception {
+        String input = "(fnord())";
+        paren_chunk_return ret = parse( input ).paren_chunk();
+        final String chunk = input.substring( ((CommonToken) ret.start).getStartIndex(),
+                                              ((CommonToken) ret.stop).getStopIndex() + 1 );
+
+        assertEqualsIgnoreWhitespace( "(fnord())",
+                                      chunk );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testChunkWithParensAndQuotedString() throws Exception {
+        String input = "( fnord( \"cheese\" ) )";
+        paren_chunk_return ret = parse( input ).paren_chunk();
+        final String chunk = input.substring( ((CommonToken) ret.start).getStartIndex(),
+                                              ((CommonToken) ret.stop).getStopIndex() + 1 );
+
+        assertEqualsIgnoreWhitespace( "( fnord( \"cheese\" ) )",
+                                      chunk );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testChunkWithRandomCharac5ters() throws Exception {
+        String input = "( %*9dkj)";
+        paren_chunk_return ret = parse( input ).paren_chunk();
+        final String chunk = input.substring( ((CommonToken) ret.start).getStartIndex(),
+                                              ((CommonToken) ret.stop).getStopIndex() + 1 );
+
+        assertEqualsIgnoreWhitespace( "( %*9dkj)",
+                                      chunk );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testEmptyPattern() throws Exception {
+        parseResource( "test_EmptyPattern.drl" );
+        this.parser.compilation_unit();
+        final PackageDescr packageDescr = this.parser.getPackageDescr();
+        assertEquals( 1,
+                      packageDescr.getRules().size() );
+        final RuleDescr ruleDescr = (RuleDescr) packageDescr.getRules().get( 0 );
+        assertEquals( "simple rule",
+                      ruleDescr.getName() );
+        assertNotNull( ruleDescr.getLhs() );
+        assertEquals( 1,
+                      ruleDescr.getLhs().getDescrs().size() );
+        final PatternDescr patternDescr = (PatternDescr) ruleDescr.getLhs().getDescrs().get( 0 );
+        assertEquals( 0,
+                      patternDescr.getConstraint().getDescrs().size() ); //this may be null, not sure as the test doesn't get this far...
+        assertEquals( "Cheese",
+                      patternDescr.getObjectType() );
+
+    }
+
+    public void testSimpleMethodCallWithFrom() throws Exception {
+
+        final RuleDescr rule = parseResource( "test_SimpleMethodCallWithFrom.drl" ).rule();
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FromDescr from = (FromDescr) pattern.getSource();
+        final AccessorDescr method = (AccessorDescr) from.getDataSource();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertEquals( "something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )",
+                      method.toString() );
+    }
+
+    public void testSimpleFunctionCallWithFrom() throws Exception {
+
+        final RuleDescr rule = parseResource( "test_SimpleFunctionCallWithFrom.drl" ).rule();
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FromDescr from = (FromDescr) pattern.getSource();
+        final AccessorDescr func = (AccessorDescr) from.getDataSource();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertEquals( "doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )",
+                      func.toString() );
+    }
+
+    public void testSimpleAccessorWithFrom() throws Exception {
+
+        final RuleDescr rule = parseResource( "test_SimpleAccessorWithFrom.drl" ).rule();
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FromDescr from = (FromDescr) pattern.getSource();
+        final AccessorDescr accessor = (AccessorDescr) from.getDataSource();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertNull( ((FieldAccessDescr) accessor.getInvokers().get( 0 )).getArgument() );
+
+        assertEquals( "something.doIt",
+                      accessor.toString() );
+    }
+
+    public void testSimpleAccessorAndArgWithFrom() throws Exception {
+
+        final RuleDescr rule = parseResource( "test_SimpleAccessorArgWithFrom.drl" ).rule();
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FromDescr from = (FromDescr) pattern.getSource();
+        final AccessorDescr accessor = (AccessorDescr) from.getDataSource();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertNotNull( ((FieldAccessDescr) accessor.getInvokers().get( 0 )).getArgument() );
+
+        assertEquals( "something.doIt[\"key\"]",
+                      accessor.toString() );
+    }
+
+    public void testComplexChainedAcessor() throws Exception {
+        final RuleDescr rule = parseResource( "test_ComplexChainedCallWithFrom.drl" ).rule();
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FromDescr from = (FromDescr) pattern.getSource();
+        final AccessorDescr accessor = (AccessorDescr) from.getDataSource();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertEquals( "doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] ).doIt2(bar, [a, \"b\", 42]).field[\"key\"]",
+                      accessor.toString() );
+    }
+
+    //        public void testFrom() throws Exception {
+    //            final RuleDescr rule = parseResource( "from.drl" ).rule();
+    //
+    //            if(parser.hasErrors()) {
+    //                System.err.println(parser.getErrorMessages());
+    //            }
+    //            assertFalse(parser.hasErrors());
+    //
+    //            assertNotNull( rule );
+    //
+    //            assertEquals( "using_from",
+    //                          rule.getName() );
+    //
+    //            assertEquals(9, rule.getLhs().getDescrs().size());
+    //
+    //            FromDescr from = (FromDescr) rule.getLhs().getDescrs().get(0);
+    //
+    //            assertEquals(3, from.getLine());
+    //
+    //            assertEquals("Foo", from.getReturnedPattern().getObjectType());
+    //            assertTrue(from.getDataSource() instanceof FieldAccessDescr);
+    //            assertEquals("baz", ((FieldAccessDescr) from.getDataSource()).getFieldName());
+    //            assertEquals("bar", ((FieldAccessDescr) from.getDataSource()).getVariableName());
+    //
+    //
+    //            ArgumentValueDescr arg = null;
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(1);
+    //            assertEquals("Foo", from.getReturnedPattern().getObjectType());
+    //            assertEquals(0, from.getReturnedPattern().getDescrs().size());
+    //            FieldAccessDescr fieldAccess = ( FieldAccessDescr ) from.getDataSource();
+    //            arg = ( ArgumentValueDescr ) fieldAccess.getArgument();
+    //            assertEquals(ArgumentValueDescr.STRING,  arg.getType() );
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(2);
+    //            fieldAccess = ( FieldAccessDescr ) from.getDataSource();
+    //            arg = ( ArgumentValueDescr ) fieldAccess.getArgument();
+    //            assertEquals(ArgumentValueDescr.VARIABLE,  arg.getType() );
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(3);
+    //            fieldAccess = ( FieldAccessDescr ) from.getDataSource();
+    //            arg = ( ArgumentValueDescr ) fieldAccess.getArgument();
+    //            assertEquals(ArgumentValueDescr.INTEGRAL,  arg.getType() );
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(4);
+    //            assertEquals("Whee", from.getReturnedColumn().getObjectType());
+    //            assertEquals(1, from.getReturnedColumn().getDescrs().size());
+    //            assertTrue(from.getDataSource() instanceof FunctionCallDescr);
+    //            assertEquals("whee", ((FunctionCallDescr) from.getDataSource()).getName());
+    //            assertEquals(1, ((FunctionCallDescr) from.getDataSource()).getArguments().size());
+    //            arg = ( (ArgumentValueDescr )((FunctionCallDescr) from.getDataSource()).getArguments().get(0));
+    //            assertEquals("y", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.STRING, arg.getType());
+    //
+    //            assertEquals(7, from.getLine());
+    //            assertEquals(7, from.getReturnedColumn().getLine());
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(5);
+    //            assertEquals("Foo", from.getReturnedColumn().getObjectType());
+    //            assertEquals(1, from.getReturnedColumn().getDescrs().size());
+    //            assertEquals("f", from.getReturnedColumn().getIdentifier());
+    //            assertTrue(from.getDataSource() instanceof MethodAccessDescr);
+    //            assertEquals("bar", ((MethodAccessDescr) from.getDataSource()).getVariableName());
+    //            assertEquals("la", ((MethodAccessDescr) from.getDataSource()).getMethodName());
+    //            assertEquals(1, ((MethodAccessDescr) from.getDataSource()).getArguments().size());
+    //            arg = (ArgumentValueDescr) ((MethodAccessDescr) from.getDataSource()).getArguments().get(0);
+    //
+    //
+    //            assertEquals("x", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.VARIABLE, arg.getType());
+    //
+    //            assertEqualsIgnoreWhitespace("whee();", ( String ) rule.getConsequence());
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(6);
+    //            assertEquals("wa", ((FunctionCallDescr)from.getDataSource()).getName());
+    //
+    //            from = (FromDescr) rule.getLhs().getDescrs().get(7);
+    //            MethodAccessDescr meth = (MethodAccessDescr)from.getDataSource();
+    //            assertEquals("wa", meth.getMethodName());
+    //            assertEquals("la", meth.getVariableName());
+    //
+    //            arg = (ArgumentValueDescr) meth.getArguments().get(0);
+    //            assertEquals("42", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.INTEGRAL, arg.getType());
+    //
+    //            arg = (ArgumentValueDescr) meth.getArguments().get(1);
+    //            assertEquals("42.42", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.DECIMAL, arg.getType());
+    //
+    //            arg = (ArgumentValueDescr) meth.getArguments().get(2);
+    //            assertEquals("false", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.BOOLEAN, arg.getType());
+    //
+    //            arg = (ArgumentValueDescr) meth.getArguments().get(3);
+    //            assertEquals("null", arg.getValue());
+    //            assertEquals(ArgumentValueDescr.NULL, arg.getType());
+    //
+    //            assertEquals("Bam", ((PatternDescr)rule.getLhs().getDescrs().get(8)).getObjectType());
+    //        }
+
+    public void testSimpleRule() throws Exception {
+        final RuleDescr rule = parseResource( "simple_rule.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        assertEquals( 7,
+                      rule.getConsequenceLine() );
+        assertEquals( 2,
+                      rule.getConsequencePattern() );
+
+        final AndDescr lhs = rule.getLhs();
+
+        assertNotNull( lhs );
+
+        assertEquals( 3,
+                      lhs.getDescrs().size() );
+
+        //System.err.println( lhs.getDescrs() );
+
+        // Check first pattern
+        final PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "foo3",
+                      first.getIdentifier() );
+        assertEquals( "Bar",
+                      first.getObjectType() );
+
+        assertEquals( 1,
+                      first.getConstraint().getDescrs().size() );
+
+        AndDescr fieldAnd = (AndDescr) first.getConstraint();
+        FieldConstraintDescr fld = (FieldConstraintDescr) fieldAnd.getDescrs().get( 0 );
+        LiteralRestrictionDescr constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "3",
+                      constraint.getText() );
+
+        // Check second pattern
+        final PatternDescr second = (PatternDescr) lhs.getDescrs().get( 1 );
+        assertEquals( "foo4",
+                      second.getIdentifier() );
+        assertEquals( "Bar",
+                      second.getObjectType() );
+
+        //System.err.println( second.getDescrs() );
+
+        fieldAnd = (AndDescr) second.getConstraint();
+        assertEquals( 2,
+                      fieldAnd.getDescrs().size() );
+
+        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) fieldAnd.getDescrs().get( 0 );
+        assertEquals( "a",
+                      fieldBindingDescr.getFieldName() );
+        assertEquals( "a4",
+                      fieldBindingDescr.getIdentifier() );
+
+        fld = (FieldConstraintDescr) fieldAnd.getDescrs().get( 1 );
+        constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "4",
+                      constraint.getText() );
+
+        // Check third pattern
+        final PatternDescr third = (PatternDescr) lhs.getDescrs().get( 2 );
+        assertNull( third.getIdentifier() );
+        assertEquals( "Baz",
+                      third.getObjectType() );
+
+        assertEqualsIgnoreWhitespace( "if ( a == b ) { " + "  assert( foo3 );" + "} else {" + "  retract( foo4 );" + "}" + "  System.out.println( a4 );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testRestrictionsMultiple() throws Exception {
+        final RuleDescr rule = parseResource( "restrictions_test.drl" ).rule();
+
+        assertFalse( this.parser.getErrors().toString(),
+                     this.parser.hasErrors() );
+        assertNotNull( rule );
+
+        assertEqualsIgnoreWhitespace( "consequence();",
+                                      (String) rule.getConsequence() );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        //The first pattern, with 2 restrictions on a single field (plus a connective)
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        AndDescr and = (AndDescr) pattern.getConstraint();
+        FieldConstraintDescr fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        assertEquals( RestrictionConnectiveDescr.AND,
+                      ((RestrictionConnectiveDescr) fld.getRestriction()).getConnective() );
+        assertEquals( 2,
+                      fld.getRestrictions().size() );
+        assertEquals( "age",
+                      fld.getFieldName() );
+
+        LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( ">",
+                      lit.getEvaluator() );
+        assertEquals( "30",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 1 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "40",
+                      lit.getText() );
+
+        //the second col, with 2 fields, the first with 2 restrictions, the second field with one
+        pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Vehicle",
+                      pattern.getObjectType() );
+        assertEquals( 2,
+                      pattern.getConstraint().getDescrs().size() );
+
+        and = (AndDescr) pattern.getConstraint();
+        fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( 1,
+                      fld.getRestrictions().size() );
+        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fld.getRestrictions().get( 0 );
+        assertEquals( RestrictionConnectiveDescr.OR,
+                      or.getConnective() );
+        assertEquals( 2,
+                      or.getRestrictions().size() );
+        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "sedan",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "wagon",
+                      lit.getText() );
+
+        //now the second field
+        fld = (FieldConstraintDescr) and.getDescrs().get( 1 );
+        assertEquals( 1,
+                      fld.getRestrictions().size() );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "3",
+                      lit.getText() );
+
+    }
+
+    public void testLineNumberInAST() throws Exception {
+        //also see testSimpleExpander to see how this works with an expander (should be the same).
+
+        final RuleDescr rule = parseResource( "simple_rule.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        assertEquals( 7,
+                      rule.getConsequenceLine() );
+        assertEquals( 2,
+                      rule.getConsequencePattern() );
+
+        final AndDescr lhs = rule.getLhs();
+
+        assertNotNull( lhs );
+
+        assertEquals( 3,
+                      lhs.getDescrs().size() );
+
+        // Check first pattern
+        final PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "foo3",
+                      first.getIdentifier() );
+        assertEquals( "Bar",
+                      first.getObjectType() );
+        assertEquals( 1,
+                      first.getConstraint().getDescrs().size() );
+
+        // Check second pattern
+        final PatternDescr second = (PatternDescr) lhs.getDescrs().get( 1 );
+        assertEquals( "foo4",
+                      second.getIdentifier() );
+        assertEquals( "Bar",
+                      second.getObjectType() );
+
+        final PatternDescr third = (PatternDescr) lhs.getDescrs().get( 2 );
+        assertEquals( "Baz",
+                      third.getObjectType() );
+
+        assertEquals( 4,
+                      first.getLine() );
+        assertEquals( 5,
+                      second.getLine() );
+        assertEquals( 6,
+                      third.getLine() );
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testLineNumberIncludingCommentsInRHS() throws Exception {
+        parseResource( "test_CommentLineNumbersInConsequence.drl" ).compilation_unit();
+
+        assertFalse( this.parser.hasErrors() );
+        final String rhs = (String) ((RuleDescr) this.parser.getPackageDescr().getRules().get( 0 )).getConsequence();
+        String expected = "  \t//woot\n  \tfirst\n  \t\n  \t//\n  \t\n  \t/* lala\n  \t\n  \t*/\n  \tsecond  \n";
+        assertEquals( expected,
+                      rhs );
+    }
+
+    public void testLhsSemicolonDelim() throws Exception {
+        final RuleDescr rule = parseResource( "lhs_semicolon_delim.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        final AndDescr lhs = rule.getLhs();
+
+        assertNotNull( lhs );
+
+        assertEquals( 3,
+                      lhs.getDescrs().size() );
+
+        //System.err.println( lhs.getDescrs() );
+
+        // Check first pattern
+        final PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "foo3",
+                      first.getIdentifier() );
+        assertEquals( "Bar",
+                      first.getObjectType() );
+
+        assertEquals( 1,
+                      first.getConstraint().getDescrs().size() );
+
+        //LiteralDescr constraint = (LiteralDescr) first.getDescrs().get( 0 );
+        AndDescr and = (AndDescr) first.getConstraint();
+        FieldConstraintDescr fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        LiteralRestrictionDescr constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "3",
+                      constraint.getText() );
+
+        // Check second pattern
+        final PatternDescr second = (PatternDescr) lhs.getDescrs().get( 1 );
+        assertEquals( "foo4",
+                      second.getIdentifier() );
+        assertEquals( "Bar",
+                      second.getObjectType() );
+
+        and = (AndDescr) second.getConstraint();
+        assertEquals( 2,
+                      and.getDescrs().size() );
+
+        //System.err.println( second.getDescrs() );
+
+        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) and.getDescrs().get( 0 );
+        assertEquals( "a",
+                      fieldBindingDescr.getFieldName() );
+        assertEquals( "a4",
+                      fieldBindingDescr.getIdentifier() );
+
+        fld = (FieldConstraintDescr) and.getDescrs().get( 1 );
+
+        constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "4",
+                      constraint.getText() );
+
+        // Check third pattern
+        final PatternDescr third = (PatternDescr) lhs.getDescrs().get( 2 );
+        assertNull( third.getIdentifier() );
+        assertEquals( "Baz",
+                      third.getObjectType() );
+
+        assertEqualsIgnoreWhitespace( "if ( a == b ) { " + "  assert( foo3 );" + "} else {" + "  retract( foo4 );" + "}" + "  System.out.println( a4 );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testNotNode() throws Exception {
+        final RuleDescr rule = parseResource( "rule_not.drl" ).rule();
+
+        assertNotNull( rule );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        final AndDescr lhs = rule.getLhs();
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        final NotDescr not = (NotDescr) lhs.getDescrs().get( 0 );
+        assertEquals( 1,
+                      not.getDescrs().size() );
+        final PatternDescr pattern = (PatternDescr) not.getDescrs().get( 0 );
+
+        assertEquals( "Cheese",
+                      pattern.getObjectType() );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        final AndDescr and = (AndDescr) pattern.getConstraint();
+        final FieldConstraintDescr fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        final LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "stilton",
+                      lit.getText() );
+        assertEquals( "type",
+                      fld.getFieldName() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testFunctionImport() throws Exception {
+        final DRLParser parser = parseResource( "test_FunctionImport.drl" );
+        parser.compilation_unit();
+        assertFalse( parser.hasErrors() );
+
+        final PackageDescr pkg = parser.getPackageDescr();
+        assertEquals( 2,
+                      pkg.getFunctionImports().size() );
+
+        assertEquals( "abd.def.x",
+                      ((FunctionImportDescr) pkg.getFunctionImports().get( 0 )).getTarget() );
+        assertFalse( ((FunctionImportDescr) pkg.getFunctionImports().get( 0 )).getStartCharacter() == -1 );
+        assertFalse( ((FunctionImportDescr) pkg.getFunctionImports().get( 0 )).getEndCharacter() == -1 );
+        assertEquals( "qed.wah.*",
+                      ((FunctionImportDescr) pkg.getFunctionImports().get( 1 )).getTarget() );
+        assertFalse( ((FunctionImportDescr) pkg.getFunctionImports().get( 1 )).getStartCharacter() == -1 );
+        assertFalse( ((FunctionImportDescr) pkg.getFunctionImports().get( 1 )).getEndCharacter() == -1 );
+    }
+
+    public void testNotExistWithBrackets() throws Exception {
+
+        final DRLParser parser = parseResource( "not_exist_with_brackets.drl" );
+
+        parser.compilation_unit();
+        final PackageDescr pkg = parser.getPackageDescr();
+
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+
+        assertNotNull( rule );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        final AndDescr lhs = rule.getLhs();
+        assertEquals( 2,
+                      lhs.getDescrs().size() );
+        final NotDescr not = (NotDescr) lhs.getDescrs().get( 0 );
+        assertEquals( 1,
+                      not.getDescrs().size() );
+        final PatternDescr pattern = (PatternDescr) not.getDescrs().get( 0 );
+
+        assertEquals( "Cheese",
+                      pattern.getObjectType() );
+
+        final ExistsDescr ex = (ExistsDescr) lhs.getDescrs().get( 1 );
+        assertEquals( 1,
+                      ex.getDescrs().size() );
+        final PatternDescr exPattern = (PatternDescr) ex.getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      exPattern.getObjectType() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testNotBindindShouldBarf() throws Exception {
+        final DRLParser parser = parseResource( "not_with_binding_error.drl" );
+        parser.compilation_unit();
+        assertTrue( parser.hasErrors() );
+    }
+
+    public void testSimpleQuery() throws Exception {
+        final QueryDescr query = parseResource( "simple_query.drl" ).query();
+
+        assertNotNull( query );
+
+        assertEquals( "simple_query",
+                      query.getName() );
+
+        final AndDescr lhs = query.getLhs();
+
+        assertNotNull( lhs );
+
+        assertEquals( 3,
+                      lhs.getDescrs().size() );
+
+        // Check first pattern
+        final PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "foo3",
+                      first.getIdentifier() );
+        assertEquals( "Bar",
+                      first.getObjectType() );
+
+        assertEquals( 1,
+                      first.getConstraint().getDescrs().size() );
+
+        AndDescr and = (AndDescr) first.getConstraint();
+        FieldConstraintDescr fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        LiteralRestrictionDescr constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        //LiteralDescr constraint = (LiteralDescr) first.getDescrs().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "3",
+                      constraint.getText() );
+
+        // Check second pattern
+        final PatternDescr second = (PatternDescr) lhs.getDescrs().get( 1 );
+        assertEquals( "foo4",
+                      second.getIdentifier() );
+        assertEquals( "Bar",
+                      second.getObjectType() );
+
+        and = (AndDescr) second.getConstraint();
+        assertEquals( 2,
+                      and.getDescrs().size() );
+        //check it has field bindings.
+        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) and.getDescrs().get( 0 );
+        assertEquals( "a",
+                      fieldBindingDescr.getFieldName() );
+        assertEquals( "a4",
+                      fieldBindingDescr.getIdentifier() );
+
+        fld = (FieldConstraintDescr) and.getDescrs().get( 1 );
+
+        constraint = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertNotNull( constraint );
+
+        assertEquals( "a",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      constraint.getEvaluator() );
+        assertEquals( "4",
+                      constraint.getText() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testQueryRuleMixed() throws Exception {
+        final DRLParser parser = parseResource( "query_and_rule.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 4,
+                      pack.getRules().size() ); //as queries are rules
+        RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( "bar",
+                      rule.getName() );
+
+        QueryDescr query = (QueryDescr) pack.getRules().get( 1 );
+        assertEquals( "simple_query",
+                      query.getName() );
+
+        rule = (RuleDescr) pack.getRules().get( 2 );
+        assertEquals( "bar2",
+                      rule.getName() );
+
+        query = (QueryDescr) pack.getRules().get( 3 );
+        assertEquals( "simple_query2",
+                      query.getName() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testMultipleRules() throws Exception {
+        final DRLParser parser = parseResource( "multiple_rules.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pkg = parser.getPackageDescr();
+        final List rules = pkg.getRules();
+
+        assertEquals( 2,
+                      rules.size() );
+
+        final RuleDescr rule0 = (RuleDescr) rules.get( 0 );
+        assertEquals( "Like Stilton",
+                      rule0.getName() );
+
+        final RuleDescr rule1 = (RuleDescr) rules.get( 1 );
+        assertEquals( "Like Cheddar",
+                      rule1.getName() );
+
+        //checkout the first rule
+        AndDescr lhs = rule1.getLhs();
+        assertNotNull( lhs );
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        assertEqualsIgnoreWhitespace( "System.out.println(\"I like \" + t);",
+                                      (String) rule0.getConsequence() );
+
+        // Check first pattern
+        PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "Cheese",
+                      first.getObjectType() );
+
+        //checkout the second rule
+        lhs = rule1.getLhs();
+        assertNotNull( lhs );
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        assertEqualsIgnoreWhitespace( "System.out.println(\"I like \" + t);",
+                                      (String) rule1.getConsequence() );
+
+        // Check first pattern
+        first = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "Cheese",
+                      first.getObjectType() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testExpanderErrorsAfterExpansion() throws Exception {
+
+        final String name = "expander_post_errors.dslr";
+        final Expander expander = new DefaultExpander();
+        final String expanded = expander.expand( this.getReader( name ) );
+
+        final DRLParser parser = parse( name,
+                                        expanded );
+        parser.compilation_unit();
+        assertTrue( parser.hasErrors() );
+
+        final RecognitionException err = (RecognitionException) parser.getErrors().get( 0 );
+        assertEquals( 1,
+                      parser.getErrors().size() );
+
+        assertEquals( 5,
+                      err.line );
+    }
+
+    public void testExpanderLineSpread() throws Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( this.getReader( "expander_spread_lines.dslr" ),
+                                               this.getReader( "complex.dsl" ) );
+
+        assertFalse( parser.getErrors().toString(),
+                     parser.hasErrors() );
+
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+        assertNotNull( (String) rule.getConsequence() );
+
+    }
+
+    public void testExpanderMultipleConstraints() throws Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkg = parser.parse( this.getReader( "expander_multiple_constraints.dslr" ),
+                                               this.getReader( "multiple_constraints.dsl" ) );
+
+        assertFalse( parser.getErrors().toString(),
+                     parser.hasErrors() );
+
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+
+        assertEquals( 2,
+                      pattern.getConstraint().getDescrs().size() );
+        assertEquals( "age",
+                      ((FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 )).getFieldName() );
+        assertEquals( "location",
+                      ((FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 1 )).getFieldName() );
+
+        pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Bar",
+                      pattern.getObjectType() );
+
+        assertNotNull( (String) rule.getConsequence() );
+
+    }
+
+    public void testExpanderMultipleConstraintsFlush() throws Exception {
+        final DrlParser parser = new DrlParser();
+        //this is similar to the other test, but it requires a flush to add the constraints
+        final PackageDescr pkg = parser.parse( this.getReader( "expander_multiple_constraints_flush.dslr" ),
+                                               this.getReader( "multiple_constraints.dsl" ) );
+
+        assertFalse( parser.getErrors().toString(),
+                     parser.hasErrors() );
+
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+
+        assertEquals( 2,
+                      pattern.getConstraint().getDescrs().size() );
+        assertEquals( "age",
+                      ((FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 )).getFieldName() );
+        assertEquals( "location",
+                      ((FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 1 )).getFieldName() );
+
+        assertNotNull( (String) rule.getConsequence() );
+
+    }
+
+    //    public void testExpanderUnExpandableErrorLines() throws Exception {
+    //
+    //        //stubb expander
+    //        final ExpanderResolver res = new ExpanderResolver() {
+    //            public Expander get(String name,
+    //                                String config) {
+    //                return new Expander() {
+    //                    public String expand(String scope,
+    //                                         String pattern) {
+    //                        if ( pattern.startsWith( "Good" ) ) {
+    //                            return pattern;
+    //                        } else {
+    //                            throw new IllegalArgumentException( "whoops" );
+    //                        }
+    //
+    //                    }
+    //                };
+    //            }
+    //        };
+    //
+    //        final DRLParser parser = parseResource( "expander_line_errors.dslr" );
+    //        parser.setExpanderResolver( res );
+    //        parser.compilation_unit();
+    //        assertTrue( parser.hasErrors() );
+    //
+    //        final List messages = parser.getErrorMessages();
+    //        assertEquals( messages.size(),
+    //                      parser.getErrors().size() );
+    //
+    //        assertEquals( 4,
+    //                      parser.getErrors().size() );
+    //        assertEquals( ExpanderException.class,
+    //                      parser.getErrors().get( 0 ).getClass() );
+    //        assertEquals( 8,
+    //                      ((RecognitionException) parser.getErrors().get( 0 )).line );
+    //        assertEquals( 10,
+    //                      ((RecognitionException) parser.getErrors().get( 1 )).line );
+    //        assertEquals( 12,
+    //                      ((RecognitionException) parser.getErrors().get( 2 )).line );
+    //        assertEquals( 13,
+    //                      ((RecognitionException) parser.getErrors().get( 3 )).line );
+    //
+    //        final PackageDescr pack = parser.getPackageDescr();
+    //        assertNotNull( pack );
+    //
+    //        final ExpanderException ex = (ExpanderException) parser.getErrors().get( 0 );
+    //        assertTrue( ex.getMessage().indexOf( "whoops" ) > -1 );
+    //
+    //    }
+
+    public void testBasicBinding() throws Exception {
+        final DRLParser parser = parseResource( "basic_binding.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pkg = parser.getPackageDescr();
+        final RuleDescr ruleDescr = (RuleDescr) pkg.getRules().get( 0 );
+
+        final AndDescr lhs = ruleDescr.getLhs();
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        final PatternDescr cheese = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( 1,
+                      cheese.getConstraint().getDescrs().size() );
+        assertEquals( "Cheese",
+                      cheese.getObjectType() );
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        final FieldBindingDescr fieldBinding = (FieldBindingDescr) cheese.getConstraint().getDescrs().get( 0 );
+        assertEquals( "type",
+                      fieldBinding.getFieldName() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testBoundVariables() throws Exception {
+        final DRLParser parser = parseResource( "bindings.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pkg = parser.getPackageDescr();
+        final RuleDescr ruleDescr = (RuleDescr) pkg.getRules().get( 0 );
+
+        final AndDescr lhs = ruleDescr.getLhs();
+        assertEquals( 2,
+                      lhs.getDescrs().size() );
+        final PatternDescr cheese = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "Cheese",
+                      cheese.getObjectType() );
+        assertEquals( 2,
+                      lhs.getDescrs().size() );
+        FieldBindingDescr fieldBinding = (FieldBindingDescr) cheese.getConstraint().getDescrs().get( 0 );
+        assertEquals( "type",
+                      fieldBinding.getFieldName() );
+
+        FieldConstraintDescr fld = (FieldConstraintDescr) cheese.getConstraint().getDescrs().get( 1 );
+        LiteralRestrictionDescr literalDescr = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        //LiteralDescr literalDescr = (LiteralDescr) cheese.getDescrs().get( 1 );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      literalDescr.getEvaluator() );
+        assertEquals( "stilton",
+                      literalDescr.getText() );
+
+        final PatternDescr person = (PatternDescr) lhs.getDescrs().get( 1 );
+        fieldBinding = (FieldBindingDescr) person.getConstraint().getDescrs().get( 0 );
+        assertEquals( "name",
+                      fieldBinding.getFieldName() );
+
+        fld = (FieldConstraintDescr) person.getConstraint().getDescrs().get( 1 );
+        literalDescr = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "name",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      literalDescr.getEvaluator() );
+        assertEquals( "bob",
+                      literalDescr.getText() );
+
+        fld = (FieldConstraintDescr) person.getConstraint().getDescrs().get( 2 );
+        final VariableRestrictionDescr variableDescr = (VariableRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "likes",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      variableDescr.getEvaluator() );
+        assertEquals( "$type",
+                      variableDescr.getIdentifier() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testOrNesting() throws Exception {
+        final DRLParser parser = parseResource( "or_nesting.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertNotNull( pack );
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+
+        final PatternDescr first = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      first.getObjectType() );
+
+        final AndDescr and = (AndDescr) or.getDescrs().get( 1 );
+        assertEquals( 2,
+                      and.getDescrs().size() );
+
+        final PatternDescr left = (PatternDescr) and.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      left.getObjectType() );
+
+        final PatternDescr right = (PatternDescr) and.getDescrs().get( 1 );
+        assertEquals( "Cheese",
+                      right.getObjectType() );
+    }
+
+    /** Test that explicit "&&", "||" works as expected */
+    public void testAndOrRules() throws Exception {
+        final DRLParser parser = parseResource( "and_or_rule.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertNotNull( pack );
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+
+        //we will have 2 children under the main And node
+        final AndDescr and = rule.getLhs();
+        assertEquals( 2,
+                      and.getDescrs().size() );
+
+        //check the "&&" part
+        final AndDescr join = (AndDescr) and.getDescrs().get( 0 );
+        assertEquals( 2,
+                      join.getDescrs().size() );
+
+        PatternDescr left = (PatternDescr) join.getDescrs().get( 0 );
+        PatternDescr right = (PatternDescr) join.getDescrs().get( 1 );
+        assertEquals( "Person",
+                      left.getObjectType() );
+        assertEquals( "Cheese",
+                      right.getObjectType() );
+
+        assertEquals( 1,
+                      left.getConstraint().getDescrs().size() );
+
+        FieldConstraintDescr fld = (FieldConstraintDescr) left.getConstraint().getDescrs().get( 0 );
+        LiteralRestrictionDescr literal = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      literal.getEvaluator() );
+        assertEquals( "name",
+                      fld.getFieldName() );
+        assertEquals( "mark",
+                      literal.getText() );
+
+        assertEquals( 1,
+                      right.getConstraint().getDescrs().size() );
+
+        fld = (FieldConstraintDescr) right.getConstraint().getDescrs().get( 0 );
+        literal = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      literal.getEvaluator() );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( "stilton",
+                      literal.getText() );
+
+        //now the "||" part
+        final OrDescr or = (OrDescr) and.getDescrs().get( 1 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+        left = (PatternDescr) or.getDescrs().get( 0 );
+        right = (PatternDescr) or.getDescrs().get( 1 );
+        assertEquals( "Person",
+                      left.getObjectType() );
+        assertEquals( "Cheese",
+                      right.getObjectType() );
+        assertEquals( 1,
+                      left.getConstraint().getDescrs().size() );
+
+        fld = (FieldConstraintDescr) left.getConstraint().getDescrs().get( 0 );
+        literal = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      literal.getEvaluator() );
+        assertEquals( "name",
+                      fld.getFieldName() );
+        assertEquals( "mark",
+                      literal.getText() );
+
+        assertEquals( 1,
+                      right.getConstraint().getDescrs().size() );
+
+        fld = (FieldConstraintDescr) right.getConstraint().getDescrs().get( 0 );
+        literal = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "==",
+                      literal.getEvaluator() );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( "stilton",
+                      literal.getText() );
+
+        assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    /** test basic foo : Fact() || Fact() stuff */
+    public void testOrWithBinding() throws Exception {
+        final DRLParser parser = parseResource( "or_binding.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+
+        final PatternDescr leftPattern = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      leftPattern.getObjectType() );
+        assertEquals( "foo",
+                      leftPattern.getIdentifier() );
+
+        final PatternDescr rightPattern = (PatternDescr) or.getDescrs().get( 1 );
+        assertEquals( "Person",
+                      rightPattern.getObjectType() );
+        assertEquals( "foo",
+                      rightPattern.getIdentifier() );
+
+        final PatternDescr cheeseDescr = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Cheese",
+                      cheeseDescr.getObjectType() );
+        assertEquals( null,
+                      cheeseDescr.getIdentifier() );
+
+        assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    /** test basic foo : Fact() || Fact() stuff binding to an "or"*/
+    public void testOrBindingComplex() throws Exception {
+        final DRLParser parser = parseResource( "or_binding_complex.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+
+        //first fact
+        final PatternDescr firstFact = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      firstFact.getObjectType() );
+        assertEquals( "foo",
+                      firstFact.getIdentifier() );
+
+        //second "option"
+        final PatternDescr secondFact = (PatternDescr) or.getDescrs().get( 1 );
+        assertEquals( "Person",
+                      secondFact.getObjectType() );
+        assertEquals( 1,
+                      secondFact.getConstraint().getDescrs().size() );
+        assertEquals( "foo",
+                      secondFact.getIdentifier() );
+
+        assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testOrBindingWithBrackets() throws Exception {
+        final DRLParser parser = parseResource( "or_binding_with_brackets.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+
+        //first fact
+        final PatternDescr firstFact = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      firstFact.getObjectType() );
+        assertEquals( "foo",
+                      firstFact.getIdentifier() );
+
+        //second "option"
+        final PatternDescr secondFact = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      secondFact.getObjectType() );
+        assertEquals( "foo",
+                      secondFact.getIdentifier() );
+
+        assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    /** */
+    public void testBracketsPrecedence() throws Exception {
+        final DRLParser parser = parseResource( "brackets_precedence.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final AndDescr rootAnd = (AndDescr) rule.getLhs().getDescrs().get( 0 );
+
+        assertEquals( 2,
+                      rootAnd.getDescrs().size() );
+
+        final OrDescr leftOr = (OrDescr) rootAnd.getDescrs().get( 0 );
+
+        assertEquals( 2,
+                      leftOr.getDescrs().size() );
+        final NotDescr not = (NotDescr) leftOr.getDescrs().get( 0 );
+        final PatternDescr foo1 = (PatternDescr) not.getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      foo1.getObjectType() );
+        final PatternDescr foo2 = (PatternDescr) leftOr.getDescrs().get( 1 );
+        assertEquals( "Foo",
+                      foo2.getObjectType() );
+
+        final OrDescr rightOr = (OrDescr) rootAnd.getDescrs().get( 1 );
+
+        assertEquals( 2,
+                      rightOr.getDescrs().size() );
+        final PatternDescr shoes = (PatternDescr) rightOr.getDescrs().get( 0 );
+        assertEquals( "Shoes",
+                      shoes.getObjectType() );
+        final PatternDescr butt = (PatternDescr) rightOr.getDescrs().get( 1 );
+        assertEquals( "Butt",
+                      butt.getObjectType() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testEvalMultiple() throws Exception {
+        final DRLParser parser = parseResource( "eval_multiple.drl" );
+        parser.compilation_unit();
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 4,
+                      rule.getLhs().getDescrs().size() );
+
+        final EvalDescr eval = (EvalDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEqualsIgnoreWhitespace( "abc(\"foo\") + 5",
+                                      (String) eval.getContent() );
+
+        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Foo",
+                      pattern.getObjectType() );
+
+    }
+
+    public void testWithEval() throws Exception {
+        final DRLParser parser = parseResource( "with_eval.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 3,
+                      rule.getLhs().getDescrs().size() );
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      pattern.getObjectType() );
+        pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Bar",
+                      pattern.getObjectType() );
+
+        final EvalDescr eval = (EvalDescr) rule.getLhs().getDescrs().get( 2 );
+        assertEqualsIgnoreWhitespace( "abc(\"foo\")",
+                                      (String) eval.getContent() );
+        assertEqualsIgnoreWhitespace( "Kapow",
+                                      (String) rule.getConsequence() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testWithRetval() throws Exception {
+        final DRLParser parser = parseResource( "with_retval.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+        final PatternDescr col = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 1,
+                      col.getConstraint().getDescrs().size() );
+        assertEquals( "Foo",
+                      col.getObjectType() );
+        final FieldConstraintDescr fld = (FieldConstraintDescr) col.getConstraint().getDescrs().get( 0 );
+        final ReturnValueRestrictionDescr retval = (ReturnValueRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "a + b",
+                      retval.getContent() );
+        assertEquals( "name",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      retval.getEvaluator() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testWithPredicate() throws Exception {
+        final DRLParser parser = parseResource( "with_predicate.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+        final PatternDescr col = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        AndDescr and = (AndDescr) col.getConstraint();
+        assertEquals( 2,
+                      and.getDescrs().size() );
+
+        final FieldBindingDescr field = (FieldBindingDescr) and.getDescrs().get( 0 );
+        final PredicateDescr pred = (PredicateDescr) and.getDescrs().get( 1 );
+        assertEquals( "age",
+                      field.getFieldName() );
+        assertEquals( "$age2",
+                      field.getIdentifier() );
+        assertEqualsIgnoreWhitespace( "$age2 == $age1+2",
+                                      (String) pred.getContent() );
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+    }
+
+    public void testNotWithConstraint() throws Exception {
+        final DRLParser parser = parseResource( "not_with_constraint.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final FieldBindingDescr fieldBinding = (FieldBindingDescr) pattern.getConstraint().getDescrs().get( 0 );
+        assertEquals( "$likes",
+                      fieldBinding.getIdentifier() );
+
+        final NotDescr not = (NotDescr) rule.getLhs().getDescrs().get( 1 );
+        pattern = (PatternDescr) not.getDescrs().get( 0 );
+
+        final FieldConstraintDescr fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        final VariableRestrictionDescr boundVariable = (VariableRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      boundVariable.getEvaluator() );
+        assertEquals( "$likes",
+                      boundVariable.getIdentifier() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testGlobal() throws Exception {
+        final DRLParser parser = parseResource( "globals.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        assertEquals( 1,
+                      pack.getImports().size() );
+        assertEquals( 2,
+                      pack.getGlobals().size() );
+
+        final GlobalDescr foo = (GlobalDescr) pack.getGlobals().get( 0 );
+        assertEquals( "java.lang.String",
+                      foo.getType() );
+        assertEquals( "foo",
+                      foo.getIdentifier() );
+        final GlobalDescr bar = (GlobalDescr) pack.getGlobals().get( 1 );
+        assertEquals( "java.lang.Integer",
+                      bar.getType() );
+        assertEquals( "bar",
+                      bar.getIdentifier() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testFunctions() throws Exception {
+        final DRLParser parser = parseResource( "functions.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 2,
+                      pack.getRules().size() );
+
+        final List functions = pack.getFunctions();
+        assertEquals( 2,
+                      functions.size() );
+
+        FunctionDescr func = (FunctionDescr) functions.get( 0 );
+        assertEquals( "functionA",
+                      func.getName() );
+        assertEquals( "String",
+                      func.getReturnType() );
+        assertEquals( 2,
+                      func.getParameterNames().size() );
+        assertEquals( 2,
+                      func.getParameterTypes().size() );
+        assertEquals( 4,
+                      func.getLine() );
+        assertEquals( 0,
+                      func.getColumn() );
+
+        assertEquals( "String",
+                      func.getParameterTypes().get( 0 ) );
+        assertEquals( "s",
+                      func.getParameterNames().get( 0 ) );
+
+        assertEquals( "Integer",
+                      func.getParameterTypes().get( 1 ) );
+        assertEquals( "i",
+                      func.getParameterNames().get( 1 ) );
+
+        assertEqualsIgnoreWhitespace( "foo();",
+                                      func.getText() );
+
+        func = (FunctionDescr) functions.get( 1 );
+        assertEquals( "functionB",
+                      func.getName() );
+        assertEqualsIgnoreWhitespace( "bar();",
+                                      func.getText() );
+
+        assertFalse( parser.hasErrors() );
+    }
+
+    public void testComment() throws Exception {
+        final DRLParser parser = parseResource( "comment.drl" );
+        parser.compilation_unit();
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertNotNull( pack );
+
+        assertEquals( "foo.bar",
+                      pack.getName() );
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+    }
+
+    public void testAttributes() throws Exception {
+        final RuleDescr rule = parseResource( "rule_attributes.drl" ).rule();
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEqualsIgnoreWhitespace( "bar();",
+                                      (String) rule.getConsequence() );
+
+        final List attrs = rule.getAttributes();
+        assertEquals( 6,
+                      attrs.size() );
+
+        AttributeDescr at = (AttributeDescr) attrs.get( 0 );
+        assertEquals( "salience",
+                      at.getName() );
+        assertEquals( "42",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 1 );
+        assertEquals( "agenda-group",
+                      at.getName() );
+        assertEquals( "my_group",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 2 );
+        assertEquals( "no-loop",
+                      at.getName() );
+        assertEquals( "true",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 3 );
+        assertEquals( "duration",
+                      at.getName() );
+        assertEquals( "42",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 4 );
+        assertEquals( "activation-group",
+                      at.getName() );
+        assertEquals( "my_activation_group",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 5 );
+        assertEquals( "lock-on-active",
+                      at.getName() );
+        assertEquals( "true",
+                      at.getValue() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testAttributes_alternateSyntax() throws Exception {
+        final RuleDescr rule = parseResource( "rule_attributes_alt.drl" ).rule();
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEqualsIgnoreWhitespace( "bar();",
+                                      (String) rule.getConsequence() );
+
+        final List attrs = rule.getAttributes();
+        assertEquals( 6,
+                      attrs.size() );
+
+        AttributeDescr at = (AttributeDescr) attrs.get( 0 );
+        assertEquals( "salience",
+                      at.getName() );
+        assertEquals( "42",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 1 );
+        assertEquals( "agenda-group",
+                      at.getName() );
+        assertEquals( "my_group",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 2 );
+        assertEquals( "no-loop",
+                      at.getName() );
+        assertEquals( "true",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 3 );
+        assertEquals( "lock-on-active",
+                      at.getName() );
+        assertEquals( "true",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 4 );
+        assertEquals( "duration",
+                      at.getName() );
+        assertEquals( "42",
+                      at.getValue() );
+
+        at = (AttributeDescr) attrs.get( 5 );
+        assertEquals( "activation-group",
+                      at.getName() );
+        assertEquals( "my_activation_group",
+                      at.getValue() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testEnumeration() throws Exception {
+        final RuleDescr rule = parseResource( "enumeration.drl" ).rule();
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+        final PatternDescr col = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      col.getObjectType() );
+        assertEquals( 1,
+                      col.getConstraint().getDescrs().size() );
+        final FieldConstraintDescr fld = (FieldConstraintDescr) col.getConstraint().getDescrs().get( 0 );
+        final QualifiedIdentifierRestrictionDescr lit = (QualifiedIdentifierRestrictionDescr) fld.getRestrictions().get( 0 );
+
+        assertEquals( "bar",
+                      fld.getFieldName() );
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "Foo.BAR",
+                      lit.getText() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testInvalidSyntax_Catches() throws Exception {
+        parseResource( "invalid_syntax.drl" ).compilation_unit();
+        assertTrue( this.parser.hasErrors() );
+    }
+
+    public void testMultipleErrors() throws Exception {
+        parseResource( "multiple_errors.drl" ).compilation_unit();
+        assertTrue( this.parser.hasErrors() );
+        assertEquals( 2,
+                      this.parser.getErrors().size() );
+    }
+
+    public void testExtraLhsNewline() throws Exception {
+        parseResource( "extra_lhs_newline.drl" ).compilation_unit();
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testPackageGarbage() throws Exception {
+
+        parseResource( "package_garbage.drl" ).compilation_unit();
+        assertTrue( this.parser.hasErrors() );
+    }
+
+    public void testSoundsLike() throws Exception {
+        parseResource( "soundslike_operator.drl" ).compilation_unit();
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        RuleDescr rule = (RuleDescr) this.parser.getPackageDescr().getRules().get( 0 );
+        PatternDescr pat = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+
+        pat.getConstraint();
+    }
+
+    public void testPackageAttributes() throws Exception {
+        parseResource( "package_attributes.drl" ).compilation_unit();
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        PackageDescr pkg = this.parser.getPackageDescr();
+        AttributeDescr at = (AttributeDescr) pkg.getAttributes().get( 0 );
+        assertEquals( "agenda-group",
+                      at.getName() );
+        assertEquals( "x",
+                      at.getValue() );
+        at = (AttributeDescr) pkg.getAttributes().get( 1 );
+        assertEquals( "dialect",
+                      at.getName() );
+        assertEquals( "java",
+                      at.getValue() );
+
+        assertEquals( 2,
+                      pkg.getRules().size() );
+
+        assertEquals( 2,
+                      pkg.getImports().size() );
+
+        RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( "bar",
+                      rule.getName() );
+        at = (AttributeDescr) rule.getAttributes().get( 0 );
+        assertEquals( "agenda-group",
+                      at.getName() );
+        assertEquals( "x",
+                      at.getValue() );
+        at = (AttributeDescr) rule.getAttributes().get( 1 );
+        assertEquals( "dialect",
+                      at.getName() );
+        assertEquals( "java",
+                      at.getValue() );
+
+        rule = (RuleDescr) pkg.getRules().get( 1 );
+        assertEquals( "baz",
+                      rule.getName() );
+        at = (AttributeDescr) rule.getAttributes().get( 0 );
+        assertEquals( "dialect",
+                      at.getName() );
+        assertEquals( "mvel",
+                      at.getValue() );
+        at = (AttributeDescr) rule.getAttributes().get( 1 );
+        assertEquals( "agenda-group",
+                      at.getName() );
+        assertEquals( "x",
+                      at.getValue() );
+
+    }
+
+    public void testStatementOrdering1() throws Exception {
+        parseResource( "statement_ordering_1.drl" );
+        this.parser.compilation_unit();
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+
+        assertEquals( 2,
+                      pkg.getRules().size() );
+
+        assertEquals( "foo",
+                      ((RuleDescr) pkg.getRules().get( 0 )).getName() );
+        assertEquals( "bar",
+                      ((RuleDescr) pkg.getRules().get( 1 )).getName() );
+
+        assertEquals( 2,
+                      pkg.getFunctions().size() );
+
+        assertEquals( "cheeseIt",
+                      ((FunctionDescr) pkg.getFunctions().get( 0 )).getName() );
+        assertEquals( "uncheeseIt",
+                      ((FunctionDescr) pkg.getFunctions().get( 1 )).getName() );
+
+        assertEquals( 4,
+                      pkg.getImports().size() );
+        assertEquals( "im.one",
+                      ((ImportDescr) pkg.getImports().get( 0 )).getTarget() );
+        assertEquals( "im.two",
+                      ((ImportDescr) pkg.getImports().get( 1 )).getTarget() );
+        assertEquals( "im.three",
+                      ((ImportDescr) pkg.getImports().get( 2 )).getTarget() );
+        assertEquals( "im.four",
+                      ((ImportDescr) pkg.getImports().get( 3 )).getTarget() );
+
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testRuleNamesStartingWithNumbers() throws Exception {
+        parseResource( "rule_names_number_prefix.drl" ).compilation_unit();
+
+        assertFalse( this.parser.getErrors().toString(),
+                     this.parser.hasErrors() );
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+
+        assertEquals( 2,
+                      pkg.getRules().size() );
+
+        assertEquals( "1. Do Stuff!",
+                      ((RuleDescr) pkg.getRules().get( 0 )).getName() );
+        assertEquals( "2. Do More Stuff!",
+                      ((RuleDescr) pkg.getRules().get( 1 )).getName() );
+    }
+
+    public void testEvalWithNewline() throws Exception {
+        parseResource( "eval_with_newline.drl" ).compilation_unit();
+
+        if ( this.parser.hasErrors() ) {
+            System.err.println( this.parser.getErrorMessages() );
+        }
+        assertFalse( this.parser.hasErrors() );
+    }
+
+    public void testEvalWithSemicolon() throws Exception {
+        parseResource( "eval_with_semicolon.drl" ).compilation_unit();
+
+        assertTrue( this.parser.hasErrors() );
+        assertEquals( 1,
+                      this.parser.getErrorMessages().size() );
+        assertTrue( ((String) this.parser.getErrorMessages().get( 0 )).indexOf( "Trailing semi-colon not allowed" ) >= 0 );
+    }
+
+    public void testEndPosition() throws Exception {
+        parseResource( "test_EndPosition.drl" ).compilation_unit();
+        final RuleDescr rule = (RuleDescr) this.parser.getPackageDescr().getRules().get( 0 );
+        final PatternDescr col = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( 6,
+                      col.getLine() );
+
+        assertEquals( 8,
+                      col.getEndLine() );
+
+    }
+
+    public void testQualifiedClassname() throws Exception {
+        parseResource( "qualified_classname.drl" ).compilation_unit();
+
+        assertFalse( this.parser.hasErrors() );
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
+
+        final PatternDescr p = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+
+        assertEquals( "com.cheeseco.Cheese",
+                      p.getObjectType() );
+    }
+
+    public void testAccumulate() throws Exception {
+        final DRLParser parser = parseResource( "accumulate.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr outPattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accum = (AccumulateDescr) outPattern.getSource();
+        assertEqualsIgnoreWhitespace( "int x = 0 ;",
+                                      accum.getInitCode() );
+        assertEqualsIgnoreWhitespace( "x++;",
+                                      accum.getActionCode() );
+        assertNull( accum.getReverseCode() );
+        assertEqualsIgnoreWhitespace( "new Integer(x)",
+                                      accum.getResultCode() );
+
+        assertFalse( accum.isExternalFunction() );
+
+        final PatternDescr pattern = (PatternDescr) accum.getInputPattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+    }
+
+    public void testAccumulateWithBindings() throws Exception {
+        final DRLParser parser = parseResource( "accumulate_with_bindings.drl" );
+        parser.compilation_unit();
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr outPattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accum = (AccumulateDescr) outPattern.getSource();
+        assertEqualsIgnoreWhitespace( "$counter",
+                                      outPattern.getIdentifier() );
+        assertEqualsIgnoreWhitespace( "int x = 0 ;",
+                                      accum.getInitCode() );
+        assertEqualsIgnoreWhitespace( "x++;",
+                                      accum.getActionCode() );
+        assertEqualsIgnoreWhitespace( "new Integer(x)",
+                                      accum.getResultCode() );
+
+        final PatternDescr pattern = (PatternDescr) accum.getInputPattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+    }
+
+    public void testCollect() throws Exception {
+        final DRLParser parser = parseResource( "collect.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr outPattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final CollectDescr collect = (CollectDescr) outPattern.getSource();
+
+        final PatternDescr pattern = (PatternDescr) collect.getInputPattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+    }
+
+    public void testPredicate() throws Exception {
+        final PatternDescr pattern = new PatternDescr();
+        parse( "$var : attr -> ( $var.equals(\"xyz\") )" ).constraints( pattern );
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        final List constraints = pattern.getConstraint().getDescrs();
+        assertEquals( 2,
+                      constraints.size() );
+
+        final FieldBindingDescr field = (FieldBindingDescr) constraints.get( 0 );
+        final PredicateDescr predicate = (PredicateDescr) constraints.get( 1 );
+        assertEquals( "$var",
+                      field.getIdentifier() );
+        assertEquals( "attr",
+                      field.getFieldName() );
+        assertEquals( " $var.equals(\"xyz\") ",
+                      predicate.getContent() );
+    }
+
+    public void testPredicate2() throws Exception {
+        final PatternDescr pattern = new PatternDescr();
+        // predicates are also prefixed by the eval keyword
+        parse( "eval( $var.equals(\"xyz\") )" ).constraints( pattern );
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        final List constraints = pattern.getConstraint().getDescrs();
+        assertEquals( 1,
+                      constraints.size() );
+
+        final PredicateDescr predicate = (PredicateDescr) constraints.get( 0 );
+        assertEquals( " $var.equals(\"xyz\") ",
+                      predicate.getContent() );
+    }
+
+    public void testEscapedStrings() throws Exception {
+        final RuleDescr rule = parseResource( "escaped-string.drl" ).rule();
+
+        assertNotNull( rule );
+
+        assertEquals( "test_Quotes",
+                      rule.getName() );
+
+        final String expected = "String s = \"\\\"\\n\\t\\\\\";";
+
+        assertEqualsIgnoreWhitespace( expected,
+                                      (String) rule.getConsequence() );
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+    }
+
+    public void testNestedCEs() throws Exception {
+        final RuleDescr rule = parseResource( "nested_conditional_elements.drl" ).rule();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        assertNotNull( rule );
+
+        final AndDescr root = rule.getLhs();
+        final NotDescr not1 = (NotDescr) root.getDescrs().get( 0 );
+        final AndDescr and1 = (AndDescr) not1.getDescrs().get( 0 );
+
+        final PatternDescr state = (PatternDescr) and1.getDescrs().get( 0 );
+        final NotDescr not2 = (NotDescr) and1.getDescrs().get( 1 );
+        final AndDescr and2 = (AndDescr) not2.getDescrs().get( 0 );
+        final PatternDescr person = (PatternDescr) and2.getDescrs().get( 0 );
+        final PatternDescr cheese = (PatternDescr) and2.getDescrs().get( 1 );
+
+        final PatternDescr person2 = (PatternDescr) root.getDescrs().get( 1 );
+        final OrDescr or = (OrDescr) root.getDescrs().get( 2 );
+        final PatternDescr cheese2 = (PatternDescr) or.getDescrs().get( 0 );
+        final PatternDescr cheese3 = (PatternDescr) or.getDescrs().get( 1 );
+
+        assertEquals( state.getObjectType(),
+                      "State" );
+        assertEquals( person.getObjectType(),
+                      "Person" );
+        assertEquals( cheese.getObjectType(),
+                      "Cheese" );
+        assertEquals( person2.getObjectType(),
+                      "Person" );
+        assertEquals( cheese2.getObjectType(),
+                      "Cheese" );
+        assertEquals( cheese3.getObjectType(),
+                      "Cheese" );
+    }
+
+    public void testForall() throws Exception {
+        final DRLParser parser = parseResource( "forall.drl" );
+        parser.compilation_unit();
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final ForallDescr forall = (ForallDescr) rule.getLhs().getDescrs().get( 0 );
+
+        assertEquals( 2,
+                      forall.getDescrs().size() );
+        final PatternDescr pattern = forall.getBasePattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+        final List remaining = forall.getRemainingPatterns();
+        assertEquals( 1,
+                      remaining.size() );
+        final PatternDescr cheese = (PatternDescr) remaining.get( 0 );
+        assertEquals( "Cheese",
+                      cheese.getObjectType() );
+    }
+
+    public void testMemberof() throws Exception {
+        final String text = "Country( $cities : city )\nPerson( city memberOf $cities )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+
+        assertEquals( 2,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 1 );
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        VariableRestrictionDescr restr = (VariableRestrictionDescr) fieldConstr.getRestrictions().get( 0 );
+
+        assertEquals( "memberOf",
+                      restr.getEvaluator() );
+        assertFalse( restr.isNegated() );
+        assertEquals( "$cities",
+                      restr.getIdentifier() );
+    }
+
+    public void testNotMemberof() throws Exception {
+        final String text = "Country( $cities : city )\nPerson( city not memberOf $cities )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+
+        assertEquals( 2,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 1 );
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        VariableRestrictionDescr restr = (VariableRestrictionDescr) fieldConstr.getRestrictions().get( 0 );
+
+        assertEquals( "memberOf",
+                      restr.getEvaluator() );
+        assertTrue( restr.isNegated() );
+        assertEquals( "$cities",
+                      restr.getIdentifier() );
+    }
+
+    public void testInOperator() throws Exception {
+        final RuleDescr rule = parseResource( "in_operator_test.drl" ).rule();
+
+        assertFalse( this.parser.getErrors().toString(),
+                     this.parser.hasErrors() );
+        assertNotNull( rule );
+
+        assertEqualsIgnoreWhitespace( "consequence();",
+                                      (String) rule.getConsequence() );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        //The first pattern, with 2 restrictions on a single field (plus a connective)
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        FieldConstraintDescr fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        assertEquals( RestrictionConnectiveDescr.AND,
+                      fld.getRestriction().getConnective() );
+        assertEquals( 2,
+                      fld.getRestrictions().size() );
+        assertEquals( "age",
+                      fld.getFieldName() );
+
+        LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( ">",
+                      lit.getEvaluator() );
+        assertEquals( "30",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 1 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "40",
+                      lit.getText() );
+
+        //the second col, with 2 fields, the first with 2 restrictions, the second field with one
+        pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Vehicle",
+                      pattern.getObjectType() );
+        assertEquals( 2,
+                      pattern.getConstraint().getDescrs().size() );
+
+        fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( 1,
+                      fld.getRestrictions().size() );
+
+        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fld.getRestrictions().get( 0 );
+        assertEquals( RestrictionConnectiveDescr.OR,
+                      or.getConnective() );
+        assertEquals( 2,
+                      or.getRestrictions().size() );
+
+        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "sedan",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );
+        assertEquals( "==",
+                      lit.getEvaluator() );
+        assertEquals( "wagon",
+                      lit.getText() );
+
+        //now the second field
+        fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 1 );
+        assertEquals( 1,
+                      fld.getRestrictions().size() );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "3",
+                      lit.getText() );
+
+    }
+
+    public void testNotInOperator() throws Exception {
+        final RuleDescr rule = parseResource( "notin_operator_test.drl" ).rule();
+
+        assertFalse( this.parser.getErrors().toString(),
+                     this.parser.hasErrors() );
+        assertNotNull( rule );
+
+        assertEqualsIgnoreWhitespace( "consequence();",
+                                      (String) rule.getConsequence() );
+        assertEquals( "simple_rule",
+                      rule.getName() );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        //The first pattern, with 2 restrictions on a single field (plus a connective)
+        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+        assertEquals( 1,
+                      pattern.getConstraint().getDescrs().size() );
+
+        FieldConstraintDescr fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        assertEquals( 2,
+                      fld.getRestrictions().size() );
+        assertEquals( "age",
+                      fld.getFieldName() );
+
+        LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( ">",
+                      lit.getEvaluator() );
+        assertEquals( "30",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 1 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "40",
+                      lit.getText() );
+
+        //the second col, with 2 fields, the first with 2 restrictions, the second field with one
+        pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "Vehicle",
+                      pattern.getObjectType() );
+        assertEquals( 2,
+                      pattern.getConstraint().getDescrs().size() );
+
+        fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
+        assertEquals( 2,
+                      fld.getRestrictions().size() );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( "type",
+                      fld.getFieldName() );
+        assertEquals( "!=",
+                      lit.getEvaluator() );
+        assertEquals( "sedan",
+                      lit.getText() );
+
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 1 );
+        assertEquals( "!=",
+                      lit.getEvaluator() );
+        assertEquals( "wagon",
+                      lit.getText() );
+
+        //now the second field
+        fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 1 );
+        assertEquals( 1,
+                      fld.getRestrictions().size() );
+        lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
+        assertEquals( "<",
+                      lit.getEvaluator() );
+        assertEquals( "3",
+                      lit.getText() );
+
+    }
+
+    public void testConstraintAndConnective() throws Exception {
+        final String text = "Person( age < 42 && location==\"atlanta\")";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 2,
+                      pattern.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) pattern.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        fcd = (FieldConstraintDescr) pattern.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+    }
+
+    public void testConstraintOrConnective() throws Exception {
+        final String text = "Person( age < 42 || location==\"atlanta\")";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+        OrDescr or = (OrDescr) pattern.getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) or.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        fcd = (FieldConstraintDescr) or.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+    }
+
+    public void testConstraintConnectivesPrecedence() throws Exception {
+        final String text = "Person( age < 42 && location==\"atlanta\" || age > 20 && location==\"Seatle\" || location == \"Chicago\")";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+        OrDescr or = (OrDescr) pattern.getDescrs().get( 0 );
+        assertEquals( 3,
+                      or.getDescrs().size() );
+
+        AndDescr and = (AndDescr) or.getDescrs().get( 0 );
+        assertEquals( 2,
+                      and.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( "<",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "42",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) and.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "atlanta",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        and = (AndDescr) or.getDescrs().get( 1 );
+        assertEquals( 2,
+                      and.getDescrs().size() );
+        fcd = (FieldConstraintDescr) and.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( ">",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "20",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) and.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "Seatle",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        fcd = (FieldConstraintDescr) or.getDescrs().get( 2 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "Chicago",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+    }
+
+    public void testConstraintConnectivesPrecedenceWithBracks() throws Exception {
+        final String text = "Person( age < 42 && ( location==\"atlanta\" || age > 20 && location==\"Seatle\") || location == \"Chicago\")";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+        OrDescr or1 = (OrDescr) pattern.getDescrs().get( 0 );
+        assertEquals( 2,
+                      or1.getDescrs().size() );
+
+        AndDescr and1 = (AndDescr) or1.getDescrs().get( 0 );
+        assertEquals( 2,
+                      and1.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) and1.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( "<",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "42",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        OrDescr or2 = (OrDescr) and1.getDescrs().get( 1 );
+        fcd = (FieldConstraintDescr) or2.getDescrs().get( 0 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "atlanta",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        AndDescr and2 = (AndDescr) or2.getDescrs().get( 1 );
+        assertEquals( 2,
+                      and2.getDescrs().size() );
+        fcd = (FieldConstraintDescr) and2.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( ">",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "20",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) and2.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "Seatle",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        fcd = (FieldConstraintDescr) or1.getDescrs().get( 1 );
+        assertEquals( "location",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "Chicago",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+    }
+
+    public void testConstraintConnectivesPrecedenceWithBracks2() throws Exception {
+        final String text = "Person( ( age == 70 && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ) )";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+        OrDescr or1 = (OrDescr) pattern.getDescrs().get( 0 );
+        assertEquals( 3,
+                      or1.getDescrs().size() );
+
+        AndDescr and1 = (AndDescr) or1.getDescrs().get( 0 );
+        AndDescr and2 = (AndDescr) or1.getDescrs().get( 1 );
+        AndDescr and3 = (AndDescr) or1.getDescrs().get( 2 );
+
+        assertEquals( 2,
+                      and1.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) and1.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "70",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) and1.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "black",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        assertEquals( 2,
+                      and2.getDescrs().size() );
+        fcd = (FieldConstraintDescr) and2.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "40",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) and2.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "pink",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        assertEquals( 2,
+                      and3.getDescrs().size() );
+        fcd = (FieldConstraintDescr) and3.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "12",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        OrDescr or2 = (OrDescr) and3.getDescrs().get( 1 );
+        fcd = (FieldConstraintDescr) or2.getDescrs().get( 0 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "yellow",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+        fcd = (FieldConstraintDescr) or2.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "blue",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+    }
+
+    public void testRestrictionConnectives() throws Exception {
+
+        // the expression bellow must generate the following tree:
+        //
+        //                       AND
+        //                        |
+        //                       OR
+        //        /---------------+-------------------\
+        //       AND             AND                 AND
+        //    /---+---\       /---+---\           /---+---\
+        //   FC       FC     FC       FC         FC       OR
+        //                                             /---+---\
+        //                                            FC       FC
+        //
+        final String text = "Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ))";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.fact( null );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+
+        OrDescr orConstr = (OrDescr) pattern.getDescrs().get( 0 );
+
+        assertEquals( 3,
+                      orConstr.getDescrs().size() );
+
+        AndDescr andConstr1 = (AndDescr) orConstr.getDescrs().get( 0 );
+
+        FieldConstraintDescr fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fcd.getRestriction().getRestrictions().get( 0 );
+        RestrictionConnectiveDescr and1 = (RestrictionConnectiveDescr) or.getRestrictions().get( 0 );
+        RestrictionConnectiveDescr and2 = (RestrictionConnectiveDescr) or.getRestrictions().get( 1 );
+
+        assertEquals( ">",
+                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "60",
+                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getText() );
+
+        assertEquals( "<",
+                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getEvaluator() );
+        assertEquals( "70",
+                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getText() );
+
+        assertEquals( ">",
+                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "50",
+                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getText() );
+
+        assertEquals( "<",
+                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getEvaluator() );
+        assertEquals( "55",
+                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getText() );
+
+        fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "black",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        AndDescr andConstr2 = (AndDescr) orConstr.getDescrs().get( 1 );
+        assertEquals( 2,
+                      andConstr2.getDescrs().size() );
+        fcd = (FieldConstraintDescr) andConstr2.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "40",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        fcd = (FieldConstraintDescr) andConstr2.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "pink",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        AndDescr andConstr3 = (AndDescr) orConstr.getDescrs().get( 2 );
+        assertEquals( 2,
+                      andConstr3.getDescrs().size() );
+        fcd = (FieldConstraintDescr) andConstr3.getDescrs().get( 0 );
+        assertEquals( "age",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "12",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        OrDescr orConstr2 = (OrDescr) andConstr3.getDescrs().get( 1 );
+
+        fcd = (FieldConstraintDescr) orConstr2.getDescrs().get( 0 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "yellow",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+        fcd = (FieldConstraintDescr) orConstr2.getDescrs().get( 1 );
+        assertEquals( "hair",
+                      fcd.getFieldName() );
+
+        assertEquals( "==",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getEvaluator() );
+        assertEquals( "blue",
+                      ((LiteralRestrictionDescr) fcd.getRestrictions().get( 0 )).getText() );
+
+    }
+
+    public void testNotContains() throws Exception {
+        final String text = "City( $city : city )\nCountry( cities not contains $city )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 2,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 1 );
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        VariableRestrictionDescr restr = (VariableRestrictionDescr) fieldConstr.getRestrictions().get( 0 );
+
+        assertEquals( "contains",
+                      restr.getEvaluator() );
+        assertTrue( restr.isNegated() );
+        assertEquals( "$city",
+                      restr.getIdentifier() );
+    }
+
+    public void testNotMatches() throws Exception {
+        final String text = "Message( text not matches '[abc]*' )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 0 );
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        LiteralRestrictionDescr restr = (LiteralRestrictionDescr) fieldConstr.getRestrictions().get( 0 );
+
+        assertEquals( "matches",
+                      restr.getEvaluator() );
+        assertTrue( restr.isNegated() );
+        assertEquals( "[abc]*",
+                      restr.getText() );
+    }
+
+    public void testRestrictions() throws Exception {
+        final String text = "Foo( bar > 1 || == 1 )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 0 );
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fieldConstr.getRestrictions().get( 0 );
+        LiteralRestrictionDescr gt1 = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
+        LiteralRestrictionDescr eq1 = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );
+
+        assertEquals( ">",
+                      gt1.getEvaluator() );
+        assertEquals( false,
+                      gt1.isNegated() );
+        assertEquals( 1,
+                      ((Number) eq1.getValue()).intValue() );
+        assertEquals( "==",
+                      eq1.getEvaluator() );
+        assertEquals( false,
+                      eq1.isNegated() );
+        assertEquals( 1,
+                      ((Number) eq1.getValue()).intValue() );
+
+    }
+
+    public void testSemicolon() throws Exception {
+        parseResource( "semicolon.drl" );
+
+        this.parser.compilation_unit();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+        assertEquals( "org.drools",
+                      pkg.getName() );
+        assertEquals( 1,
+                      pkg.getGlobals().size() );
+        assertEquals( 3,
+                      pkg.getRules().size() );
+
+        final RuleDescr rule1 = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 2,
+                      rule1.getLhs().getDescrs().size() );
+
+        final RuleDescr query1 = (RuleDescr) pkg.getRules().get( 1 );
+        assertEquals( 3,
+                      query1.getLhs().getDescrs().size() );
+
+        final RuleDescr rule2 = (RuleDescr) pkg.getRules().get( 2 );
+        assertEquals( 2,
+                      rule2.getLhs().getDescrs().size() );
+    }
+
+    public void testEval() throws Exception {
+        parseResource( "eval_parsing.drl" );
+
+        this.parser.compilation_unit();
+
+        assertFalse( this.parser.getErrorMessages().toString(),
+                     this.parser.hasErrors() );
+
+        final PackageDescr pkg = this.parser.getPackageDescr();
+        assertEquals( "org.drools",
+                      pkg.getName() );
+        assertEquals( 1,
+                      pkg.getRules().size() );
+
+        final RuleDescr rule1 = (RuleDescr) pkg.getRules().get( 0 );
+        assertEquals( 1,
+                      rule1.getLhs().getDescrs().size() );
+    }
+
+    public void testAccumulateReverse() throws Exception {
+        final DRLParser parser = parseResource( "accumulateReverse.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr out = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accum = (AccumulateDescr) out.getSource();
+        assertEqualsIgnoreWhitespace( "int x = 0 ;",
+                                      accum.getInitCode() );
+        assertEqualsIgnoreWhitespace( "x++;",
+                                      accum.getActionCode() );
+        assertEqualsIgnoreWhitespace( "x--;",
+                                      accum.getReverseCode() );
+        assertEqualsIgnoreWhitespace( "new Integer(x)",
+                                      accum.getResultCode() );
+        assertFalse( accum.isExternalFunction() );
+
+        final PatternDescr pattern = (PatternDescr) accum.getInputPattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+    }
+
+    public void testAccumulateExternalFunction() throws Exception {
+        final DRLParser parser = parseResource( "accumulateExternalFunction.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr out = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accum = (AccumulateDescr) out.getSource();
+        assertEqualsIgnoreWhitespace( "$age",
+                                      accum.getExpression() );
+        assertEqualsIgnoreWhitespace( "average",
+                                      accum.getFunctionIdentifier() );
+        assertTrue( accum.isExternalFunction() );
+
+        final PatternDescr pattern = (PatternDescr) accum.getInputPattern();
+        assertEquals( "Person",
+                      pattern.getObjectType() );
+    }
+
+    public void testCollectWithNestedFrom() throws Exception {
+        final DRLParser parser = parseResource( "collect_with_nested_from.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr out = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final CollectDescr collect = (CollectDescr) out.getSource();
+
+        PatternDescr person = (PatternDescr) collect.getInputPattern();
+        assertEquals( "Person",
+                      person.getObjectType() );
+
+        final CollectDescr collect2 = (CollectDescr) person.getSource();
+
+        final PatternDescr people = collect2.getInputPattern();
+        assertEquals( "People",
+                      people.getObjectType() );
+    }
+
+    public void testAccumulateWithNestedFrom() throws Exception {
+        final DRLParser parser = parseResource( "accumulate_with_nested_from.drl" );
+        parser.compilation_unit();
+
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+
+        assertFalse( parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr out = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accumulate = (AccumulateDescr) out.getSource();
+
+        PatternDescr person = (PatternDescr) accumulate.getInputPattern();
+        assertEquals( "Person",
+                      person.getObjectType() );
+
+        final CollectDescr collect2 = (CollectDescr) person.getSource();
+
+        final PatternDescr people = collect2.getInputPattern();
+        assertEquals( "People",
+                      people.getObjectType() );
+    }
+
+    public void testAccessorPaths() throws Exception {
+        final String text = "org   .   drools/*comment*/\t  .Message( text not matches $c#comment\n. property )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      descrs.getDescrs().size() );
+        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 0 );
+        assertEquals( "org.drools.Message",
+                      pat.getObjectType() );
+
+        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
+        QualifiedIdentifierRestrictionDescr restr = (QualifiedIdentifierRestrictionDescr) fieldConstr.getRestrictions().get( 0 );
+
+        assertEquals( "matches",
+                      restr.getEvaluator() );
+        assertTrue( restr.isNegated() );
+        assertEquals( "$c.property",
+                      restr.getText() );
+    }
+
+    public void testOrCE() throws Exception {
+        final DRLParser parser = parseResource( "or_ce.drl" );
+        parser.compilation_unit();
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 2,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr person = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "Person",
+                      person.getObjectType() );
+        assertEquals( "$p",
+                      person.getIdentifier() );
+
+        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+
+        final PatternDescr cheese1 = (PatternDescr) or.getDescrs().get( 0 );
+        assertEquals( "Cheese",
+                      cheese1.getObjectType() );
+        assertEquals( "$c",
+                      cheese1.getIdentifier() );
+        final PatternDescr cheese2 = (PatternDescr) or.getDescrs().get( 1 );
+        assertEquals( "Cheese",
+                      cheese2.getObjectType() );
+        assertNull( cheese2.getIdentifier() );
+    }
+
+    public void testRuleParseLhs2() throws Exception {
+        final String text = "Message( Message.HELLO )\n";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        assertTrue( parser.hasErrors() );
+    }
+
+    public void testRuleSingleLine() throws Exception {
+        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( 10 );
+        RuleDescr rule = parser.rule();
+
+        assertFalse( parser.hasErrors() );
+        assertEquals( "another test",
+                      rule.getName() );
+        assertEquals( "System.out.println(1); ",
+                      rule.getConsequence() );
+    }
+
+    public void testRuleTwoLines() throws Exception {
+        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\n end";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( 10 );
+        RuleDescr rule = parser.rule();
+
+        assertFalse( parser.hasErrors() );
+        assertEquals( "another test",
+                      rule.getName() );
+        assertEquals( "System.out.println(1);\n ",
+                      rule.getConsequence() );
+    }
+
+    public void testRuleParseLhs3() throws Exception {
+        final String text = "(or\nnot Person()\n(and Cheese()\nMeat()\nWine()))";
+        final AndDescr descrs = new AndDescr();
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+        parser.setLineOffset( descrs.getLine() );
+        parser.normal_lhs_block( descrs );
+        if ( parser.hasErrors() ) {
+            System.err.println( parser.getErrorMessages() );
+        }
+        assertFalse( parser.hasErrors() );
+        assertEquals( 1,
+                      descrs.getDescrs().size() );
+        OrDescr or = (OrDescr) descrs.getDescrs().get( 0 );
+        assertEquals( 2,
+                      or.getDescrs().size() );
+        NotDescr not = (NotDescr) or.getDescrs().get( 0 );
+        AndDescr and = (AndDescr) or.getDescrs().get( 1 );
+        assertEquals( 1,
+                      not.getDescrs().size() );
+        PatternDescr person = (PatternDescr) not.getDescrs().get( 0 );
+        assertEquals( "Person",
+                      person.getObjectType() );
+        assertEquals( 3,
+                      and.getDescrs().size() );
+        PatternDescr cheese = (PatternDescr) and.getDescrs().get( 0 );
+        assertEquals( "Cheese",
+                      cheese.getObjectType() );
+        PatternDescr meat = (PatternDescr) and.getDescrs().get( 1 );
+        assertEquals( "Meat",
+                      meat.getObjectType() );
+        PatternDescr wine = (PatternDescr) and.getDescrs().get( 2 );
+        assertEquals( "Wine",
+                      wine.getObjectType() );
+
+    }
+
+    public void testAccumulateMultiPattern() throws Exception {
+        final DRLParser parser = parseResource( "accumulate_multi_pattern.drl" );
+        parser.compilation_unit();
+
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 1,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr outPattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        final AccumulateDescr accum = (AccumulateDescr) outPattern.getSource();
+        assertEqualsIgnoreWhitespace( "$counter",
+                                      outPattern.getIdentifier() );
+        assertEqualsIgnoreWhitespace( "int x = 0 ;",
+                                      accum.getInitCode() );
+        assertEqualsIgnoreWhitespace( "x++;",
+                                      accum.getActionCode() );
+        assertEqualsIgnoreWhitespace( "new Integer(x)",
+                                      accum.getResultCode() );
+
+        final AndDescr and = (AndDescr) accum.getInput();
+        assertEquals( 2,
+                      and.getDescrs().size() );
+        final PatternDescr person = (PatternDescr) and.getDescrs().get( 0 );
+        final PatternDescr cheese = (PatternDescr) and.getDescrs().get( 1 );
+        assertEquals( "Person",
+                      person.getObjectType() );
+        assertEquals( "Cheese",
+                      cheese.getObjectType() );
+    }
+
+    public void testErrorMessageForMisplacedParenthesis() throws Exception {
+        final DRLParser parser = parseResource( "misplaced_parenthesis.drl" );
+        parser.compilation_unit();
+
+        assertTrue( "Parser should have raised errors",
+                    parser.hasErrors() );
+
+        for ( Iterator it = parser.getErrors().iterator(); it.hasNext(); ) {
+            Object error = it.next();
+            if ( !(error instanceof MismatchedTokenException) ) {
+                fail( "Error should be an instance of MismatchedTokenException" );
+            }
+        }
+
+    }
+
+    public void testNPEOnParser() throws Exception {
+        final DRLParser parser = parseResource( "npe_on_parser.drl" );
+        parser.compilation_unit();
+
+        assertTrue( "Parser should have raised errors",
+                    parser.hasErrors() );
+
+        List errors = parser.getErrors();
+        assertEquals( 2,
+                      errors.size() );
+
+        assertTrue( errors.get( 0 ) instanceof MismatchedTokenException ); // "action" is a reserved word
+        assertTrue( errors.get( 1 ) instanceof NoViableAltException ); // no title in the rule
+
+    }
+
+    public void testCommaMisuse() throws Exception {
+        final DRLParser parser = parseResource( "comma_misuse.drl" );
+        try {
+            parser.compilation_unit();
+
+            assertTrue( "Parser should have raised errors",
+                        parser.hasErrors() );
+            assertEquals( 3,
+                          parser.getErrors().size() );
+
+        } catch ( NullPointerException npe ) {
+            fail( "Should not raise NPE" );
+        }
+    }
+
+    public void testPluggableOperators() throws Exception {
+        final DRLParser parser = parseResource( "pluggable_operators.drl" );
+        parser.compilation_unit();
+
+        assertFalse( "Parser should not have raised errors: " + parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+        assertEquals( 1,
+                      pack.getRules().size() );
+        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
+        assertEquals( 5,
+                      rule.getLhs().getDescrs().size() );
+
+        final PatternDescr eventA = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
+        assertEquals( "$a",
+                      eventA.getIdentifier() );
+        assertEquals( "EventA",
+                      eventA.getObjectType() );
+
+        final PatternDescr eventB = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
+        assertEquals( "$b",
+                      eventB.getIdentifier() );
+        assertEquals( "EventB",
+                      eventB.getObjectType() );
+        assertEquals( 1,
+                      eventB.getConstraint().getDescrs().size() );
+        final FieldConstraintDescr fcdB = (FieldConstraintDescr) eventB.getConstraint().getDescrs().get( 0 );
+        assertEquals( 1,
+                      fcdB.getRestrictions().size() );
+        assertTrue( fcdB.getRestrictions().get( 0 ) instanceof VariableRestrictionDescr );
+        final VariableRestrictionDescr rb = (VariableRestrictionDescr) fcdB.getRestrictions().get( 0 );
+        assertEquals( "after",
+                      rb.getEvaluator() );
+        assertEquals( "$a",
+                      rb.getText() );
+        assertEquals( "1,10",
+                      rb.getParameterText() );
+        assertFalse( rb.isNegated() );
+
+        final PatternDescr eventC = (PatternDescr) rule.getLhs().getDescrs().get( 2 );
+        assertEquals( "$c",
+                      eventC.getIdentifier() );
+        assertEquals( "EventC",
+                      eventC.getObjectType() );
+        assertEquals( 1,
+                      eventC.getConstraint().getDescrs().size() );
+        final FieldConstraintDescr fcdC = (FieldConstraintDescr) eventC.getConstraint().getDescrs().get( 0 );
+        assertEquals( 1,
+                      fcdC.getRestrictions().size() );
+        assertTrue( fcdC.getRestrictions().get( 0 ) instanceof VariableRestrictionDescr );
+        final VariableRestrictionDescr rc = (VariableRestrictionDescr) fcdC.getRestrictions().get( 0 );
+        assertEquals( "finishes",
+                      rc.getEvaluator() );
+        assertEquals( "$b",
+                      rc.getText() );
+        assertNull( rc.getParameterText() );
+        assertFalse( rc.isNegated() );
+
+        final PatternDescr eventD = (PatternDescr) rule.getLhs().getDescrs().get( 3 );
+        assertEquals( "$d",
+                      eventD.getIdentifier() );
+        assertEquals( "EventD",
+                      eventD.getObjectType() );
+        assertEquals( 1,
+                      eventD.getConstraint().getDescrs().size() );
+        final FieldConstraintDescr fcdD = (FieldConstraintDescr) eventD.getConstraint().getDescrs().get( 0 );
+        assertEquals( 1,
+                      fcdD.getRestrictions().size() );
+        assertTrue( fcdD.getRestrictions().get( 0 ) instanceof VariableRestrictionDescr );
+        final VariableRestrictionDescr rd = (VariableRestrictionDescr) fcdD.getRestrictions().get( 0 );
+        assertEquals( "starts",
+                      rd.getEvaluator() );
+        assertEquals( "$a",
+                      rd.getText() );
+        assertNull( rd.getParameterText() );
+        assertTrue( rd.isNegated() );
+
+        final PatternDescr eventE = (PatternDescr) rule.getLhs().getDescrs().get( 4 );
+        assertEquals( "$e",
+                      eventE.getIdentifier() );
+        assertEquals( "EventE",
+                      eventE.getObjectType() );
+        assertEquals( 1,
+                      eventE.getConstraint().getDescrs().size() );
+        final FieldConstraintDescr fcdE = (FieldConstraintDescr) eventE.getConstraint().getDescrs().get( 0 );
+        assertEquals( 1,
+                      fcdE.getRestrictions().size() );
+        assertTrue( fcdE.getRestrictions().get( 0 ) instanceof VariableRestrictionDescr );
+        final VariableRestrictionDescr re = (VariableRestrictionDescr) fcdE.getRestrictions().get( 0 );
+        assertEquals( "before",
+                      re.getEvaluator() );
+        assertEquals( "$b",
+                      re.getText() );
+        assertEquals( "1, 10",
+                      re.getParameterText() );
+        assertTrue( re.isNegated() );
+    }
+
+    public void testTypeDeclaration() throws Exception {
+        final DRLParser parser = parseResource( "declare_type.drl" );
+        parser.compilation_unit();
+
+        assertFalse( "Parser should not raise errors: " + parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        final PackageDescr pack = parser.getPackageDescr();
+
+        final List<TypeDeclarationDescr> declarations = pack.getTypeDeclarations();
+
+        assertEquals( 1,
+                      declarations.size() );
+
+        final TypeDeclarationDescr descr = declarations.get( 0 );
+        assertEquals( "event",
+                      descr.getAttribute( "type" ) );
+        assertEquals( "org.drools.events.Call",
+                      descr.getAttribute( "class" ) );
+        assertEquals( "duration",
+                      descr.getAttribute( "duration_attribute" ) );
+        assertEquals( "pseudo",
+                      descr.getAttribute( "clock_strategy" ) );
+    }
+
+    public void testEntryPoint() throws Exception {
+        final String text = "StockTick( symbol==\"ACME\") from entry-point StreamA";
+        final CharStream charStream = new ANTLRStringStream( text );
+        final DRLLexer lexer = new DRLLexer( charStream );
+        final TokenStream tokenStream = new CommonTokenStream( lexer );
+        final DRLParser parser = new DRLParser( tokenStream );
+
+        PatternDescr pattern = (PatternDescr) parser.pattern_source();
+        assertFalse( parser.getErrorMessages().toString(),
+                     parser.hasErrors() );
+
+        assertEquals( 1,
+                      pattern.getDescrs().size() );
+        FieldConstraintDescr fcd = (FieldConstraintDescr) pattern.getDescrs().get( 0 );
+        assertEquals( "symbol",
+                      fcd.getFieldName() );
+
+        assertNotNull( pattern.getSource() );
+        EntryPointDescr entry = (EntryPointDescr) pattern.getSource();
+        assertEquals( "StreamA",
+                      entry.getEntryId() );
+    }
+
+    private DRLParser parse(final String text) throws Exception {
+        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+        return this.parser;
+    }
+
+    private DRLParser parse(final String source,
+                            final String text) throws Exception {
+        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+        this.parser.setSource( source );
+        return this.parser;
+    }
+
+    private Reader getReader(final String name) throws Exception {
+        final InputStream in = getClass().getResourceAsStream( name );
+
+        return new InputStreamReader( in );
+    }
+
+    private DRLParser parseResource(final String name) throws Exception {
+
+        //        System.err.println( getClass().getResource( name ) );
+        final Reader reader = getReader( name );
+
+        final StringBuffer text = new StringBuffer();
+
+        final char[] buf = new char[1024];
+        int len = 0;
+
+        while ( (len = reader.read( buf )) >= 0 ) {
+            text.append( buf,
+                         0,
+                         len );
+        }
+
+        return parse( name,
+                      text.toString() );
+    }
+
+    private CharStream newCharStream(final String text) {
+        return new ANTLRStringStream( text );
+    }
+
+    private DRLLexer newLexer(final CharStream charStream) {
+        return new DRLLexer( charStream );
+    }
+
+    private TokenStream newTokenStream(final Lexer lexer) {
+        return new CommonTokenStream( lexer );
+    }
+
+    private DRLParser newParser(final TokenStream tokenStream) {
+        final DRLParser p = new DRLParser( tokenStream );
+        //p.setParserDebug( true );
+        return p;
+    }
+
+    private void assertEqualsIgnoreWhitespace(final String expected,
+                                              final String actual) {
+        final String cleanExpected = expected.replaceAll( "\\s+",
+                                                          "" );
+        final String cleanActual = actual.replaceAll( "\\s+",
+                                                      "" );
+
+        assertEquals( cleanExpected,
+                      cleanActual );
+    }
+
+    private void prettyPrintErrors() {
+        final List msgs = this.parser.getErrorMessages();
+        for ( final Iterator iter = msgs.iterator(); iter.hasNext(); ) {
+            final String err = (String) iter.next();
+            System.out.println( err );
+
+        }
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/AndDescrTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/AndDescrTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/AndDescrTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.lang.descr;
+
+import junit.framework.TestCase;
+
+public class AndDescrTest extends TestCase {
+
+    public void testAddUnboundPatternsEtc() {
+        final AndDescr and = new AndDescr();
+        and.addDescr( new NotDescr() );
+        and.addDescr( new PatternDescr( "Foo" ) );
+        and.addDescr( new NotDescr() );
+
+        assertEquals( 3,
+                      and.getDescrs().size() );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/PackageDescrTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/PackageDescrTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/descr/PackageDescrTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+package org.drools.lang.descr;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class PackageDescrTest extends TestCase {
+
+    public void testAttributeOverriding() {
+        PackageDescr desc = new PackageDescr("foo");
+        
+        AttributeDescr at1 = new AttributeDescr("foo", "bar");
+        AttributeDescr at2 = new AttributeDescr("foo2", "default");
+        
+        desc.addAttribute( at1 );
+        desc.addAttribute( at2 );
+        
+        RuleDescr rule = new RuleDescr("abc");
+        rule.addAttribute( new AttributeDescr("foo", "overridden") );
+        
+        desc.addRule( rule );
+        
+        List pkgAts = desc.getAttributes();
+        assertEquals("bar", ((AttributeDescr)pkgAts.get( 0 )).getValue());
+        assertEquals("default", ((AttributeDescr)pkgAts.get( 1 )).getValue());
+        
+        
+        List ruleAts = rule.getAttributes();
+        assertEquals("overridden", ((AttributeDescr)ruleAts.get( 0 )).getValue());
+        assertEquals("default", ((AttributeDescr)ruleAts.get( 1 )).getValue());
+        
+        
+        
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DSLMappingFileTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DSLMappingFileTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DSLMappingFileTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,177 @@
+package org.drools.lang.dsl;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+public class DSLMappingFileTest extends TestCase {
+    private DSLMappingFile file     = null;
+    private final String   filename = "test_metainfo.dsl";
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testParseFile() {
+        try {
+            final Reader reader = new InputStreamReader( this.getClass().getResourceAsStream( this.filename ) );
+            this.file = new DSLMappingFile();
+
+            final boolean parsingResult = this.file.parseAndLoad( reader );
+            reader.close();
+
+            assertTrue( this.file.getErrors().toString(),
+                        parsingResult );
+            assertTrue( this.file.getErrors().isEmpty() );
+
+            assertEquals( 31,
+                          this.file.getMapping().getEntries().size() );
+        } catch ( final IOException e ) {
+            e.printStackTrace();
+            fail( "Should not raise exception " );
+        }
+
+    }
+
+    public void testParseFileWithBrackets() {
+        String file = "[when][]ATTRIBUTE \"{attr}\" IS IN [{list}]=Attribute( {attr} in ({list}) )";
+        try {
+            final Reader reader = new StringReader( file );
+            this.file = new DSLMappingFile();
+
+            final boolean parsingResult = this.file.parseAndLoad( reader );
+            reader.close();
+
+            assertTrue( this.file.getErrors().toString(),
+                        parsingResult );
+            assertTrue( this.file.getErrors().isEmpty() );
+
+            assertEquals( 1,
+                          this.file.getMapping().getEntries().size() );
+
+            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );
+
+            assertEquals( DSLMappingEntry.CONDITION,
+                          entry.getSection() );
+            assertEquals( DSLMappingEntry.EMPTY_METADATA,
+                          entry.getMetaData() );
+            assertEquals( "ATTRIBUTE \"{attr}\" IS IN [{list}]",
+                          entry.getMappingKey() );
+            assertEquals( "Attribute( {attr} in ({list}) )",
+                          entry.getMappingValue() );
+
+        } catch ( final IOException e ) {
+            e.printStackTrace();
+            fail( "Should not raise exception " );
+        }
+    }
+
+    public void testParseFileWithEscaptedBrackets() {
+        String file = "[when][]ATTRIBUTE \"{attr}\" IS IN \\[{list}\\]=Attribute( {attr} in ({list}) )";
+        try {
+            final Reader reader = new StringReader( file );
+            this.file = new DSLMappingFile();
+
+            final boolean parsingResult = this.file.parseAndLoad( reader );
+            reader.close();
+
+            assertTrue( this.file.getErrors().toString(),
+                        parsingResult );
+            assertTrue( this.file.getErrors().isEmpty() );
+
+            assertEquals( 1,
+                          this.file.getMapping().getEntries().size() );
+
+            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );
+
+            assertEquals( DSLMappingEntry.CONDITION,
+                          entry.getSection() );
+            assertEquals( DSLMappingEntry.EMPTY_METADATA,
+                          entry.getMetaData() );
+            assertEquals( "ATTRIBUTE \"{attr}\" IS IN \\[{list}\\]",
+                          entry.getMappingKey() );
+            assertEquals( "Attribute( {attr} in ({list}) )",
+                          entry.getMappingValue() );
+
+        } catch ( final IOException e ) {
+            e.printStackTrace();
+            fail( "Should not raise exception " );
+        }
+
+    }
+
+    public void testParseFileWithEscapes() {
+        String file = "[then]TEST=System.out.println(\"DO_SOMETHING\");\n" + 
+                      "[when]code {code1} occurs and sum of all digit not equal \\( {code2} \\+ {code3} \\)=AAAA( cd1 == {code1}, cd2 != ( {code2} + {code3} ))\n" + 
+                      "[when]code {code1} occurs=BBBB\n";
+        try {
+            final Reader reader = new StringReader( file );
+            this.file = new DSLMappingFile();
+
+            final boolean parsingResult = this.file.parseAndLoad( reader );
+            reader.close();
+
+            assertTrue( this.file.getErrors().toString(),
+                        parsingResult );
+            assertTrue( this.file.getErrors().isEmpty() );
+            
+            final String LHS = "code 1041 occurs and sum of all digit not equal ( 1034 + 1035 )";
+            final String rule = "rule \"x\"\nwhen\n" + LHS + "\nthen\nTEST\nend";
+
+            DefaultExpander de = new DefaultExpander();
+            de.addDSLMapping(this.file.getMapping());
+                    
+            final String ruleAfterExpansion = de.expand(rule);
+            
+            final String expected = "rule \"x\"\nwhen\nAAAA( cd1 == 1041, cd2 != ( 1034 + 1035 ))\nthen\nSystem.out.println(\"DO_SOMETHING\");\nend\n";
+            
+            assertEquals( expected, ruleAfterExpansion );
+            
+        } catch ( final IOException e ) {
+            e.printStackTrace();
+            fail( "Should not raise exception " );
+        }
+
+    }
+
+    public void testParseFileWithEscaptedEquals() {
+        String file = "[when][]something:\\={value}=Attribute( something == \"{value}\" )";
+        try {
+            final Reader reader = new StringReader( file );
+            this.file = new DSLMappingFile();
+
+            final boolean parsingResult = this.file.parseAndLoad( reader );
+            reader.close();
+
+            assertTrue( this.file.getErrors().toString(),
+                        parsingResult );
+            assertTrue( this.file.getErrors().isEmpty() );
+
+            assertEquals( 1,
+                          this.file.getMapping().getEntries().size() );
+
+            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );
+
+            assertEquals( DSLMappingEntry.CONDITION,
+                          entry.getSection() );
+            assertEquals( DSLMappingEntry.EMPTY_METADATA,
+                          entry.getMetaData() );
+            assertEquals( "something:={value}",
+                          entry.getMappingKey() );
+            assertEquals( "Attribute( something == \"{value}\" )",
+                          entry.getMappingValue() );
+
+        } catch ( final IOException e ) {
+            e.printStackTrace();
+            fail( "Should not raise exception " );
+        }
+
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultDSLMappingEntryTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultDSLMappingEntryTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultDSLMappingEntryTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,253 @@
+package org.drools.lang.dsl;
+
+import junit.framework.TestCase;
+
+public class DefaultDSLMappingEntryTest extends TestCase {
+
+    private DSLMappingEntry entry;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        setupEntry();
+    }
+
+    private void setupEntry() {
+        final String inputKey = "String is \"{value}\"";
+        final String inputValue = "SomeFact(value==\"{value}\")";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testPatternCalculation() {
+        final String inputKey = "The Customer name is {name} and surname is {surname} and it has US$ 50,00 on his {pocket}";
+        final String inputValue = "Customer( name == \"{name}\", surname == \"{surname}\", money > $money )";
+
+        final String expectedKeyP = "(\\W|^)The\\s+Customer\\s+name\\s+is\\s+(.*?)\\s+and\\s+surname\\s+is\\s+(.*?)\\s+and\\s+it\\s+has\\s+US\\$\\s+50,00\\s+on\\s+his\\s+(.*?)$";
+        final String expectedValP = "Customer( name == \"$2\", surname == \"$3\", money > \\$money )";
+
+        final DSLMappingEntry entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                                            null,
+                                                            inputKey,
+                                                            inputValue );
+
+        assertEquals( inputKey,
+                      entry.getMappingKey() );
+        assertEquals( expectedKeyP,
+                      entry.getKeyPattern().pattern() );
+        assertEquals( inputValue,
+                      entry.getMappingValue() );
+        assertEquals( expectedValP,
+                      entry.getValuePattern() );
+
+    }
+
+    public void testPatternCalculation2() {
+        final String inputKey = "-name is {name}";
+        final String inputValue = "name == \"{name}\"";
+
+        final String expectedKeyP = "(\\W|^)-\\s*name\\s+is\\s+(.*?)$";
+        final String expectedValP = "name == \"$2\"";
+
+        final DSLMappingEntry entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                                            null,
+                                                            inputKey,
+                                                            inputValue );
+
+        assertEquals( inputKey,
+                      entry.getMappingKey() );
+        assertEquals( expectedKeyP,
+                      entry.getKeyPattern().pattern() );
+        assertEquals( inputValue,
+                      entry.getMappingValue() );
+        assertEquals( expectedValP,
+                      entry.getValuePattern() );
+
+    }
+
+    public void testPatternCalculation3() {
+        final String inputKey = "- name is {name}";
+        final String inputValue = "name == \"{name}\"";
+
+        final String expectedKeyP = "(\\W|^)-\\s*name\\s+is\\s+(.*?)$";
+        final String expectedValP = "name == \"$2\"";
+
+        final DSLMappingEntry entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                                            null,
+                                                            inputKey,
+                                                            inputValue );
+
+        assertEquals( inputKey,
+                      entry.getMappingKey() );
+        assertEquals( entry.getKeyPattern().pattern(),
+                      expectedKeyP,
+                      entry.getKeyPattern().pattern() );
+        assertEquals( inputValue,
+                      entry.getMappingValue() );
+        assertEquals( expectedValP,
+                      entry.getValuePattern() );
+    }
+
+    public void testExpandNoSpaces() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"blah\"" ).replaceAll( this.entry.getValuePattern() );
+
+        assertEquals( "SomeFact(value==\"blah\")",
+                      result );
+    }
+
+    public void testExpandWithLeadingSpace() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \" blah\"" ).replaceAll( this.entry.getValuePattern() );
+
+        assertEquals( "SomeFact(value==\" blah\")",
+                      result );
+    }
+
+    public void testExpandWithMultipleLeadingSpaces() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"   blah\"" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( "SomeFact(value==\"   blah\")",
+                      result );
+    }
+
+    public void testExpandWithTrailingSpace() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"blah \"" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( "SomeFact(value==\"blah \")",
+                      result );
+    }
+
+    public void testExpandWithMultipleTrailingSpaces() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"blah  \"" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( "SomeFact(value==\"blah  \")",
+                      result );
+    }
+
+    public void testExpandWithInternalSpace() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"bl ah\"" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( "SomeFact(value==\"bl ah\")",
+                      result );
+    }
+
+    public void testExpandWithMultipleSpaces() {
+        this.setupEntry();
+        final String result = this.entry.getKeyPattern().matcher( "String is \"  bl  ah  \"" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( "SomeFact(value==\"  bl  ah  \")",
+                      result );
+    }
+    
+    public void testExpandWithDots() {
+        final String inputKey = "- {prop} is {val} ";
+        final String inputValue = "{prop} == {val}";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+        
+        String result = this.entry.getKeyPattern().matcher( "- type is ClientServiceType.TypeGOLD" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "type == ClientServiceType.TypeGOLD",
+                      result );
+    }
+    
+    public void testExpandPartialWords() {
+        final String inputKey = "- {prop} is {val} ";
+        final String inputValue = "{prop} == {val}";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+        // not supposed to expand
+        String result = this.entry.getKeyPattern().matcher( "- type is_not ClientServiceType.TypeGOLD" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "- type is_not ClientServiceType.TypeGOLD",
+                      result );
+    }
+    
+    public void testExpandPartialWords2() {
+        final String inputKey = "- {prop} is_not {val} ";
+        final String inputValue = "{prop} != {val}";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+
+        String result = this.entry.getKeyPattern().matcher( "- type is_not ClientServiceType.TypeGOLD" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "type != ClientServiceType.TypeGOLD",
+                      result );
+    }
+    
+    public void testExpandPartialWords3() {
+        final String inputKey = "- {prop} is not {val} ";
+        final String inputValue = "{prop} != {val}";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+
+        String result = this.entry.getKeyPattern().matcher( "- type is not ClientServiceType.TypeGOLD" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "type != ClientServiceType.TypeGOLD",
+                      result );
+    }
+    
+    public void testExpandWithBrackets() {
+        final String inputKey = "attr {attr_name} is in \\[ {values} \\]";
+        final String inputValue = "{attr_name} in ( {values} )";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+
+        String result = this.entry.getKeyPattern().matcher( "attr name is in [ 'Edson', 'Bob' ]" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "name in ( 'Edson', 'Bob' )",
+                      result );
+    }
+    
+    public void testExpandWithParethesis() {
+        final String inputKey = "((H|h)e|(S|s)he) \\(is\\) (a|an) $xx {attribute} (man|woman)";
+        final String inputValue = "Person( attribute == \"{attribute}\" )";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+
+        String result = this.entry.getKeyPattern().matcher( "he (is) a $xx handsome man" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "Person( attribute == \"handsome\" )",
+                      result );
+    }
+    
+    public void testSingleCharacterBetweenVars() {
+        final String inputKey = "DSL sentence with {key1} {key2}";
+        final String inputValue = "Sentence( {key1} == {key2} )";
+
+        this.entry = new DefaultDSLMappingEntry( DSLMappingEntry.CONDITION,
+                                            null,
+                                            inputKey,
+                                            inputValue );
+
+        String result = this.entry.getKeyPattern().matcher( "DSL sentence with mykey myvalue" ).replaceAll( this.entry.getValuePattern() );
+        assertEquals( result,
+                      "Sentence( mykey == myvalue )",
+                      result );
+    }
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultExpanderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultExpanderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/lang/dsl/DefaultExpanderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,131 @@
+package org.drools.lang.dsl;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+
+import org.drools.lang.ExpanderException;
+
+public class DefaultExpanderTest extends TestCase {
+    private DSLMappingFile  file     = null;
+    private DefaultExpander expander = null;
+
+    protected void setUp() throws Exception {
+        final String filename = "test_metainfo.dsl";
+        final Reader reader = new InputStreamReader( this.getClass().getResourceAsStream( filename ) );
+        this.file = new DSLMappingFile();
+        this.file.parseAndLoad( reader );
+        reader.close();
+
+        this.expander = new DefaultExpander();
+
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testAddDSLMapping() {
+        this.expander.addDSLMapping( this.file.getMapping() );
+        // should not raise any exception
+    }
+
+    public void testRegexp() throws Exception {
+        this.expander.addDSLMapping( this.file.getMapping() );
+        final Reader rules = new InputStreamReader( this.getClass().getResourceAsStream( "test_expansion.dslr" ) );
+        final String result = this.expander.expand( rules );
+    }
+
+    
+    public void testExpandParts() throws Exception {
+        DSLMappingFile file = new DSLMappingFile();
+        String dsl = "[when]foo=Foo()\n[then]bar {num}=baz({num});";
+        file.parseAndLoad( new StringReader( dsl ) );
+        assertEquals( 0,
+                      file.getErrors().size() );
+        DefaultExpander ex = new DefaultExpander();
+        ex.addDSLMapping( file.getMapping() );
+        
+        System.err.println(ex.expand( "rule 'x' \n when \n foo \n then \n end" ));
+    }
+    
+    public void testExpandFailure() throws Exception {
+
+        DSLMappingFile file = new DSLMappingFile();
+        String dsl = "[when]foo=Foo()\n[then]bar {num}=baz({num});";
+        file.parseAndLoad( new StringReader( dsl ) );
+        assertEquals( 0,
+                      file.getErrors().size() );
+
+        DefaultExpander ex = new DefaultExpander();
+        ex.addDSLMapping( file.getMapping() );
+        String source = "rule 'q'\nagenda-group 'x'\nwhen\n    foo  \nthen\n    bar 42\nend";
+        String drl = ex.expand( source );
+        assertFalse( ex.hasErrors() );
+
+        ex = new DefaultExpander();
+        ex.addDSLMapping( file.getMapping() );
+
+        source = "rule 'q' agenda-group 'x'\nwhen\n    foos \nthen\n    bar 42\n end";
+        drl = ex.expand( source );
+        //System.out.println( drl );
+        assertTrue( ex.hasErrors() );
+        assertEquals( 1,
+                      ex.getErrors().size() );
+        //System.err.println(( (ExpanderException) ex.getErrors().get( 0 )).getMessage());
+    }
+
+    public void testExpandWithKeywordClashes() throws Exception {
+
+        DSLMappingFile file = new DSLMappingFile();
+        String dsl = "[when]Invoke rule executor=ruleExec: RuleExecutor()\n" + "[then]Execute rule \"{id}\"=ruleExec.ExecuteSubRule( new Long({id}));";
+        file.parseAndLoad( new StringReader( dsl ) );
+        assertEquals( 0,
+                      file.getErrors().size() );
+
+        DefaultExpander ex = new DefaultExpander();
+        ex.addDSLMapping( file.getMapping() );
+        String source = "package something;\n\nrule \"1\"\nwhen\n    Invoke rule executor\nthen\n    Execute rule \"5\"\nend";
+        String expected = "package something;\n\nrule \"1\"\nwhen\n   ruleExec: RuleExecutor()\nthen\n   ruleExec.ExecuteSubRule( new Long(5));\nend\n";
+        String drl = ex.expand( source );
+//        System.out.println("["+drl+"]" );
+//        System.out.println("["+expected+"]" );
+        assertFalse( ex.hasErrors() );
+        assertEquals( expected, drl );
+
+    }
+
+
+    public void testLineNumberError() throws Exception {
+        DSLMappingFile file = new DSLMappingFile();
+        String dsl = "[when]foo=Foo()\n[then]bar {num}=baz({num});";
+        file.parseAndLoad( new StringReader( dsl ) );
+
+        DefaultExpander ex = new DefaultExpander();
+        ex.addDSLMapping( file.getMapping() );
+        String source = "rule 'q'\nagenda-group 'x'\nwhen\n    __  \nthen\n    bar 42\n\tgoober\nend";
+        ex.expand( source );
+        assertTrue( ex.hasErrors() );
+        assertEquals( 2,
+                      ex.getErrors().size() );
+        ExpanderException err = (ExpanderException) ex.getErrors().get( 0 );
+        assertEquals( 4,
+                      err.getLine() );
+        err = (ExpanderException) ex.getErrors().get( 1 );
+        assertEquals( 7,
+                      err.getLine() );
+
+    }
+    
+    private boolean equalsIgnoreWhiteSpace( String expected, String actual ) {
+        String patternStr = expected.replaceAll( "\\s+", "(\\\\s|\\\\n|\\\\r)*" );//.replaceAll( "\\n", "\\s*\\$" );
+        Pattern pattern = Pattern.compile( patternStr, Pattern.DOTALL );
+        Matcher m = pattern.matcher( actual );
+        return m.matches();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/ProcessNodeBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/ProcessNodeBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/ProcessNodeBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.process.builder;
+
+public class ProcessNodeBuilderTest {
+    public void test1() {
+        
+    }
+    
+    
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/StoreNodeBuilder.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/StoreNodeBuilder.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/process/builder/StoreNodeBuilder.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools.process.builder;
+
+import org.drools.compiler.Dialect;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.process.core.Process;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.node.ActionNode;
+
+public class StoreNodeBuilder
+    implements
+    ProcessNodeBuilder {
+
+    public void build(Process process,
+                           ProcessDescr processDescr,
+                           ProcessBuildContext context,
+                           Node node) {
+        ActionNode actionNode = ( ActionNode ) node;
+        DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
+        ActionDescr actionDescr = new ActionDescr();
+        actionDescr.setText( action.getConsequence() );   
+        
+        Dialect dialect = context.getDialectRegistry().getDialect( action.getDialect() );            
+        
+        dialect.getActionBuilder().build( context, actionNode, actionDescr );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/reteoo/ReteooBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/reteoo/ReteooBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/reteoo/ReteooBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,113 @@
+package org.drools.reteoo;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+
+import com.thoughtworks.xstream.XStream;
+
+public class ReteooBuilderTest extends TestCase {
+
+    private final boolean writeTree = false;
+
+    /** Implementation specific subclasses must provide this. */
+    protected RuleBase getRuleBase() throws Exception {
+        return RuleBaseFactory.newRuleBase();
+    }
+
+    public void testThreePatternsWithConstraints() throws Exception {
+        //checkRuleBase( "ThreePatternsWithConstraints" );
+    }
+
+    public void testOneAndTwoOrs() throws Exception {
+        //checkRuleBase( "OneAndTwoOrs" );
+    }
+
+    public void testOneAndTwoOrsPerson() throws Exception {
+        //checkRuleBase( "OneAndTwoOrsPerson" );
+    }
+
+    private void writeRuleBase(final RuleBase ruleBase,
+                               final String fileName) throws IOException {
+        final XStream xstream = new XStream();
+
+        final PrintWriter out = new PrintWriter( new BufferedWriter( new FileWriter( "src/test/resources/org/drools/reteoo/" + fileName ) ) );
+
+        xstream.toXML( ruleBase,
+                       out );
+    }
+
+    private void checkRuleBase(final String name) throws Exception {
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_" + name + ".drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        final ReteooRuleBase ruleBase = (ReteooRuleBase) getRuleBase();
+        ruleBase.addPackage( pkg );
+
+        if ( this.writeTree ) {
+            writeRuleBase( ruleBase,
+                           name );
+        }
+
+        final XStream xstream = new XStream();
+
+        final RuleBase goodRuleBase = (RuleBase) xstream.fromXML( getClass().getResourceAsStream( name ) );
+
+        nodesEquals( ((ReteooRuleBase) goodRuleBase).getRete(),
+                     (ruleBase).getRete() );
+    }
+
+    private void nodesEquals(final Object object1,
+                             final Object object2) {
+        assertEquals( object1 + " is not of the same type as " + object2,
+                      object1.getClass(),
+                      object2.getClass() );
+
+        assertEquals( object1 + " is not equal to " + object2,
+                      object1,
+                      object2 );
+
+        if ( object1 instanceof ObjectSource ) {
+            final ObjectSource source1 = (ObjectSource) object1;
+            final ObjectSource source2 = (ObjectSource) object2;
+
+            final ObjectSink[] list1 = source1.sink.getSinks();
+            final ObjectSink[] list2 = source2.sink.getSinks();
+
+            assertEquals( object1.getClass() + " nodes have different number of sinks",
+                          list1.length,
+                          list2.length );
+
+            for ( int i = 0, size = list1.length; i < size; i++ ) {
+                nodesEquals( list1[i],
+                             list2[i] );
+            }
+        } else if ( object1 instanceof TupleSource ) {
+            final TupleSource source1 = (TupleSource) object1;
+            final TupleSource source2 = (TupleSource) object2;
+
+            final TupleSink[] list1 = source1.sink.getSinks();
+            final TupleSink[] list2 = source2.sink.getSinks();
+
+            assertEquals( object1.getClass() + " nodes have different number of sinks",
+                          list1.length,
+                          list2.length );
+
+            for ( int i = 0, size = list1.length; i < size; i++ ) {
+                nodesEquals( list1[i],
+                             list2[i] );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/JavaAndMVELCombinedTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/JavaAndMVELCombinedTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/JavaAndMVELCombinedTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package org.drools.rule.builder.dialect;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+
+public class JavaAndMVELCombinedTest extends TestCase {
+
+    private final static String FN1 = "mveljavarules.drl";
+    private final static String FN2 = "mvelonly.drl";
+    private final static String FN3 = "javaonly.drl";
+
+    public void testMixed() {
+        timing( FN1, "mveljava: ");
+    }
+    
+    public void testMVEL() {
+        timing( FN2, "    mvel: ");
+    }
+    
+    public void testJAVA() {
+        timing( FN3, "    java: ");
+    }
+    
+//    public void testJavaMVELCombination() throws Exception {
+//        long time1 = timing( new Runnable() {
+//            public void run() {
+//                readDRL( FN1 );
+//            }
+//        } );
+//        long time2 = timing( new Runnable() {
+//            public void run() {
+//                readDRL( FN2 );
+//            }
+//        } );
+//        long time3 = timing( new Runnable() {
+//            public void run() {
+//                readDRL( FN3 );
+//            }
+//        } );
+//        
+//        System.out.println("mveljava: "+time1/1000.);
+//        System.out.println("    mvel: "+time2/1000.);
+//        System.out.println("    java: "+time3/1000.);
+//        
+//    }
+
+    private void timing( String name, String msg ) {
+        long start = System.currentTimeMillis();
+        readDRL( name );
+        long time = System.currentTimeMillis()-start;
+        System.out.println(msg+time/1000.);
+    }
+
+    private void readDRL(String fn) {
+        try {
+            Reader source = new InputStreamReader( JavaAndMVELCombinedTest.class.getResourceAsStream( fn ) );
+
+            PackageBuilder builder = new PackageBuilder();
+            builder.addPackageFromDrl( source );
+            Assert.assertEquals( 0,
+                                 builder.getErrors().getErrors().length );
+
+            Package pkg = builder.getPackage();
+            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+            ruleBase.addPackage( pkg );
+
+            Assert.assertEquals( 2,
+                                 pkg.getRules().length );
+        } catch ( Throwable t ) {
+            throw new RuntimeException(t);
+        }
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/AccumulateTemplateTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/AccumulateTemplateTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/AccumulateTemplateTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,329 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.InputStreamReader;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ClassObjectType;
+import org.drools.rule.Declaration;
+import org.drools.spi.PatternExtractor;
+import org.drools.util.StringUtils;
+import org.mvel.MVELTemplateRegistry;
+import org.mvel.TemplateInterpreter;
+import org.mvel.TemplateRegistry;
+
+public class AccumulateTemplateTest extends TestCase {
+
+    private ClassFieldExtractorCache cache;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        cache = ClassFieldExtractorCache.getInstance();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testMethodGeneration() {
+        final String className = "accumulate0";
+
+        final String[] declarationTypes = new String[]{"String", "int"};
+        final Declaration[] declarations = new Declaration[]{new Declaration( "name",
+                                                                              null,
+                                                                              null ), new Declaration( "age",
+                                                                                                       null,
+                                                                                                       null )};
+        final Declaration[] inner = new Declaration[]{new Declaration( "cheese",
+                                                                       new PatternExtractor( new ClassObjectType( Cheese.class ) ),
+                                                                       null ), new Declaration( "price",
+                                                                                                cache.getExtractor( Cheese.class,
+                                                                                                                    "price",
+                                                                                                                    getClass().getClassLoader() ),
+                                                                                                null )};
+        final String[] globals = new String[]{"aGlobal", "anotherGlobal"};
+        final List globalTypes = Arrays.asList( new String[]{"String", "String"} );
+
+        final Map map = new HashMap();
+
+        map.put( "className",
+                 StringUtils.ucFirst( className ) );
+
+        map.put( "instanceName",
+                 className );
+
+        map.put( "package",
+                 "org.drools" );
+
+        map.put( "ruleClassName",
+                 "Rule0" );
+
+        map.put( "invokerClassName",
+                 "Rule0" + StringUtils.ucFirst( className ) + "Invoker" );
+
+        map.put( "declarations",
+                 declarations );
+
+        map.put( "declarationTypes",
+                 declarationTypes );
+
+        map.put( "globals",
+                 globals );
+
+        map.put( "globalTypes",
+                 globalTypes );
+
+        map.put( "innerDeclarations",
+                 inner );
+
+        map.put( "attributes",
+                 new String[]{"x"} );
+        map.put( "attributesTypes",
+                 new String[]{"int"} );
+        map.put( "initCode",
+                 "x = 0;" );
+        map.put( "actionCode",
+                 "x += 1;" );
+        map.put( "reverseCode",
+                 "x -= 1;" );
+        map.put( "resultCode",
+                 "x + 10" );
+        map.put( "supportsReverse",
+                 "true" );
+
+        map.put( "resultType",
+                 Integer.class );
+
+        map.put( "hashCode",
+                 new Integer( 10 ) );
+
+        TemplateRegistry registry = getRuleTemplateRegistry();
+        Object method = TemplateInterpreter.parse( registry.getTemplate( "accumulateInnerClass" ),
+                                                   null,
+                                                   map,
+                                                   registry );
+
+        //System.out.println( method );
+    }
+
+    public void testInvokerGenerationSinglePattern() {
+        final String className = "accumulate0";
+
+        final String[] declarationTypes = new String[]{"String", "int"};
+        final Declaration[] declarations = new Declaration[]{new Declaration( "name",
+                                                                              cache.getExtractor( Person.class,
+                                                                                                  "name",
+                                                                                                  getClass().getClassLoader() ),
+                                                                              null ), new Declaration( "age",
+                                                                                                       cache.getExtractor( Person.class,
+                                                                                                                           "age",
+                                                                                                                           getClass().getClassLoader() ),
+                                                                                                       null )};
+        final Declaration[] inner = new Declaration[]{new Declaration( "cheese",
+                                                                       new PatternExtractor( new ClassObjectType( Cheese.class ) ),
+                                                                       null ), new Declaration( "price",
+                                                                                                cache.getExtractor( Cheese.class,
+                                                                                                                    "price",
+                                                                                                                    getClass().getClassLoader() ),
+                                                                                                null )};
+        final String[] globals = new String[]{"aGlobal", "anotherGlobal"};
+        final List globalTypes = Arrays.asList( new String[]{"String", "String"} );
+
+        final Map map = new HashMap();
+
+        map.put( "className",
+                 StringUtils.ucFirst( className ) );
+
+        map.put( "instanceName",
+                 className );
+
+        map.put( "package",
+                 "org.drools" );
+
+        map.put( "ruleClassName",
+                 "Rule0" );
+
+        map.put( "invokerClassName",
+                 "Rule0" + StringUtils.ucFirst( className ) + "Invoker" );
+
+        map.put( "declarations",
+                 declarations );
+
+        map.put( "declarationTypes",
+                 declarationTypes );
+
+        map.put( "globals",
+                 globals );
+
+        map.put( "globalTypes",
+                 globalTypes );
+
+        map.put( "innerDeclarations",
+                 inner );
+
+        map.put( "attributes",
+                 new Attribute[]{new Attribute( "int",
+                                                "x" )} );
+        map.put( "initCode",
+                 "x = 0;" );
+        map.put( "actionCode",
+                 "x += 1;" );
+        map.put( "reverseCode",
+                 "" );
+        map.put( "resultCode",
+                 "x + 10" );
+
+        map.put( "supportsReverse",
+                 "false" );
+
+        map.put( "resultType",
+                 Integer.class );
+
+        map.put( "hashCode",
+                 new Integer( 10 ) );
+        map.put( "isMultiPattern",
+                 Boolean.FALSE );
+
+        TemplateRegistry registry = getInvokerTemplateRegistry();
+        Object method = TemplateInterpreter.parse( registry.getTemplate( "accumulateInvoker" ),
+                                                   null,
+                                                   map,
+                                                   registry );
+
+        //System.out.println( method );
+    }
+
+    public void testInvokerGenerationMultiPattern() {
+        final String className = "accumulate0";
+
+        final String[] declarationTypes = new String[]{"String", "int"};
+        final Declaration[] declarations = new Declaration[]{new Declaration( "name",
+                                                                              cache.getExtractor( Person.class,
+                                                                                                  "name",
+                                                                                                  getClass().getClassLoader() ),
+                                                                              null ), new Declaration( "age",
+                                                                                                       cache.getExtractor( Person.class,
+                                                                                                                           "age",
+                                                                                                                           getClass().getClassLoader() ),
+                                                                                                       null )};
+        final Declaration[] inner = new Declaration[]{new Declaration( "$cheese",
+                                                                       new PatternExtractor( new ClassObjectType( Cheese.class ) ),
+                                                                       null ), new Declaration( "$person",
+                                                                                                new PatternExtractor( new ClassObjectType( Person.class ) ),
+                                                                                                null )};
+        final String[] globals = new String[]{"aGlobal", "anotherGlobal"};
+        final List globalTypes = Arrays.asList( new String[]{"String", "String"} );
+
+        final Map map = new HashMap();
+
+        map.put( "className",
+                 StringUtils.ucFirst( className ) );
+
+        map.put( "instanceName",
+                 className );
+
+        map.put( "package",
+                 "org.drools" );
+
+        map.put( "ruleClassName",
+                 "Rule0" );
+
+        map.put( "invokerClassName",
+                 "Rule0" + StringUtils.ucFirst( className ) + "Invoker" );
+
+        map.put( "declarations",
+                 declarations );
+
+        map.put( "declarationTypes",
+                 declarationTypes );
+
+        map.put( "globals",
+                 globals );
+
+        map.put( "globalTypes",
+                 globalTypes );
+
+        map.put( "innerDeclarations",
+                 inner );
+
+        map.put( "attributes",
+                 new Attribute[]{new Attribute( "int",
+                                                "x" )} );
+        map.put( "initCode",
+                 "x = 0;" );
+        map.put( "actionCode",
+                 "x += 1;" );
+        map.put( "reverseCode",
+                 "" );
+        map.put( "resultCode",
+                 "x + 10" );
+
+        map.put( "supportsReverse",
+                 "false" );
+
+        map.put( "resultType",
+                 Integer.class );
+
+        map.put( "hashCode",
+                 new Integer( 10 ) );
+        map.put( "isMultiPattern",
+                 Boolean.TRUE );
+
+        TemplateRegistry registry = getInvokerTemplateRegistry();
+        Object method = TemplateInterpreter.parse( registry.getTemplate( "accumulateInvoker" ),
+                                                   null,
+                                                   map,
+                                                   registry );
+
+        //System.out.println( method );
+    }
+
+    private TemplateRegistry getRuleTemplateRegistry() {
+        TemplateRegistry ruleRegistry = new MVELTemplateRegistry();
+        ruleRegistry.registerTemplate( new InputStreamReader( AbstractJavaRuleBuilder.class.getResourceAsStream( "javaRule.mvel" ) ) );
+
+        return ruleRegistry;
+    }
+
+    private TemplateRegistry getInvokerTemplateRegistry() {
+        TemplateRegistry invokerRegistry = new MVELTemplateRegistry();
+        invokerRegistry.registerTemplate( new InputStreamReader( AbstractJavaRuleBuilder.class.getResourceAsStream( "javaInvokers.mvel" ) ) );
+
+        return invokerRegistry;
+    }
+
+    public static class Attribute {
+        private String type;
+        private String name;
+
+        public Attribute(String type,
+                         String name) {
+            this.type = type;
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public void setType(String type) {
+            this.type = type;
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,85 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.DescrFactory;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Accumulate;
+import org.drools.rule.builder.RuleBuildContext;
+
+public class JavaAccumulateBuilderTest extends TestCase {
+
+    private JavaAccumulateBuilder builder;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        builder = new JavaAccumulateBuilder();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testBuildRuleBuildContextBaseDescr() {
+        // $total : Integer() from accumulate( Cheese( $price : price ) init( int x = 0; ) action( x += $price ) result( new Integer( x ) ) ) 
+        AccumulateDescr accumDescr = new DescrFactory().createAccumulate();
+        
+        FieldBindingDescr price = new FieldBindingDescr( "price", "$price" );
+        PatternDescr cheeseDescr = new PatternDescr( "org.drools.Cheese" );
+        cheeseDescr.addConstraint( price );
+        accumDescr.setInputPattern( cheeseDescr );
+        
+        accumDescr.setInitCode( "int x = 0;" );
+        accumDescr.setActionCode( "x += $price;" );
+        accumDescr.setResultCode( "new Integer( x )" );
+        
+        org.drools.rule.Package pkg = new org.drools.rule.Package( "org.drools" );
+        final PackageBuilder pkgBulider = new PackageBuilder(pkg);
+        final PackageBuilderConfiguration conf = pkgBulider.getPackageBuilderConfiguration();
+        Dialect dialect = pkgBulider.getDialectRegistry().getDialect( "java" );
+        
+        
+        RuleDescr ruleDescr = new RuleDescr("test rule");
+        RuleBuildContext context = new RuleBuildContext( conf, pkg, ruleDescr, conf.buildDialectRegistry(), dialect);
+        
+        Accumulate accumulate = (Accumulate) builder.build( context, accumDescr );
+        
+        assertTrue( context.getErrors().toString(), context.getErrors().isEmpty() );
+//        System.out.println( context.getInvokers() );
+//        System.out.println( context.getMethods() );
+    }
+    
+    public void testFixInitCode() throws Exception {
+        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
+        JavaAccumulateBuilder builder = new JavaAccumulateBuilder();
+        
+        String code = "int x = 0;";
+        String expected = "x = 0;";
+        JavaAnalysisResult analysis = analyzer.analyzeBlock( code, new Set[0]);
+        String result = builder.fixInitCode( analysis, code );
+        assertEquals( expected, result );
+        
+        code = "$anExternalVar.method(); \nint aVar = 0, anotherVar=10    ;Integer bla = new Integer( 25);functionCall();\n";
+        expected = "$anExternalVar.method(); \naVar = 0;anotherVar=10;bla = new Integer( 25);functionCall();\n";;
+        analysis = analyzer.analyzeBlock( code, new Set[0]);
+        result = builder.fixInitCode( analysis, code );
+        assertEquals( expected, result );
+        
+        code = "$anExternalVar.method(); String[] aVar = new String[] { \"a\", \"b\" }, anotherVar=new String[] { someStringVar }  ;final Integer bla = new Integer( 25);functionCall();\n";
+        expected = "$anExternalVar.method(); aVar = new String[] { \"a\", \"b\" };anotherVar=new String[] { someStringVar };bla = new Integer( 25);functionCall();\n";
+        analysis = analyzer.analyzeBlock( code, new Set[0]);
+        result = builder.fixInitCode( analysis, code );
+        assertEquals( expected, result );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,103 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.common.AgendaItem;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.PropagationContextImpl;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.spi.Action;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.ActionNode;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+
+public class JavaActionBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+    
+    public void testSimpleAction() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+
+        ActionDescr actionDescr = new ActionDescr();
+        actionDescr.setText( "list.add( \"hello world\" );" );       
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        JavaDialect javaDialect = ( JavaDialect ) pkgBuilder.getDialectRegistry().getDialect( "java" );
+
+        ProcessDescr processDescr = new ProcessDescr();
+        processDescr.setClassName( "Process1" );
+        processDescr.setName( "Process1" );
+        
+        WorkflowProcessImpl process = new WorkflowProcessImpl();
+        process.setName( "Process1" );
+        process.setPackageName( "pkg1" );
+
+        ProcessBuildContext context = new ProcessBuildContext(conf, pkgBuilder.getPackage(), null, processDescr, pkgBuilder.getDialectRegistry(), javaDialect);
+        
+        context.init( conf, pkg, null, pkgBuilder.getDialectRegistry(), javaDialect, null);
+        
+        pkgBuilder.addPackageFromDrl( new StringReader("package pkg1;\nglobal java.util.List list;\n") );        
+        
+        ActionNode actionNode = new ActionNode();
+        
+        javaDialect.getActionBuilder().build( context, actionNode, actionDescr );
+        javaDialect.addProcess( context );
+        javaDialect.compileAll();            
+        assertEquals( 0, javaDialect.getResults().size() );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( pkgBuilder.getPackage() );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        List list = new  ArrayList();
+        wm.setGlobal( "list", list );        
+        
+        ((Action)actionNode.getAction()).execute( wm );
+       
+        assertEquals("hello world", list.get(0) );
+    }    
+    
+
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,98 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Set;
+
+import org.antlr.runtime.RecognitionException;
+import org.drools.Cheese;
+import org.drools.base.ClassObjectType;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.ImportDeclaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+
+import junit.framework.TestCase;
+
+public class JavaConsequenceBuilderTest extends TestCase {
+
+    private JavaConsequenceBuilder builder;
+    private RuleBuildContext       context;
+    private RuleDescr              ruleDescr;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        builder = new JavaConsequenceBuilder();
+
+        Package pkg = new Package( "org.drools" );
+        pkg.addImport( new ImportDeclaration( "org.drools.Cheese" ) );
+        
+        PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        PackageBuilder builder = new PackageBuilder( pkg, conf );
+
+        String consequence = " System.out.println(\"this is a test\");\n " + " modify( $cheese ) { setPrice( 10 ), setAge( age ) }\n " + " System.out.println(\"we are done\");\n ";
+        ruleDescr = new RuleDescr( "test modify block" );
+        ruleDescr.setConsequence( consequence );
+        
+        Rule rule = new Rule( ruleDescr.getName() );
+        rule.addPattern( new Pattern(0, new ClassObjectType(Cheese.class), "$cheese") );
+
+        context = new RuleBuildContext( conf,
+                                        pkg,
+                                        ruleDescr,
+                                        builder.getDialectRegistry(),
+                                        builder.getDefaultDialect() );
+        context.getBuildStack().push( rule.getLhs() );
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testDummy() {}
+    
+    // this test requires mvel 1.2.19. Leaving it commented until mvel is released.
+    public void FIXME_testFixModifyBlocks() {
+
+        try {
+            JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
+            JavaAnalysisResult analysis = (JavaAnalysisResult) analyzer.analyzeBlock( (String) ruleDescr.getConsequence(),
+                                                                                      new Set[]{} );
+
+            String fixed = builder.fixModifyBlocks( context,
+                                                    analysis,
+                                                    (String) ruleDescr.getConsequence() );
+            
+            String expected = " System.out.println(\"this is a test\");\n"+
+                              "org.drools.Cheese __obj__ = (org.drools.Cheese) ( $cheese );\n" +
+                              "modifyRetract( __obj__ );\n"+
+                              "__obj__.setPrice( 10 );\n"+
+                              "__obj__.setAge( age );\n"+
+                              "modifyInsert( __obj__ );\n"+
+                              "System.out.println(\"we are done\");\n";
+            
+            assertNotNull( context.getErrors().toString(), fixed );
+            assertEqualsIgnoreSpaces( expected, fixed );
+//            System.out.println( "=============================" );
+//            System.out.println( ruleDescr.getConsequence() );
+//            System.out.println( "=============================" );
+//            System.out.println( fixed );
+
+        } catch ( RecognitionException e ) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void assertEqualsIgnoreSpaces(String expected,
+                                          String fixed) {
+        assertEquals( expected.replaceAll( "\\s+", "" ), fixed.replaceAll( "\\s+", "" ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaExprAnalyzerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jul 1, 2007
+ */
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.antlr.runtime.RecognitionException;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaExprAnalyzerTest extends TestCase {
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for {@link org.drools.rule.builder.dialect.java.JavaExprAnalyzer#analyzeBlock(java.lang.String, java.util.Set[])}.
+     */
+    public void testAnalyzeBlock() {
+        JavaExprAnalyzer analyzer = new JavaExprAnalyzer();
+        String codeBlock = "int x;\n"+
+                           "Cheese cheese = new Cheese();\n"+
+                           "for( Iterator it = list.iterator(); it.hasNext(); ) {\n" +
+                           "    int shouldNotBeIncluded = 1;\n"+
+                           "}\n" +
+                           "{\n" +
+                           "    String anotherNonTopLevelVar = \"test\";\n" +
+                           "}\n" +
+                           "double thisIsAGoodVar = 0;\n" +
+                           "method();\n";
+        try {
+            JavaAnalysisResult analysis = analyzer.analyzeBlock( codeBlock, new Set[0] );
+            List vars = analysis.getLocalVariables();
+            
+            assertEquals( 3, vars.size() );
+            assertTrue( vars.contains( "x" ));
+            assertTrue( vars.contains( "cheese" ));
+            assertTrue( vars.contains( "thisIsAGoodVar" ));
+            
+        } catch ( RecognitionException e ) {
+            e.printStackTrace();
+            fail( "Not supposed to raise exception: "+e.getMessage());
+        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,89 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+import org.drools.workflow.instance.node.SplitInstance;
+
+public class JavaReturnValueConstraintEvaluatorBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+
+    public void testSimpleReturnValueConstraintEvaluator() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+
+        ProcessDescr processDescr = new ProcessDescr();
+        processDescr.setClassName( "Process1" );
+        processDescr.setName( "Process1" );
+        
+        WorkflowProcessImpl process = new WorkflowProcessImpl();
+        process.setName( "Process1" );
+        process.setPackageName( "pkg1" );
+
+        ReturnValueDescr descr = new ReturnValueDescr();
+        descr.setText( "return value;" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        JavaDialect javaDialect = (JavaDialect) pkgBuilder.getDialectRegistry().getDialect( "java" );
+
+        ProcessBuildContext context = new ProcessBuildContext( conf,
+                                                               pkg,
+                                                               process,
+                                                               processDescr,
+                                                               pkgBuilder.getDialectRegistry(),
+                                                               javaDialect );
+
+        pkgBuilder.addPackageFromDrl( new StringReader( "package pkg1;\nglobal Boolean value;" ) );
+
+        ReturnValueConstraintEvaluator node = new ReturnValueConstraintEvaluator();
+
+        final JavaReturnValueEvaluatorBuilder builder = new JavaReturnValueEvaluatorBuilder();
+        builder.build( context,
+                       node,
+                       descr );
+
+        javaDialect.addProcess( context );
+        javaDialect.compileAll();
+        assertEquals( 0, javaDialect.getResults().size() );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( pkgBuilder.getPackage() );
+        final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+        wm.setGlobal( "value",
+                      true );
+
+        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
+        processInstance.setWorkingMemory( wm );
+
+        SplitInstance splitInstance = new SplitInstance();
+        splitInstance.setProcessInstance( processInstance );
+
+        assertTrue( node.evaluate( splitInstance,
+                                   null,
+                                   null ) );
+
+        wm.setGlobal( "value",
+                      false );
+
+        assertFalse( node.evaluate( splitInstance,
+                                    null,
+                                    null ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/KnowledgeHelperFixerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,170 @@
+package org.drools.rule.builder.dialect.java;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import junit.framework.TestCase;
+
+public class KnowledgeHelperFixerTest extends TestCase {
+
+    private static final KnowledgeHelperFixer fixer = new KnowledgeHelperFixer();
+
+    public void testAdd__Handle__Simple() {
+        String result = KnowledgeHelperFixerTest.fixer.fix( "update(myObject );" );
+        assertEqualsIgnoreWhitespace( "drools.update(myObject );",
+                                      result );
+
+        result = KnowledgeHelperFixerTest.fixer.fix( "update ( myObject );" );
+        assertEqualsIgnoreWhitespace( "drools.update( myObject );",
+                                      result );
+    }
+
+    public void testAdd__Handle__withNewLines() {
+        final String result = KnowledgeHelperFixerTest.fixer.fix( "\n\t\n\tupdate( myObject );" );
+        assertEqualsIgnoreWhitespace( "\n\t\n\tdrools.update( myObject );",
+                                      result );
+    }
+
+    public void testAdd__Handle__rComplex() {
+        String result = KnowledgeHelperFixerTest.fixer.fix( "something update( myObject); other" );
+        assertEqualsIgnoreWhitespace( "something drools.update( myObject); other",
+                                      result );
+
+        result = KnowledgeHelperFixerTest.fixer.fix( "something update ( myObject );" );
+        assertEqualsIgnoreWhitespace( "something drools.update( myObject );",
+                                      result );
+
+        result = KnowledgeHelperFixerTest.fixer.fix( " update( myObject ); x" );
+        assertEqualsIgnoreWhitespace( " drools.update( myObject ); x",
+                                      result );
+
+        //should not touch, as it is not a stand alone word
+        result = KnowledgeHelperFixerTest.fixer.fix( "xxupdate(myObject ) x" );
+        assertEqualsIgnoreWhitespace( "xxupdate(myObject ) x",
+                                      result );
+    }
+
+    public void testMultipleMatches() {
+        String result = KnowledgeHelperFixerTest.fixer.fix( "update(myObject); update(myObject );" );
+        assertEqualsIgnoreWhitespace( "drools.update(myObject); drools.update(myObject );",
+                                      result );
+
+        result = KnowledgeHelperFixerTest.fixer.fix( "xxx update(myObject ); update( myObject ); update( yourObject ); yyy" );
+        assertEqualsIgnoreWhitespace( "xxx drools.update(myObject ); drools.update( myObject ); drools.update( yourObject ); yyy",
+                                      result );
+
+    }
+
+    public void testAssert1() {
+        final String raw = "insert( foo );";
+        final String result = "drools.insert( foo );";
+        assertEqualsIgnoreWhitespace( result,
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    public void testAssert2() {
+        final String raw = "some code; insert( new String(\"foo\") );\n More();";
+        final String result = "some code; drools.insert( new String(\"foo\") );\n More();";
+        assertEqualsIgnoreWhitespace( result,
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    public void testAssertLogical() {
+        final String raw = "some code; insertLogical(new String(\"foo\"));\n More();";
+        final String result = "some code; drools.insertLogical(new String(\"foo\"));\n More();";
+        assertEqualsIgnoreWhitespace( result,
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    public void testModifyRetractModifyInsert() {
+        final String raw = "some code; insert( bar ); modifyRetract( foo );\n More(); retract( bar ); modifyInsert( foo );";
+        final String result = "some code; drools.insert( bar ); drools.modifyRetract( foo );\n More(); drools.retract( bar ); drools.modifyInsert( foo );";
+        assertEqualsIgnoreWhitespace( result,
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    public void testAllActionsMushedTogether() {
+        String result = KnowledgeHelperFixerTest.fixer.fix( "insert(myObject ); update(ourObject);\t retract(herObject);" );
+        assertEqualsIgnoreWhitespace( "drools.insert(myObject ); drools.update(ourObject);\t drools.retract(herObject);",
+                                      result );
+
+        result = KnowledgeHelperFixerTest.fixer.fix( "insert( myObject ); update(ourObject);\t retract(herObject  );\ninsert(  myObject ); update(ourObject);\t retract(  herObject  );" );
+        assertEqualsIgnoreWhitespace( "drools.insert( myObject ); drools.update(ourObject);\t drools.retract(herObject  );\ndrools.insert(  myObject ); drools.update(ourObject);\t drools.retract(  herObject  );",
+                                      result );
+    }
+
+    public void testLeaveLargeAlone() {
+        final String original = "yeah yeah yeah minsert( xxx ) this is a long() thing Person (name=='drools') modify a thing";
+        final String result = KnowledgeHelperFixerTest.fixer.fix( original );
+        assertEqualsIgnoreWhitespace( original,
+                                      result );
+    }
+
+    public void testWithNull() {
+        final String original = null;
+        final String result = KnowledgeHelperFixerTest.fixer.fix( original );
+        assertEqualsIgnoreWhitespace( original,
+                                      result );
+    }
+
+    public void testLeaveAssertAlone() {
+        final String original = "drools.insert(foo)";
+        assertEqualsIgnoreWhitespace( original,
+                                      KnowledgeHelperFixerTest.fixer.fix( original ) );
+    }
+
+    public void testLeaveAssertLogicalAlone() {
+        final String original = "drools.insertLogical(foo)";
+        assertEqualsIgnoreWhitespace( original,
+                                      KnowledgeHelperFixerTest.fixer.fix( original ) );
+    }
+
+    public void testWackyAssert() {
+        final String raw = "System.out.println($person1.getName() + \" and \" + $person2.getName() +\" are sisters\");\n" + "insert($person1.getName(\"foo\") + \" and \" + $person2.getName() +\" are sisters\"); yeah();";
+        final String expected = "System.out.println($person1.getName() + \" and \" + $person2.getName() +\" are sisters\");\n" + "drools.insert($person1.getName(\"foo\") + \" and \" + $person2.getName() +\" are sisters\"); yeah();";
+
+        assertEqualsIgnoreWhitespace( expected,
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    public void testMoreAssertCraziness() {
+        final String raw = "foobar(); (insert(new String(\"blah\").get()); bangBangYudoHono();)";
+        assertEqualsIgnoreWhitespace( "foobar(); (drools.insert(new String(\"blah\").get()); bangBangYudoHono();)",
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+
+    // this one is an MVEL bug: http://jira.jboss.com/jira/browse/JBRULES-1191
+    public void testRetract() {
+        final String raw = "System.out.println(\"some text\");retract(object);";
+        assertEqualsIgnoreWhitespace( "System.out.println(\"some text\");drools.retract(object);",
+                                      KnowledgeHelperFixerTest.fixer.fix( raw ) );
+    }
+    
+    private void assertEqualsIgnoreWhitespace(final String expected,
+                                              final String actual) {
+        if ( expected == null || actual == null ) {
+            assertEquals(expected, actual);
+            return;
+        }
+        final String cleanExpected = expected.replaceAll( "\\s+",
+                                                          "" );
+        final String cleanActual = actual.replaceAll( "\\s+",
+                                                      "" );
+
+        assertEquals( cleanExpected,
+                      cleanActual );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/RuleBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/RuleBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/java/RuleBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.base.ClassTypeResolver;
+import org.drools.base.TypeResolver;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.GroupElement;
+import org.drools.rule.Package;
+import org.drools.rule.Rule;
+import org.drools.rule.TimeMachine;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+
+/**
+ * @author etirelli
+ *
+ */
+public class RuleBuilderTest extends TestCase {
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for {@link org.drools.rule.builder.RuleBuilder#build(org.drools.rule.Package, org.drools.lang.descr.RuleDescr)}.
+     */
+    public void testBuild() throws Exception {
+        final DrlParser parser = new DrlParser();
+        final PackageDescr pkgDescr = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "nestedConditionalElements.drl" ) ) );
+
+        // just checking there is no parsing errors
+        Assert.assertFalse( parser.getErrors().toString(),
+                            parser.hasErrors() );
+
+        final Package pkg = new Package( "org.drools" );
+
+        final RuleDescr ruleDescr = (RuleDescr) pkgDescr.getRules().get( 0 );
+        final String ruleClassName = "RuleClassName.java";
+        ruleDescr.setClassName( ruleClassName );
+        ruleDescr.addAttribute( new AttributeDescr("dialect", "java") );
+
+        final TypeResolver typeResolver = new ClassTypeResolver( new HashSet(),
+                                                                 this.getClass().getClassLoader() );
+        // make an automatic import for the current package
+        typeResolver.addImport( pkgDescr.getName() + ".*" );
+        typeResolver.addImport( "java.lang.*" );
+
+        final RuleBuilder builder = new RuleBuilder( );
+
+        final PackageBuilder pkgBuilder = new PackageBuilder(pkg);
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        Dialect dialect = pkgBuilder.getDialectRegistry().getDialect( "java" );
+
+        RuleBuildContext context = new RuleBuildContext(conf, pkg, ruleDescr, pkgBuilder.getDialectRegistry(), dialect);
+
+        builder.build( context );
+
+        Assert.assertTrue( context.getErrors().toString(),
+                           context.getErrors().isEmpty() );
+
+        final Rule rule = context.getRule();
+
+        assertEquals( "There should be 2 rule level declarations",
+                      2,
+                      rule.getDeclarations().length );
+
+        // second GE should be a not
+        final GroupElement not = (GroupElement) rule.getLhs().getChildren().get( 1 );
+        assertTrue( not.isNot() );
+        // not has no outer declarations
+        assertTrue( not.getOuterDeclarations().isEmpty() );
+        assertEquals( 1,
+                      not.getInnerDeclarations().size() );
+        assertTrue( not.getInnerDeclarations().keySet().contains( "$state" ) );
+
+        // second not
+        final GroupElement not2 = (GroupElement) ((GroupElement) not.getChildren().get( 0 )).getChildren().get( 1 );
+        assertTrue( not2.isNot() );
+        // not has no outer declarations
+        assertTrue( not2.getOuterDeclarations().isEmpty() );
+        assertEquals( 1,
+                      not2.getInnerDeclarations().size() );
+        assertTrue( not2.getInnerDeclarations().keySet().contains( "$likes" ) );
+    }
+
+    public void testBuildAttributes() throws Exception {
+        Rule rule = new Rule( "my rule" );
+
+        List attributes = new ArrayList();
+
+        attributes.add( new AttributeDescr("dialect", "java") );
+        attributes.add( new AttributeDescr( "no-loop",
+                                            "true" ) );
+        attributes.add( new AttributeDescr( "enabled",
+                                            "false" ) );
+        attributes.add( new AttributeDescr( "ruleflow-group",
+                                            "mygroup" ) );
+
+        RuleBuildContext.setAttributes( rule, null, attributes );
+
+        assertTrue( rule.isNoLoop() );
+        assertFalse( rule.isEffective(new TimeMachine()) );
+        assertEquals( "mygroup",
+                      rule.getRuleFlowGroup() );
+
+        attributes = new ArrayList();
+        attributes.add( new AttributeDescr( "date-effective",
+                                            "10-Jul-1974" ) );
+        attributes.add( new AttributeDescr( "date-expires",
+                                            "10-Jul-2040" ) );
+
+        rule = new Rule( "myrule" );
+
+        RuleBuildContext.setAttributes( rule, null, attributes );
+
+        final Field eff = rule.getClass().getDeclaredField( "dateEffective" );
+        eff.setAccessible( true );
+        final Calendar effectiveDate = (Calendar) eff.get( rule );
+        assertNotNull( effectiveDate );
+
+        assertEquals( 1974,
+                      effectiveDate.get( Calendar.YEAR ) );
+
+        final Field exp = rule.getClass().getDeclaredField( "dateExpires" );
+        exp.setAccessible( true );
+        final Calendar expiryDate = (Calendar) exp.get( rule );
+
+        assertEquals( 2040,
+                      expiryDate.get( Calendar.YEAR ) );
+
+        assertNotNull( expiryDate );
+
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedBuildContent.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedBuildContent.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedBuildContent.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+/**
+ * 
+ */
+package org.drools.rule.builder.dialect.mvel;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.spi.DeclarationScopeResolver;
+
+public class InstrumentedBuildContent extends RuleBuildContext {
+    private DeclarationScopeResolver declarationScopeResolver;
+
+    public InstrumentedBuildContent(final PackageBuilderConfiguration conf,
+                                    final Package pkg,
+                                    final RuleDescr ruleDescr,
+                                    final DialectRegistry registry,
+                                    final Dialect dialect) {
+        super( conf, 
+               pkg,
+               ruleDescr,
+               registry,
+               dialect );
+    }
+
+    public void setDeclarationResolver(final DeclarationScopeResolver declarationScopeResolver) {
+        this.declarationScopeResolver = declarationScopeResolver;
+    }
+
+    public DeclarationScopeResolver getDeclarationResolver() {
+        return this.declarationScopeResolver;
+    }
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedDeclarationScopeResolver.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedDeclarationScopeResolver.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/InstrumentedDeclarationScopeResolver.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.Map;
+
+import org.drools.rule.Declaration;
+import org.drools.spi.DeclarationScopeResolver;
+
+public class InstrumentedDeclarationScopeResolver extends DeclarationScopeResolver {
+    private Map declarations;
+
+    public InstrumentedDeclarationScopeResolver() {
+        super( null );
+    }
+
+    public void setDeclarations(final Map map) {
+        this.declarations = map;
+    }
+
+    public Map getDeclarations() {
+        return this.declarations;
+    }
+    
+    public Declaration getDeclaration(final String name) {
+        return ( Declaration ) this.declarations.get( name );
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.common.AgendaItem;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.PropagationContextImpl;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.spi.Action;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+import org.drools.workflow.core.node.ActionNode;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+
+public class MVELActionBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+    
+    public void testSimpleAction() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+
+        ActionDescr actionDescr = new ActionDescr();
+        actionDescr.setText( "list.add( 'hello world' )" );       
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        PackageBuildContext context = new PackageBuildContext();
+        context.init( conf, pkg, null, pkgBuilder.getDialectRegistry(), mvelDialect, null);
+        
+        pkgBuilder.addPackageFromDrl( new StringReader("package pkg1;\nglobal java.util.List list;\n") );        
+        
+        ActionNode actionNode = new ActionNode();
+        
+        final MVELActionBuilder builder = new MVELActionBuilder();
+        builder.build( context,
+                       actionNode,
+                       actionDescr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( pkgBuilder.getPackage() );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        List list = new  ArrayList();
+        wm.setGlobal( "list", list );        
+        
+        ((Action)actionNode.getAction()).execute( wm );
+        
+        assertEquals("hello world", list.get(0) );
+    }    
+
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,297 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.common.AgendaItem;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.PropagationContextImpl;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+
+public class MVELConsequenceBuilderTest extends TestCase {
+
+    public void setUp() {
+    }    
+
+    public void testSimpleExpression() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+        ruleDescr.setConsequence( "modify (cheese) {price = 5 };\nretract (cheese)" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+
+        final ObjectType cheeseObjeectType = new ClassObjectType( Cheese.class );
+
+        final Pattern pattern = new Pattern( 0,
+                                             cheeseObjeectType );
+
+        final PatternExtractor extractor = new PatternExtractor( cheeseObjeectType );
+
+        final Declaration declaration = new Declaration( "cheese",
+                                                         extractor,
+                                                         pattern );
+        final Map map = new HashMap();
+        map.put( "cheese",
+                 declaration );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final MVELConsequenceBuilder builder = new MVELConsequenceBuilder();
+        builder.build( context );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           10 );
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
+        final ReteTuple tuple = new ReteTuple( f0 );
+
+        final AgendaItem item = new AgendaItem( 0,
+                                                tuple,
+                                                10,
+                                                new PropagationContextImpl(1, 1, null, null),
+                                                context.getRule(),
+                                                null );
+        final DefaultKnowledgeHelper kbHelper = new DefaultKnowledgeHelper( wm );
+        kbHelper.setActivation( item );
+        context.getRule().getConsequence().evaluate( kbHelper,
+                                                     wm );
+
+        assertEquals( 5,
+                      cheddar.getPrice() );
+    }
+
+    public void testKnowledgeHelper() {
+
+    }
+
+    public void testImperativeCodeError() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+        ruleDescr.setConsequence( "if (cheese.price == 10) { cheese.price = 5; }" );
+
+        Properties properties = new Properties();
+        properties.setProperty( "drools.dialect.default",
+                                "mvel" );
+        PackageBuilderConfiguration cfg1 = new PackageBuilderConfiguration( properties );
+        
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg, cfg1 );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDefaultDialect();
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+
+        final ObjectType cheeseObjeectType = new ClassObjectType( Cheese.class );
+
+        final Pattern pattern = new Pattern( 0,
+                                             cheeseObjeectType );
+
+        final PatternExtractor extractor = new PatternExtractor( cheeseObjeectType );
+
+        final Declaration declaration = new Declaration( "cheese",
+                                                         extractor,
+                                                         pattern );
+        final Map map = new HashMap();
+        map.put( "cheese",
+                 declaration );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final MVELConsequenceBuilder builder = new MVELConsequenceBuilder();
+        builder.build( context );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           10 );
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
+        final ReteTuple tuple = new ReteTuple( f0 );
+
+        final AgendaItem item = new AgendaItem( 0,
+                                                tuple,
+                                                10,
+                                                null,
+                                                context.getRule(),
+                                                null );
+        final DefaultKnowledgeHelper kbHelper = new DefaultKnowledgeHelper( wm );
+        kbHelper.setActivation( item );
+        try {
+        context.getRule().getConsequence().evaluate( kbHelper,
+                                                     wm );
+            fail( "should throw an exception, as 'if' is not allowed" );
+        } catch ( Exception e) {
+
+        }
+
+        assertEquals( 10,
+                      cheddar.getPrice() );
+    }
+
+    /**
+     * Just like MVEL command line, we can allow expressions to span lines, with optional ";"
+     * seperating expressions. If its needed a ";" can be thrown in, but if not, a new line is fine.
+     *
+     * However, when in the middle of unbalanced brackets, a new line means nothing.
+     *
+     * @throws Exception
+     */
+    public void testLineSpanOptionalSemis() throws Exception {
+
+        String simpleEx = "foo\nbar\nbaz";
+        MVELConsequenceBuilder cons = new MVELConsequenceBuilder();
+        assertEquals( "foo;\nbar;\nbaz",
+                      MVELConsequenceBuilder.delimitExpressions( simpleEx ) );
+
+        String ex = "foo (\n bar \n)\nbar;\nyeah;\nman\nbaby";
+        assertEquals( "foo (\n bar \n);\nbar;\nyeah;\nman;\nbaby",
+                      MVELConsequenceBuilder.delimitExpressions( ex ) );
+
+        ex = "foo {\n bar \n}\nbar;   \nyeah;\nman\nbaby";
+        assertEquals( "foo {\n bar \n};\nbar;   \nyeah;\nman;\nbaby",
+                      MVELConsequenceBuilder.delimitExpressions( ex ) );
+
+        ex = "foo [\n bar \n]\nbar;  x\nyeah();\nman[42]\nbaby;ca chiga;\nend";
+        assertEquals( "foo [\n bar \n];\nbar;  x;\nyeah();\nman[42];\nbaby;ca chiga;\nend",
+                      MVELConsequenceBuilder.delimitExpressions( ex ) );
+
+        ex = "   \n\nfoo [\n bar \n]\n\n\nbar;  x\n  \nyeah();\nman[42]\nbaby;ca chiga;\nend";
+        assertEquals( "   \n\nfoo [\n bar \n];\n\n\nbar;  x;\n  \nyeah();\nman[42];\nbaby;ca chiga;\nend",
+                      MVELConsequenceBuilder.delimitExpressions( ex ) );
+
+    }
+    
+    public void testMVELDebugSymbols() throws DroolsParserException {
+        
+        MVELDebugHandler.setDebugMode( true );
+        
+        try {
+            final DrlParser parser = new DrlParser();
+            final PackageDescr pkgDescr = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "mvel_rule.drl" ) ) );
+
+            // just checking there is no parsing errors
+            Assert.assertFalse( parser.getErrors().toString(),
+                                parser.hasErrors() );
+
+            final Package pkg = new Package( "org.drools" );
+
+            final RuleDescr ruleDescr = (RuleDescr) pkgDescr.getRules().get( 0 );
+
+            final RuleBuilder builder = new RuleBuilder();
+
+            final PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+            final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+            Dialect dialect = pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+            RuleBuildContext context = new RuleBuildContext( conf,
+                                                             pkg,
+                                                             ruleDescr,
+                                                             pkgBuilder.getDialectRegistry(),
+                                                             dialect );
+
+            builder.build( context );
+
+            Assert.assertTrue( context.getErrors().toString(),
+                               context.getErrors().isEmpty() );
+
+            final Rule rule = context.getRule();
+
+            MVELConsequence mvelCons = (MVELConsequence) rule.getConsequence();
+            String s = org.mvel.debug.DebugTools.decompile( mvelCons.getCompExpr() );
+
+            int fromIndex = 0;
+            int count = 0;
+            while ( (fromIndex = s.indexOf( "DEBUG_SYMBOL",
+                                            fromIndex + 1 )) > -1 ) {
+                count++;
+            }
+            assertEquals( 4,
+                          count );
+        } finally {
+            MVELDebugHandler.setDebugMode( false );
+        }
+        
+    }
+
+    public void testX() {
+        String expr = "System.out.println( \"a1\" );\n" + 
+                      "System.out.println( \"a2\" );\n" + 
+                      "System.out.println( \"a3\" );\n" + 
+                      "System.out.println( \"a4\" );\n";
+   
+        ExpressionCompiler compiler = new ExpressionCompiler(expr);
+   
+        ParserContext context = new ParserContext();
+        context.addImport("System", System.class);
+        context.setStrictTypeEnforcement(true);
+        //context.setDebugSymbols( true );
+        context.setSourceFile( "mysource" );
+   
+        compiler.setDebugSymbols( true );
+        
+        Serializable compiledExpression = compiler.compile(context);           
+   
+        String s = org.mvel.debug.DebugTools.decompile( compiledExpression );
+   
+        System.out.println("s "+s);
+        
+        int fromIndex=0;
+        int count = 0;
+        while ((fromIndex = s.indexOf( "DEBUG_SYMBOL", fromIndex+1 )) > -1) {
+            count++;
+        }
+        assertEquals(4, count);      
+   
+      }
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.common.AgendaItem;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.PropagationContextImpl;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.spi.Action;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+import org.drools.workflow.core.node.ActionNode;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+
+public class MVELDecisionBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+    
+    public void testSimpleAction() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+
+        ActionDescr actionDescr = new ActionDescr();
+        actionDescr.setText( "list.add( 'hello world' )" );       
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        PackageBuildContext context = new PackageBuildContext();
+        context.init( conf, pkg, null, pkgBuilder.getDialectRegistry(), mvelDialect, null);
+        
+        pkgBuilder.addPackageFromDrl( new StringReader("package pkg1;\nglobal java.util.List list;\n") );        
+        
+        ActionNode actionNode = new ActionNode();
+        
+        final MVELActionBuilder builder = new MVELActionBuilder();
+        builder.build( context,
+                       actionNode,
+                       actionDescr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( pkgBuilder.getPackage() );
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        List list = new  ArrayList();
+        wm.setGlobal( "list", list );        
+        
+        ((Action)actionNode.getAction()).execute( wm );
+        
+        assertEquals("hello world", list.get(0) );
+    }    
+
+}
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,91 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ClassObjectType;
+import org.drools.common.InternalFactHandle;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.EvalCondition;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.spi.FieldExtractor;
+
+public class MVELEvalBuilderTest extends TestCase {
+
+    private ClassFieldExtractorCache cache;
+
+    public void setUp() {
+        cache = ClassFieldExtractorCache.getInstance();
+    }
+
+    public void testSimpleExpression() {
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+
+        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
+                                                             "price",
+                                                             getClass().getClassLoader() );
+
+        final Pattern pattern = new Pattern( 0,
+                                             new ClassObjectType( int.class ) );
+        final Declaration declaration = new Declaration( "a",
+                                                         extractor,
+                                                         pattern );
+        final Map map = new HashMap();
+        map.put( "a",
+                 declaration );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final EvalDescr evalDescr = new EvalDescr();
+        evalDescr.setContent( "a == 10" );
+
+        final MVELEvalBuilder builder = new MVELEvalBuilder();
+        final EvalCondition eval = (EvalCondition) builder.build( context,
+                                                                  evalDescr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           10 );
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
+        final ReteTuple tuple = new ReteTuple( f0 );
+
+        assertTrue( eval.isAllowed( tuple,
+                                    wm ) );
+
+        cheddar.setPrice( 9 );
+        wm.update( f0,
+                   cheddar );
+        assertFalse( eval.isAllowed( tuple,
+                                     wm ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import junit.framework.TestCase;
+
+public class MVELExprAnalyzerTest extends TestCase {
+
+    private MVELExprAnalyzer analyzer;
+
+    protected void setUp() throws Exception {
+        analyzer = new MVELExprAnalyzer();
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    public void testDummy() {
+        // Added this so test does prooduce warning in eclipse
+    }
+
+    public void testGetExpressionIdentifiers() {
+//        try {
+//            String expression = "order.id == 10";
+//            List[] identifiers = analyzer.analyzeExpression( expression, new Set[0] );
+//            
+//            assertEquals( 1, identifiers.length );
+//            assertEquals( 1, identifiers[0].size() );
+//            assertEquals( "order", identifiers[0].get( 0 ));
+//        } catch ( RecognitionException e ) {
+//            e.printStackTrace();
+//            fail( "Unexpected exception: "+e.getMessage());
+//        }
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,124 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ClassObjectType;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.PredicateConstraint;
+import org.drools.rule.PredicateConstraint.PredicateContextEntry;
+import org.drools.spi.FieldExtractor;
+
+public class MVELPredicateBuilderTest extends TestCase {
+
+    private ClassFieldExtractorCache cache = ClassFieldExtractorCache.getInstance();
+
+    public void setUp() {
+    }
+
+    public void testSimpleExpression() {
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
+                                                             "price",
+                                                             getClass().getClassLoader() );
+
+        final Pattern patternA = new Pattern( 0,
+                                              new ClassObjectType( Cheese.class ) );
+
+        final Pattern patternB = new Pattern( 1,
+                                              new ClassObjectType( Cheese.class ) );
+
+        final Declaration a = new Declaration( "a",
+                                               extractor,
+                                               patternA );
+        final Declaration b = new Declaration( "b",
+                                               extractor,
+                                               patternB );
+
+        final Map map = new HashMap();
+        map.put( "a",
+                 a );
+        map.put( "b",
+                 b );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final PredicateDescr predicateDescr = new PredicateDescr();
+        predicateDescr.setContent( "a == b" );
+
+        final MVELPredicateBuilder builder = new MVELPredicateBuilder();
+
+        final List[] usedIdentifiers = new ArrayList[2];
+        final List list = new ArrayList();
+        usedIdentifiers[1] = list;
+
+        final Declaration[] previousDeclarations = new Declaration[]{a};
+        final Declaration[] localDeclarations = new Declaration[]{b};
+
+        final PredicateConstraint predicate = new PredicateConstraint( null,
+                                                                       localDeclarations );
+
+        builder.build( context,
+                       usedIdentifiers,
+                       previousDeclarations,
+                       localDeclarations,
+                       predicate,
+                       predicateDescr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           10 );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           10 );
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
+        final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
+        final ReteTuple tuple = new ReteTuple( f0 );
+
+        final PredicateContextEntry predicateContext = new PredicateContextEntry();
+        predicateContext.leftTuple = tuple;
+
+        assertTrue( predicate.isAllowedCachedLeft( predicateContext,
+                                                   f1 ) );
+
+        cheddar.setPrice( 9 );
+        wm.update( f0,
+                   cheddar );
+
+        assertFalse( predicate.isAllowedCachedLeft( predicateContext,
+                                                    f1 ) );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,136 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.base.ClassFieldExtractorCache;
+import org.drools.base.ClassObjectType;
+import org.drools.base.ValueType;
+import org.drools.base.evaluators.Operator;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.ReturnValueRestriction;
+import org.drools.spi.FieldExtractor;
+
+public class MVELReturnValueBuilderTest extends TestCase {
+
+    private ClassFieldExtractorCache cache;
+
+    public void setUp() {
+        cache = ClassFieldExtractorCache.getInstance();
+    }
+
+    public void testSimpleExpression() {
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = (MVELDialect) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
+                                                             "price",
+                                                             getClass().getClassLoader() );
+
+        final Pattern patternA = new Pattern( 0,
+                                              new ClassObjectType( int.class ) );
+
+        final Pattern patternB = new Pattern( 1,
+                                              new ClassObjectType( int.class ) );
+
+        final Declaration a = new Declaration( "a",
+                                               extractor,
+                                               patternA );
+        final Declaration b = new Declaration( "b",
+                                               extractor,
+                                               patternB );
+
+        final Map map = new HashMap();
+        map.put( "a",
+                 a );
+        map.put( "b",
+                 b );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final ReturnValueRestrictionDescr returnValueDescr = new ReturnValueRestrictionDescr( "=" );
+        returnValueDescr.setContent( "a + b" );
+
+        final MVELReturnValueBuilder builder = new MVELReturnValueBuilder();
+
+        final List[] usedIdentifiers = new ArrayList[2];
+        final List list = new ArrayList();
+        usedIdentifiers[1] = list;
+
+        final Declaration[] previousDeclarations = new Declaration[]{a, b};
+        final Declaration[] localDeclarations = new Declaration[]{};
+        final String[] requiredGlobals = new String[]{};
+
+        final ReturnValueRestriction returnValue = new ReturnValueRestriction( extractor,
+                                                                               previousDeclarations,
+                                                                               localDeclarations,
+                                                                               requiredGlobals,
+                                                                               context.getConfiguration().getEvaluatorRegistry().getEvaluator( ValueType.PINTEGER_TYPE,
+                                                                                                                                               Operator.EQUAL ) );
+
+        builder.build( context,
+                       usedIdentifiers,
+                       previousDeclarations,
+                       localDeclarations,
+                       returnValue,
+                       returnValueDescr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+        final Cheese stilton = new Cheese( "stilton",
+                                           10 );
+
+        final Cheese cheddar = new Cheese( "cheddar",
+                                           10 );
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
+        ReteTuple tuple = new ReteTuple( f0 );
+
+        final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
+        tuple = new ReteTuple( tuple,
+                               f1 );
+
+        final Cheese brie = new Cheese( "brie",
+                                        20 );
+        final InternalFactHandle f2 = (InternalFactHandle) wm.insert( brie );
+
+        assertTrue( returnValue.isAllowed( extractor,
+                                           f2,
+                                           tuple,
+                                           wm ) );
+
+        brie.setPrice( 18 );
+        wm.update( f2, brie );
+        assertFalse( returnValue.isAllowed( extractor,
+                                            f2,
+                                            tuple,
+                                            wm ) );
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,74 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
+import org.drools.workflow.instance.node.SplitInstance;
+
+public class MVELReturnValueConstraintEvaluatorBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+
+    public void testSimpleReturnValueConstraintEvaluator() throws Exception {
+        final Package pkg = new Package( "pkg1" );
+
+        ReturnValueDescr descr = new ReturnValueDescr();
+        descr.setText( "return value" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = (MVELDialect) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        PackageBuildContext context = new PackageBuildContext();
+        context.init( conf,
+                      pkg,
+                      null,
+                      pkgBuilder.getDialectRegistry(),
+                      mvelDialect,
+                      null );
+
+        pkgBuilder.addPackageFromDrl( new StringReader( "package pkg1;\nglobal Boolean value;" ) );
+
+        ReturnValueConstraintEvaluator node = new ReturnValueConstraintEvaluator();
+
+        final MVELReturnValueEvaluatorBuilder builder = new MVELReturnValueEvaluatorBuilder();
+        builder.build( context,
+                       node,
+                       descr );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( pkgBuilder.getPackage() );
+        final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+        wm.setGlobal( "value", true );        
+
+        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
+        processInstance.setWorkingMemory( wm );
+
+        SplitInstance splitInstance = new SplitInstance();
+        splitInstance.setProcessInstance( processInstance );
+
+        assertTrue( node.evaluate( splitInstance,
+                                   null,
+                                   null ) );
+        
+        wm.setGlobal( "value", false );     
+        
+        assertFalse( node.evaluate( splitInstance,
+                                   null,
+                                   null ) );        
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,75 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.drools.Person;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.common.InternalFactHandle;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DialectRegistry;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.builder.SalienceBuilder;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+
+public class MVELSalienceBuilderTest extends TestCase {
+    public void testSimpleExpression() {        
+        final Package pkg = new Package( "pkg1" );
+        final RuleDescr ruleDescr = new RuleDescr( "rule 1" );
+        ruleDescr.setSalience( "(p.age + 20)/2" );
+        ruleDescr.setConsequence( "" );
+
+        PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+        final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+        MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+        final InstrumentedBuildContent context = new InstrumentedBuildContent( conf,
+                                                                               pkg,
+                                                                               ruleDescr,
+                                                                               pkgBuilder.getDialectRegistry(),
+                                                                               mvelDialect );
+
+        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
+
+        final ObjectType personObjeectType = new ClassObjectType( Person.class );
+
+        final Pattern pattern = new Pattern( 0,
+                                             personObjeectType );
+
+        final PatternExtractor extractor = new PatternExtractor( personObjeectType );
+
+        final Declaration declaration = new Declaration( "p",
+                                                         extractor,
+                                                         pattern );
+        final Map map = new HashMap();
+        map.put( "p",
+                 declaration );
+        declarationResolver.setDeclarations( map );
+        context.setDeclarationResolver( declarationResolver );
+
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final WorkingMemory wm = ruleBase.newStatefulSession();
+
+        final Person p = new Person("mark", "", 31);
+        final InternalFactHandle f0 = (InternalFactHandle) wm.insert( p );
+        final ReteTuple tuple = new ReteTuple( f0 );
+
+        SalienceBuilder salienceBuilder = new MVELSalienceBuilder();
+        salienceBuilder.build( context );
+                
+        assertEquals( 25, context.getRule().getSalience().getValue( tuple, wm ) );
+      
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/DumbFact.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/DumbFact.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/DumbFact.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,40 @@
+package org.drools.testframework;
+
+public class DumbFact {
+
+
+	private String name;
+	private int age;
+	private Long number;
+	private boolean enabled;
+
+	public boolean isEnabled() {
+		return enabled;
+	}
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+	public int getAge() {
+		return age;
+	}
+	public void setAge(int age) {
+		this.age = age;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Long getNumber() {
+		return number;
+	}
+	public void setNumber(Long number) {
+		this.number = number;
+	}
+
+	public String toString() {
+		return "Name:" + name + " age:" + age + " number:" + number + " enabled:" + enabled;
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactDataTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactDataTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactDataTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.testframework;
+
+import java.util.ArrayList;
+
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+
+import junit.framework.TestCase;
+
+public class FactDataTest extends TestCase {
+	public void testAdd() {
+		FactData fd = new FactData("x", "y", new ArrayList(), false );
+		assertEquals(0, fd.fieldData.size());
+		fd.fieldData.add(new FieldData("x", "y"));
+		assertEquals(1, fd.fieldData.size());
+		fd.fieldData.add(new FieldData("q", "x"));
+		assertEquals(2, fd.fieldData.size());
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactPopulatorTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactPopulatorTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/FactPopulatorTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,65 @@
+package org.drools.testframework;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.mvel.ExpressionCompiler;
+import org.mvel.MVEL;
+import org.mvel.ParserContext;
+
+import junit.framework.TestCase;
+
+public class FactPopulatorTest extends TestCase {
+
+	public void testMVELPopulate() throws Exception {
+		Object q = MVEL.eval("new org.drools.testframework.DumbFact()");
+
+		Map m = new HashMap();
+		m.put("obj", q);
+		m.put("val", "mike");
+		MVEL.eval("obj.name = val", m);
+
+		m = new HashMap();
+		m.put("obj", q);
+		m.put("val", "42");
+		MVEL.eval("obj.age = val", m);
+
+		m = new HashMap();
+		m.put("obj", q);
+		m.put("val", "44");
+		MVEL.eval("obj.number = val", m);
+
+		m = new HashMap();
+		m.put("obj", q);
+		m.put("val", "true");
+		MVEL.eval("obj.enabled = val", m);
+
+		DumbFact d = (DumbFact) q;
+
+		assertEquals("mike", d.getName());
+		assertEquals(42, d.getAge());
+		assertEquals(new Long(44), d.getNumber());
+		assertEquals(true, d.isEnabled());
+
+
+
+
+
+	}
+
+	public void testMVELFactChecker() throws Exception {
+		//now we have a bean check it can be verified
+		final DumbFact d = new DumbFact();
+		d.setAge(42);
+		Map m = new HashMap() {{
+				put("d", d);
+				put("val", "42");
+		}};
+
+		assertTrue(MVEL.evalToBoolean("d.age == val", m));
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockFactHandle.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockFactHandle.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockFactHandle.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,63 @@
+package org.drools.testframework;
+
+import org.drools.FactHandle;
+
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class MockFactHandle
+    implements
+    FactHandle {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 400L;
+    private int               id;
+
+    public MockFactHandle(final int id) {
+        this.id = id;
+    }
+
+    public String toExternalForm() {
+        return "[fact:" + this.id + "]";
+    }
+
+    public int hashCode() {
+        return this.id;
+    }
+
+    public boolean equals(final Object object) {
+        if ( this == object ) {
+            return true;
+        }
+
+        if ( object == null || getClass() != object.getClass() ) {
+            return false;
+        }
+
+        return ((MockFactHandle) object).id == this.id;
+    }
+
+    public long getId() {
+        return this.id;
+    }
+
+    public long getRecency() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockRuleBase.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockRuleBase.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockRuleBase.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,144 @@
+package org.drools.testframework;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Observer;
+import java.util.Set;
+
+import org.drools.ClockType;
+import org.drools.RuleBase;
+import org.drools.StatefulSession;
+import org.drools.StatelessSession;
+import org.drools.TemporalSession;
+import org.drools.event.RuleBaseEventListener;
+import org.drools.rule.Package;
+
+public class MockRuleBase implements RuleBase {
+
+	public void addPackage(Package pkg) throws Exception {
+		// TODO Auto-generated method stub
+
+	}
+
+	public int getAdditionsSinceLock() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public Package getPackage(String name) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Package[] getPackages() {
+
+		return new Package[0];
+	}
+
+	public int getRemovalsSinceLock() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public StatefulSession[] getStatefulSessions() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void lock() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public StatefulSession newStatefulSession() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public StatefulSession newStatefulSession(boolean keepReference) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public StatefulSession newStatefulSession(InputStream stream)
+			throws IOException, ClassNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public StatefulSession newStatefulSession(InputStream stream,
+			boolean keepReference) throws IOException, ClassNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public StatelessSession newStatelessSession() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void removeFunction(String packageName, String functionName) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removePackage(String packageName) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removeProcess(String id) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removeRule(String packageName, String ruleName) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void unlock() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addEventListener(RuleBaseEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public List getRuleBaseEventListeners() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void removeEventListener(RuleBaseEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+    public TemporalSession newTemporalSession(ClockType clockType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public TemporalSession newTemporalSession(boolean keepReference,
+                                              ClockType clockType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+/*	@Override
+	public void addClockObserver(Observer myObserver) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public Set<Observer> getClockObservers() {
+		// TODO Auto-generated method stub
+		return null;
+	}*/
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockWorkingMemory.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockWorkingMemory.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/MockWorkingMemory.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,481 @@
+package org.drools.testframework;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+
+import org.drools.Agenda;
+import org.drools.EntryPointInterface;
+import org.drools.FactException;
+import org.drools.FactHandle;
+import org.drools.ObjectFilter;
+import org.drools.QueryResults;
+import org.drools.RuleBase;
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.common.NodeMemory;
+import org.drools.common.ObjectStore;
+import org.drools.common.TruthMaintenanceSystem;
+import org.drools.common.WorkingMemoryAction;
+import org.drools.event.AgendaEventListener;
+import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleBaseEventListener;
+import org.drools.event.RuleFlowEventListener;
+import org.drools.event.RuleFlowEventSupport;
+import org.drools.event.WorkingMemoryEventListener;
+import org.drools.event.WorkingMemoryEventSupport;
+import org.drools.process.instance.ProcessInstance;
+import org.drools.process.instance.ProcessInstanceFactory;
+import org.drools.process.instance.WorkItemManager;
+import org.drools.reteoo.LIANodePropagation;
+import org.drools.reteoo.ObjectTypeConf;
+import org.drools.rule.EntryPoint;
+import org.drools.rule.Rule;
+import org.drools.rule.TimeMachine;
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaFilter;
+import org.drools.spi.AgendaGroup;
+import org.drools.spi.AsyncExceptionHandler;
+import org.drools.spi.FactHandleFactory;
+import org.drools.spi.GlobalResolver;
+import org.drools.spi.PropagationContext;
+import org.drools.util.ObjectHashMap;
+
+public class MockWorkingMemory implements InternalWorkingMemory {
+
+	List<Object> facts = new ArrayList<Object>();
+	AgendaEventListener agendaEventListener;
+	TimeMachine timeMachine = new TimeMachine();
+	Map<String, Object> globals = new HashMap<String, Object>();
+
+	public void addLIANodePropagation(LIANodePropagation liaNodePropagation) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void clearNodeMemory(NodeMemory node) {
+		// TODO Auto-generated method stub
+
+	}
+
+
+
+	public void executeQueuedActions() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public ObjectHashMap getAssertMap() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FactHandleFactory getFactHandleFactory() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public ObjectHashMap getFactHandleMap() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public Lock getLock() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getNextPropagationIdCounter() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public Object getNodeMemory(NodeMemory node) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public TimeMachine getTimeMachine() {
+		return this.timeMachine;
+	}
+
+	public TruthMaintenanceSystem getTruthMaintenanceSystem() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean isSequential() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void queueWorkingMemoryAction(WorkingMemoryAction action) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removeLogicalDependencies(Activation activation,
+			PropagationContext context, Rule rule) throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void retract(FactHandle factHandle, boolean removeLogical,
+			boolean updateEqualsMap, Rule rule, Activation activation)
+			throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setAgendaEventSupport(AgendaEventSupport agendaEventSupport) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setRuleFlowEventSupport(
+			RuleFlowEventSupport ruleFlowEventSupport) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setWorkingMemoryEventSupport(
+			WorkingMemoryEventSupport workingMemoryEventSupport) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void clearActivationGroup(String group) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void clearAgenda() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void clearAgendaGroup(String group) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void clearRuleFlowGroup(String group) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void fireAllRules() throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void fireAllRules(AgendaFilter agendaFilter) throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void fireAllRules(int fireLimit) throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void fireAllRules(AgendaFilter agendaFilter, int fireLimit)
+			throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Agenda getAgenda() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FactHandle getFactHandle(Object object) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public AgendaGroup getFocus() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getGlobal(String identifier) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public GlobalResolver getGlobalResolver() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getObject(FactHandle handle) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public QueryResults getQueryResults(String query) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public QueryResults getQueryResults(String query, Object[] arguments) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public RuleBase getRuleBase() {
+		return new MockRuleBase();
+	}
+
+	public void halt() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FactHandle insert(Object object) throws FactException {
+		this.facts .add(object);
+		return new MockFactHandle(object.hashCode());
+	}
+	
+	public FactHandle insert(Object object, long duration)
+		throws FactException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FactHandle insert(Object object, boolean dynamic)
+			throws FactException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public FactHandle insert(Object object, long duration, boolean dynamic)
+			throws FactException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Iterator iterateFactHandles() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Iterator iterateFactHandles(ObjectFilter filter) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Iterator iterateObjects() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Iterator iterateObjects(ObjectFilter filter) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void modifyInsert(FactHandle factHandle, Object object) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void modifyRetract(FactHandle factHandle) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void retract(FactHandle handle) throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setAsyncExceptionHandler(AsyncExceptionHandler handler) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setFocus(String focus) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setFocus(AgendaGroup focus) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setGlobal(String identifier, Object value) {
+		this.globals.put(identifier, value);
+
+	}
+
+	public void setGlobalResolver(GlobalResolver globalResolver) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public ProcessInstance startProcess(String processId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public ProcessInstance startProcess(String processId,
+            Map<String, Object> parameters) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+	public void update(FactHandle handle, Object object) throws FactException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addEventListener(WorkingMemoryEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addEventListener(AgendaEventListener listener) {
+		this.agendaEventListener = listener;
+	}
+
+	public void addEventListener(RuleFlowEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public List getAgendaEventListeners() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getRuleFlowEventListeners() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getWorkingMemoryEventListeners() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void removeEventListener(WorkingMemoryEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removeEventListener(AgendaEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void removeEventListener(RuleFlowEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addEventListener(RuleBaseEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public List getRuleBaseEventListeners() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void removeEventListener(RuleBaseEventListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setTimeMachine(TimeMachine tm) {
+		this.timeMachine = tm;
+
+	}
+
+    public void setId(long id) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void setRuleBase(InternalRuleBase ruleBase) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void removeProcessInstance(ProcessInstance processInstance) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public ProcessInstance getProcessInstance(long id) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getProcessInstances() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public WorkItemManager getWorkItemManager() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ObjectTypeConf getObjectTypeConf(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<Object, ObjectTypeConf> getObjectTypeConfMap() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ObjectTypeConf getObjectTypeConf(EntryPoint entryPoint,
+                                            Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<Object, ObjectTypeConf> getObjectTypeConfMap(EntryPoint entryPoint) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public EntryPointInterface getEntryPoint(String id) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FactHandle getFactHandleByIdentity(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void registerProcessInstanceFactory(String type,
+            ProcessInstanceFactory nodeInstanceFactory) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public ObjectStore getObjectStore() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleCoverageListenerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleCoverageListenerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleCoverageListenerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,129 @@
+package org.drools.testframework;
+
+import java.util.HashSet;
+
+import org.drools.common.ActivationGroupNode;
+import org.drools.common.LogicalDependency;
+import org.drools.common.RuleFlowGroupNode;
+import org.drools.event.AfterActivationFiredEvent;
+import org.drools.rule.GroupElement;
+import org.drools.rule.Rule;
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaGroup;
+import org.drools.spi.PropagationContext;
+import org.drools.spi.Tuple;
+import org.drools.util.LinkedList;
+
+import junit.framework.TestCase;
+
+public class RuleCoverageListenerTest extends TestCase {
+
+	public void testCoverage() throws Exception {
+		HashSet<String> rules = new HashSet<String>();
+		rules.add("rule1");
+		rules.add("rule2");
+		rules.add("rule3");
+
+		RuleCoverageListener ls = new RuleCoverageListener(rules);
+		assertEquals(3, ls.rules.size());
+		assertEquals(0, ls.getPercentCovered());
+
+		ls.afterActivationFired(new AfterActivationFiredEvent(new MockActivation("rule1")), null);
+		assertEquals(2, ls.rules.size());
+		assertTrue(ls.rules.contains("rule2"));
+		assertTrue(ls.rules.contains("rule3"));
+		assertFalse(ls.rules.contains("rule1"));
+		assertEquals(33, ls.getPercentCovered());
+
+		ls.afterActivationFired(new AfterActivationFiredEvent(new MockActivation("rule2")), null);
+		assertEquals(1, ls.rules.size());
+		assertFalse(ls.rules.contains("rule2"));
+		assertFalse(ls.rules.contains("rule1"));
+		assertTrue(ls.rules.contains("rule3"));
+
+		assertEquals(66, ls.getPercentCovered());
+
+
+		ls.afterActivationFired(new AfterActivationFiredEvent(new MockActivation("rule3")), null);
+		assertEquals(0, ls.rules.size());
+		assertFalse(ls.rules.contains("rule2"));
+		assertFalse(ls.rules.contains("rule1"));
+		assertFalse(ls.rules.contains("rule3"));
+
+		assertEquals(100, ls.getPercentCovered());
+
+
+	}
+
+}
+
+class MockActivation implements Activation {
+	private String ruleName;
+
+	public MockActivation(String ruleName) {
+		this.ruleName = ruleName;
+	}
+
+	public void addLogicalDependency(LogicalDependency node) {
+	}
+
+	public ActivationGroupNode getActivationGroupNode() {
+		return null;
+	}
+
+	public long getActivationNumber() {
+		return 0;
+	}
+
+	public AgendaGroup getAgendaGroup() {
+		return null;
+	}
+
+	public LinkedList getLogicalDependencies() {
+		return null;
+	}
+
+	public PropagationContext getPropagationContext() {
+		return null;
+	}
+
+	public Rule getRule() {
+		return new Rule(ruleName);
+	}
+
+	public RuleFlowGroupNode getRuleFlowGroupNode() {
+		return null;
+	}
+
+	public int getSalience() {
+		return 0;
+	}
+
+	public GroupElement getSubRule() {
+		return null;
+	}
+
+	public Tuple getTuple() {
+		return null;
+	}
+
+	public boolean isActivated() {
+		return false;
+	}
+
+	public void remove() {
+	}
+
+	public void setActivated(boolean activated) {
+	}
+
+	public void setActivationGroupNode(ActivationGroupNode activationGroupNode) {
+	}
+
+	public void setLogicalDependencies(LinkedList justified) {
+	}
+
+	public void setRuleFlowGroupNode(RuleFlowGroupNode ruleFlowGroupNode) {
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleUnit.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleUnit.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/RuleUnit.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.testframework;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+
+import junit.framework.TestCase;
+
+/**
+ * A class with some utilities for testing rules.
+ * @author Michael Neale
+ *
+ */
+public abstract class RuleUnit extends TestCase {
+
+	/**
+	 * Return a wm ready to go based on the rules in a drl at the specified uri (in the classpath).
+	 */
+	public StatefulSession getWorkingMemory(String uri)
+			throws DroolsParserException, IOException, Exception {
+		PackageBuilder builder = new PackageBuilder();
+		builder.addPackageFromDrl(new InputStreamReader(this.getClass()
+				.getResourceAsStream(uri)));
+		assertFalse(builder.getErrors().toString(), builder.hasErrors());
+		RuleBase rb = RuleBaseFactory.newRuleBase();
+		rb.addPackage(builder.getPackage());
+
+		return rb.newStatefulSession();
+	}
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioRunnerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioRunnerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioRunnerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,908 @@
+package org.drools.testframework;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassTypeResolver;
+import org.drools.base.TypeResolver;
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.Expectation;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.RetractFact;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.rule.TimeMachine;
+
+public class ScenarioRunnerTest extends RuleUnit {
+
+    public void testPopulateFacts() throws Exception {
+        Scenario sc = new Scenario();
+        List facts = ls( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "type",
+                                                          "cheddar" ),
+                                           new FieldData( "price",
+                                                          "42" ) ),
+                                       false ),
+                         new FactData( "Person",
+                                       "p1",
+                                       ls( new FieldData( "name",
+                                                          "mic" ),
+                                           new FieldData( "age",
+                                                          "=30 + 3" ) ),
+                                       false ) );
+
+        sc.fixtures.addAll( facts );
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+        resolver.addImport( "org.drools.Person" );
+        ScenarioRunner runner = new ScenarioRunner( sc,
+                                                    resolver,
+                                                    new MockWorkingMemory() );
+
+        assertTrue( runner.populatedData.containsKey( "c1" ) );
+        assertTrue( runner.populatedData.containsKey( "p1" ) );
+
+        Cheese c = (Cheese) runner.populatedData.get( "c1" );
+        assertEquals( "cheddar",
+                      c.getType() );
+        assertEquals( 42,
+                      c.getPrice() );
+
+        Person p = (Person) runner.populatedData.get( "p1" );
+        assertEquals( "mic",
+                      p.getName() );
+        assertEquals( 33,
+                      p.getAge() );
+
+    }
+
+    public void testPopulateFactsWithExpressions() throws Exception {
+        Scenario sc = new Scenario();
+        List facts = ls( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "type",
+                                                          "cheddar" ),
+                                           new FieldData( "price",
+                                                          "42" ) ),
+                                       false ),
+                         new FactData( "Cheese",
+                                       "c2",
+                                       ls( new FieldData( "type",
+                                                          "= c1.type" ) ),
+                                       false ) );
+
+        sc.fixtures.addAll( facts );
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        ScenarioRunner runner = new ScenarioRunner( sc,
+                                                    resolver,
+                                                    new MockWorkingMemory() );
+
+        assertTrue( runner.populatedData.containsKey( "c1" ) );
+        assertTrue( runner.populatedData.containsKey( "c2" ) );
+
+        Cheese c = (Cheese) runner.populatedData.get( "c1" );
+        assertEquals( "cheddar",
+                      c.getType() );
+        assertEquals( 42,
+                      c.getPrice() );
+
+        Cheese c2 = (Cheese) runner.populatedData.get( "c2" );
+        assertEquals( c.getType(),
+                      c2.getType() );
+
+    }
+
+    public void testPopulateNoData() throws Exception {
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+        ScenarioRunner run = new ScenarioRunner( new Scenario(),
+                                                 resolver,
+                                                 new MockWorkingMemory() );
+        run.populatedData.clear();
+        Cheese c = new Cheese();
+        c.setType( "whee" );
+        c.setPrice( 1 );
+        run.populatedData.put( "x",
+                               c );
+
+        assertEquals( 1,
+                      c.getPrice() );
+
+        FactData fd = new FactData( "Cheese",
+                                    "x",
+                                    ls( new FieldData( "type",
+                                                       "" ),
+                                        new FieldData( "price",
+                                                       "42" ) ),
+                                    false );
+
+        run.populateFields( fd,
+                            run.populatedData,
+                            c );
+        assertEquals( "whee",
+                      c.getType() );
+        assertEquals( 42,
+                      c.getPrice() );
+    }
+
+    public void testVerifyFacts() throws Exception {
+
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        Cheese f1 = new Cheese( "cheddar",
+                                42 );
+        runner.populatedData.put( "f1",
+                                  f1 );
+
+        Person f2 = new Person( "michael",
+                                33 );
+        runner.populatedData.put( "f2",
+                                  f2 );
+
+        // test all true
+        VerifyFact vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues = ls( new VerifyField( "type",
+                                              "cheddar",
+                                              "==" ),
+                             new VerifyField( "price",
+                                              "42",
+                                              "==" ) );
+
+        runner.verify( vf );
+        for ( int i = 0; i < vf.fieldValues.size(); i++ ) {
+            assertTrue( ((VerifyField) vf.fieldValues.get( i )).successResult );
+        }
+
+        vf = new VerifyFact();
+        vf.name = "f2";
+        vf.fieldValues = ls( new VerifyField( "name",
+                                              "michael",
+                                              "==" ),
+                             new VerifyField( "age",
+                                              "33",
+                                              "==" ) );
+
+        runner.verify( vf );
+        for ( int i = 0; i < vf.fieldValues.size(); i++ ) {
+            assertTrue( ((VerifyField) vf.fieldValues.get( i )).successResult );
+        }
+
+        // test one false
+        vf = new VerifyFact();
+        vf.name = "f2";
+        vf.fieldValues = ls( new VerifyField( "name",
+                                              "mark",
+                                              "==" ),
+                             new VerifyField( "age",
+                                              "33",
+                                              "==" ) );
+
+        runner.verify( vf );
+        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
+        assertTrue( ((VerifyField) vf.fieldValues.get( 1 )).successResult );
+
+        assertEquals( "michael",
+                      ((VerifyField) vf.fieldValues.get( 0 )).actualResult );
+        assertEquals( "mark",
+                      ((VerifyField) vf.fieldValues.get( 0 )).expected );
+
+        // test 2 false
+        vf = new VerifyFact();
+        vf.name = "f2";
+        vf.fieldValues = ls( new VerifyField( "name",
+                                              "mark",
+                                              "==" ),
+                             new VerifyField( "age",
+                                              "32",
+                                              "==" ) );
+
+        runner.verify( vf );
+        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
+        assertFalse( ((VerifyField) vf.fieldValues.get( 1 )).successResult );
+
+        assertEquals( "michael",
+                      ((VerifyField) vf.fieldValues.get( 0 )).actualResult );
+        assertEquals( "mark",
+                      ((VerifyField) vf.fieldValues.get( 0 )).expected );
+
+        assertEquals( "33",
+                      ((VerifyField) vf.fieldValues.get( 1 )).actualResult );
+        assertEquals( "32",
+                      ((VerifyField) vf.fieldValues.get( 1 )).expected );
+
+    }
+
+    public void testVerifyFactsWithOperator() throws Exception {
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        Cheese f1 = new Cheese( "cheddar",
+                                42 );
+        runner.populatedData.put( "f1",
+                                  f1 );
+
+        // test all true
+        VerifyFact vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues = ls( new VerifyField( "type",
+                                              "cheddar",
+                                              "==" ),
+                             new VerifyField( "price",
+                                              "4777",
+                                              "!=" ) );
+        runner.verify( vf );
+        for ( int i = 0; i < vf.fieldValues.size(); i++ ) {
+            assertTrue( ((VerifyField) vf.fieldValues.get( i )).successResult );
+        }
+
+        vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues = ls( new VerifyField( "type",
+                                              "cheddar",
+                                              "!=" ) );
+        runner.verify( vf );
+        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
+
+    }
+
+    public void testVerifyFactsWithExpression() throws Exception {
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        Cheese f1 = new Cheese( "cheddar",
+                                42 );
+        runner.populatedData.put( "f1",
+                                  f1 );
+        f1.setPrice( 42 );
+        // test all true
+        VerifyFact vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues = ls( new VerifyField( "price",
+                                              "= 40 + 2",
+                                              "==" ) );
+        runner.verify( vf );
+
+        assertTrue( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
+    }
+
+    public void testVerifyFactExplanation() throws Exception {
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        Cheese f1 = new Cheese();
+        f1.setType( null );
+        runner.populatedData.put( "f1",
+                                  f1 );
+
+        VerifyFact vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues.add( new VerifyField( "type",
+                                             "boo",
+                                             "!=" ) );
+
+        runner.verify( vf );
+        VerifyField vfl = (VerifyField) vf.fieldValues.get( 0 );
+        assertEquals( "[f1] field [type] was not [boo].",
+                      vfl.explanation );
+
+    }
+
+    public void testVerifyFieldAndActualIsNull() throws Exception {
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        Cheese f1 = new Cheese();
+        f1.setType( null );
+        runner.populatedData.put( "f1",
+                                  f1 );
+
+        VerifyFact vf = new VerifyFact();
+        vf.name = "f1";
+        vf.fieldValues.add( new VerifyField( "type",
+                                             "boo",
+                                             "==" ) );
+
+        runner.verify( vf );
+        VerifyField vfl = (VerifyField) vf.fieldValues.get( 0 );
+
+        assertEquals( "[f1] field [type] was [] expected [boo].",
+                      vfl.explanation );
+        assertEquals( "boo",
+                      vfl.expected );
+        assertEquals( "",
+                      vfl.actualResult );
+
+    }
+
+    public void testDummyRunNoRules() throws Exception {
+        Scenario sc = new Scenario();
+        FactData[] facts = new FactData[]{new FactData( "Cheese",
+                                                        "c1",
+                                                        ls( new FieldData( "type",
+                                                                           "cheddar" ),
+                                                            new FieldData( "price",
+                                                                           "42" ) ),
+                                                        false )};
+
+        VerifyFact[] assertions = new VerifyFact[]{new VerifyFact( "c1",
+                                                                   ls( new VerifyField( "type",
+                                                                                        "cheddar",
+                                                                                        "==" ),
+                                                                       new VerifyField( "price",
+                                                                                        "42",
+                                                                                        "==" ) ) )};
+
+        sc.fixtures.addAll( Arrays.asList( facts ) );
+        sc.fixtures.addAll( Arrays.asList( assertions ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        MockWorkingMemory wm = new MockWorkingMemory();
+        ScenarioRunner runner = new ScenarioRunner( sc,
+                                                    resolver,
+                                                    wm );
+        assertEquals( 1,
+                      wm.facts.size() );
+        assertEquals( runner.populatedData.get( "c1" ),
+                      wm.facts.get( 0 ) );
+
+        assertTrue( runner.populatedData.containsKey( "c1" ) );
+        VerifyFact vf = (VerifyFact) assertions[0];
+        for ( int i = 0; i < vf.fieldValues.size(); i++ ) {
+            assertTrue( ((VerifyField) vf.fieldValues.get( i )).successResult );
+        }
+
+    }
+
+    public void testCountVerification() throws Exception {
+
+        Map<String, Integer> firingCounts = new HashMap<String, Integer>();
+        firingCounts.put( "foo",
+                          2 );
+        firingCounts.put( "bar",
+                          1 );
+        // and baz, we leave out
+
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+        VerifyRuleFired v = new VerifyRuleFired();
+        v.ruleName = "foo";
+        v.expectedFire = true;
+        runner.verify( v,
+                       firingCounts );
+        assertTrue( v.successResult );
+        assertEquals( 2,
+                      v.actualResult.intValue() );
+
+        v = new VerifyRuleFired();
+        v.ruleName = "foo";
+        v.expectedFire = false;
+        runner.verify( v,
+                       firingCounts );
+        assertFalse( v.successResult );
+        assertEquals( 2,
+                      v.actualResult.intValue() );
+        assertNotNull( v.explanation );
+
+        v = new VerifyRuleFired();
+        v.ruleName = "foo";
+        v.expectedCount = 2;
+
+        runner.verify( v,
+                       firingCounts );
+        assertTrue( v.successResult );
+        assertEquals( 2,
+                      v.actualResult.intValue() );
+
+    }
+
+    public void testTestingEventListener() throws Exception {
+        Scenario sc = new Scenario();
+        sc.rules.add( "foo" );
+        sc.rules.add( "bar" );
+        ExecutionTrace ext = new ExecutionTrace();
+
+        sc.fixtures.add( ext );
+
+        MockWorkingMemory wm = new MockWorkingMemory();
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 null,
+                                                 wm );
+        assertEquals( wm,
+                      run.workingMemory );
+        assertNotNull( wm.agendaEventListener );
+        assertTrue( wm.agendaEventListener instanceof TestingEventListener );
+        TestingEventListener lnr = (TestingEventListener) wm.agendaEventListener;
+        assertEquals( 2,
+                      sc.rules.size() );
+        assertTrue( sc.rules.contains( "foo" ) );
+        assertTrue( sc.rules.contains( "bar" ) );
+    }
+
+    public void testWithGlobals() throws Exception {
+        Scenario sc = new Scenario();
+        FactData[] facts = new FactData[]{new FactData( "Cheese",
+                                                        "c2",
+                                                        ls( new FieldData( "type",
+                                                                           "stilton" ) ),
+                                                        false )};
+        sc.globals.add( new FactData( "Cheese",
+                                      "c",
+                                      ls( new FieldData( "type",
+                                                         "cheddar" ) ),
+                                      false ) );
+        sc.fixtures.addAll( Arrays.asList( facts ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        MockWorkingMemory wm = new MockWorkingMemory();
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 wm );
+        assertEquals( 1,
+                      wm.globals.size() );
+        assertEquals( 1,
+                      run.globalData.size() );
+        assertEquals( 1,
+                      run.populatedData.size() );
+        assertEquals( 1,
+                      wm.facts.size() );
+
+        Cheese c = (Cheese) wm.globals.get( "c" );
+        assertEquals( "cheddar",
+                      c.getType() );
+        Cheese c2 = (Cheese) wm.facts.get( 0 );
+        assertEquals( "stilton",
+                      c2.getType() );
+
+    }
+
+    @SuppressWarnings("deprecation")
+    // F**** dates in java. What a mess. Someone should die.
+    public void testSimulatedDate() throws Exception {
+        Scenario sc = new Scenario();
+        MockWorkingMemory wm = new MockWorkingMemory();
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 null,
+                                                 wm );
+        TimeMachine tm = run.workingMemory.getTimeMachine();
+
+        // love you
+        long time = tm.getNow().getTimeInMillis();
+
+        Thread.sleep( 100 );
+        long future = tm.getNow().getTimeInMillis();
+        assertTrue( future > time );
+
+        ExecutionTrace ext = new ExecutionTrace();
+        ext.scenarioSimulatedDate = new Date( "10-Jul-1974" );
+        sc.fixtures.add( ext );
+        run = new ScenarioRunner( sc,
+                                  null,
+                                  wm );
+        tm = run.workingMemory.getTimeMachine();
+
+        long expected = ext.scenarioSimulatedDate.getTime();
+        assertEquals( expected,
+                      tm.getNow().getTimeInMillis() );
+        Thread.sleep( 50 );
+        assertEquals( expected,
+                      tm.getNow().getTimeInMillis() );
+
+    }
+
+    public void testVerifyRuleFired() throws Exception {
+        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
+                                                    null,
+                                                    new MockWorkingMemory() );
+
+        VerifyRuleFired vr = new VerifyRuleFired( "qqq",
+                                                  42,
+                                                  null );
+        Map<String, Integer> f = new HashMap<String, Integer>();
+        f.put( "qqq",
+               42 );
+        f.put( "qaz",
+               1 );
+
+        runner.verify( vr,
+                       f );
+        assertTrue( vr.wasSuccessful() );
+        assertEquals( 42,
+                      vr.actualResult.intValue() );
+
+        vr = new VerifyRuleFired( "qqq",
+                                  41,
+                                  null );
+        runner.verify( vr,
+                       f );
+        assertFalse( vr.wasSuccessful() );
+        assertEquals( 42,
+                      vr.actualResult.intValue() );
+
+        vr = new VerifyRuleFired( "qaz",
+                                  1,
+                                  null );
+        runner.verify( vr,
+                       f );
+        assertTrue( vr.wasSuccessful() );
+        assertEquals( 1,
+                      vr.actualResult.intValue() );
+
+        vr = new VerifyRuleFired( "XXX",
+                                  null,
+                                  false );
+        runner.verify( vr,
+                       f );
+        assertTrue( vr.wasSuccessful() );
+        assertEquals( 0,
+                      vr.actualResult.intValue() );
+
+        vr = new VerifyRuleFired( "qqq",
+                                  null,
+                                  true );
+        runner.verify( vr,
+                       f );
+        assertTrue( vr.wasSuccessful() );
+        assertEquals( 42,
+                      vr.actualResult.intValue() );
+
+        vr = new VerifyRuleFired( "qqq",
+                                  null,
+                                  false );
+        runner.verify( vr,
+                       f );
+        assertFalse( vr.wasSuccessful() );
+        assertEquals( 42,
+                      vr.actualResult.intValue() );
+
+    }
+
+    /**
+     * Do a kind of end to end test with some real rules.
+     */
+    public void testIntegrationWithSuccess() throws Exception {
+
+        Scenario sc = new Scenario();
+        FactData[] facts = new FactData[]{new FactData( "Cheese",
+                                                        "c1",
+                                                        ls( new FieldData( "type",
+                                                                           "cheddar" ),
+                                                            new FieldData( "price",
+                                                                           "42" ) ),
+                                                        false )
+
+        };
+        sc.globals.add( new FactData( "Person",
+                                      "p",
+                                      new ArrayList(),
+                                      false ) );
+        sc.fixtures.addAll( Arrays.asList( facts ) );
+
+        ExecutionTrace executionTrace = new ExecutionTrace();
+
+        sc.rules.add( "rule1" );
+        sc.rules.add( "rule2" );
+        sc.inclusive = true;
+        sc.fixtures.add( executionTrace );
+
+        Expectation[] assertions = new Expectation[5];
+
+        assertions[0] = new VerifyFact( "c1",
+                                        ls( new VerifyField( "type",
+                                                             "cheddar",
+                                                             "==" )
+
+                                        ) );
+
+        assertions[1] = new VerifyFact( "p",
+                                        ls( new VerifyField( "name",
+                                                             "rule1",
+                                                             "==" ),
+                                            new VerifyField( "status",
+                                                             "rule2",
+                                                             "==" ) )
+
+        );
+
+        assertions[2] = new VerifyRuleFired( "rule1",
+                                             1,
+                                             null );
+        assertions[3] = new VerifyRuleFired( "rule2",
+                                             1,
+                                             null );
+        assertions[4] = new VerifyRuleFired( "rule3",
+                                             1,
+                                             null );
+
+        sc.fixtures.addAll( Arrays.asList( assertions ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+        resolver.addImport( "org.drools.Person" );
+
+        WorkingMemory wm = getWorkingMemory( "test_rules2.drl" );
+
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 (InternalWorkingMemory) wm );
+
+        assertEquals( 3,
+                      executionTrace.numberOfRulesFired.intValue() );
+
+        assertSame( run.scenario,
+                    sc );
+
+        assertTrue( sc.wasSuccessful() );
+
+        Person p = (Person) run.globalData.get( "p" );
+        assertEquals( "rule1",
+                      p.getName() );
+        assertEquals( "rule2",
+                      p.getStatus() );
+        assertEquals( 0,
+                      p.getAge() );
+
+        Thread.sleep( 50 );
+
+        assertTrue( (new Date()).after( sc.lastRunResult ) );
+        assertTrue( executionTrace.executionTimeResult != null );
+
+    }
+
+    public void testIntgerationStateful() throws Exception {
+        Scenario sc = new Scenario();
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "price",
+                                                          "1" ) ),
+                                       false ) );
+        ExecutionTrace ex = new ExecutionTrace();
+        sc.fixtures.add( ex );
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c2",
+                                       ls( new FieldData( "price",
+                                                          "2" ) ),
+                                       false ) );
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "rule1",
+                                                              "==" ) ) ) );
+        ex = new ExecutionTrace();
+        sc.fixtures.add( ex );
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "rule2",
+                                                              "==" ) ) ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        WorkingMemory wm = getWorkingMemory( "test_stateful.drl" );
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 (InternalWorkingMemory) wm );
+
+        Cheese c1 = (Cheese) run.populatedData.get( "c1" );
+        Cheese c2 = (Cheese) run.populatedData.get( "c2" );
+
+        assertEquals( "rule2",
+                      c1.getType() );
+        assertEquals( "rule2",
+                      c2.getType() );
+
+        assertTrue( sc.wasSuccessful() );
+
+    }
+
+    public void testIntegrationWithModify() throws Exception {
+        Scenario sc = new Scenario();
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "price",
+                                                          "1" ) ),
+                                       false ) );
+
+        sc.fixtures.add( new ExecutionTrace() );
+
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "rule1",
+                                                              "==" ) ) ) );
+
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "price",
+                                                          "42" ) ),
+                                       true ) );
+        sc.fixtures.add( new ExecutionTrace() );
+
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "rule3",
+                                                              "==" ) ) ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        WorkingMemory wm = getWorkingMemory( "test_stateful.drl" );
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 (InternalWorkingMemory) wm );
+
+        Cheese c1 = (Cheese) run.populatedData.get( "c1" );
+
+        assertEquals( "rule3",
+                      c1.getType() );
+
+        assertTrue( sc.wasSuccessful() );
+    }
+
+    public void testIntegrationWithRetract() throws Exception {
+        Scenario sc = new Scenario();
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c1",
+                                       ls( new FieldData( "price",
+                                                          "46" ),
+                                           new FieldData( "type",
+                                                          "XXX" ) ),
+                                       false ) );
+        sc.fixtures.add( new FactData( "Cheese",
+                                       "c2",
+                                       ls( new FieldData( "price",
+                                                          "42" ) ),
+                                       false ) );
+        sc.fixtures.add( new ExecutionTrace() );
+
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "XXX",
+                                                              "==" ) ) ) );
+
+        sc.fixtures.add( new RetractFact( "c2" ) );
+        sc.fixtures.add( new ExecutionTrace() );
+
+        sc.fixtures.add( new VerifyFact( "c1",
+                                         ls( new VerifyField( "type",
+                                                              "rule4",
+                                                              "==" ) ) ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+
+        WorkingMemory wm = getWorkingMemory( "test_stateful.drl" );
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 (InternalWorkingMemory) wm );
+
+        Cheese c1 = (Cheese) run.populatedData.get( "c1" );
+
+        assertEquals( "rule4",
+                      c1.getType() );
+        assertFalse( run.populatedData.containsKey( "c2" ) );
+
+        assertTrue( sc.wasSuccessful() );
+    }
+
+    public void testIntegrationWithFailure() throws Exception {
+        Scenario sc = new Scenario();
+        FactData[] facts = new FactData[]{new FactData( "Cheese",
+                                                        "c1",
+                                                        ls( new FieldData( "type",
+                                                                           "cheddar" ),
+                                                            new FieldData( "price",
+                                                                           "42" ) ),
+                                                        false )
+
+        };
+        sc.fixtures.addAll( Arrays.asList( facts ) );
+        sc.globals.add( new FactData( "Person",
+                                      "p",
+                                      new ArrayList(),
+                                      false ) );
+
+        ExecutionTrace executionTrace = new ExecutionTrace();
+        sc.rules.add( "rule1" );
+        sc.rules.add( "rule2" );
+        sc.inclusive = true;
+        sc.fixtures.add( executionTrace );
+
+        Expectation[] assertions = new Expectation[5];
+
+        assertions[0] = new VerifyFact( "c1",
+                                        ls( new VerifyField( "type",
+                                                             "cheddar",
+                                                             "==" )
+
+                                        ) );
+
+        assertions[1] = new VerifyFact( "p",
+                                        ls( new VerifyField( "name",
+                                                             "XXX",
+                                                             "==" ),
+                                            new VerifyField( "status",
+                                                             "rule2",
+                                                             "==" )
+
+                                        ) );
+
+        assertions[2] = new VerifyRuleFired( "rule1",
+                                             1,
+                                             null );
+        assertions[3] = new VerifyRuleFired( "rule2",
+                                             1,
+                                             null );
+        assertions[4] = new VerifyRuleFired( "rule3",
+                                             2,
+                                             null );
+
+        sc.fixtures.addAll( Arrays.asList( assertions ) );
+
+        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
+                                                       Thread.currentThread().getContextClassLoader() );
+        resolver.addImport( "org.drools.Cheese" );
+        resolver.addImport( "org.drools.Person" );
+
+        WorkingMemory wm = getWorkingMemory( "test_rules2.drl" );
+
+        ScenarioRunner run = new ScenarioRunner( sc,
+                                                 resolver,
+                                                 (InternalWorkingMemory) wm );
+
+        assertSame( run.scenario,
+                    sc );
+
+        assertFalse( sc.wasSuccessful() );
+
+        VerifyFact vf = (VerifyFact) assertions[1];
+        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
+        assertEquals( "XXX",
+                      ((VerifyField) vf.fieldValues.get( 0 )).expected );
+        assertEquals( "rule1",
+                      ((VerifyField) vf.fieldValues.get( 0 )).actualResult );
+        assertNotNull( ((VerifyField) vf.fieldValues.get( 0 )).explanation );
+
+        VerifyRuleFired vr = (VerifyRuleFired) assertions[4];
+        assertFalse( vr.successResult );
+
+        assertEquals( 2,
+                      vr.expectedCount.intValue() );
+        assertEquals( 1,
+                      vr.actualResult.intValue() );
+
+    }
+
+    private <T> List<T> ls(T... objects) {
+        return Arrays.asList( objects );
+    }
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/ScenarioTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,195 @@
+package org.drools.testframework;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.RetractFact;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+
+import junit.framework.TestCase;
+
+public class ScenarioTest extends TestCase {
+
+	public void testInsertAfter() {
+		Scenario sc = new Scenario();
+		VerifyRuleFired vf = new VerifyRuleFired();
+		sc.insertAfter(null, vf);
+		assertEquals(1, sc.fixtures.size());
+		assertEquals(vf, sc.fixtures.get(0));
+
+		VerifyRuleFired vf2 = new VerifyRuleFired();
+		sc.fixtures.add(vf2);
+
+		VerifyRuleFired vf3 = new VerifyRuleFired();
+		sc.insertAfter(vf, vf3);
+		assertEquals(3, sc.fixtures.size());
+		assertEquals(vf, sc.fixtures.get(0));
+		assertEquals(vf3, sc.fixtures.get(1));
+		assertEquals(vf2, sc.fixtures.get(2));
+
+		VerifyRuleFired vf4 = new VerifyRuleFired();
+		sc.insertAfter(vf2, vf4);
+		assertEquals(4, sc.fixtures.size());
+		assertEquals(vf4, sc.fixtures.get(3));
+		assertEquals(vf2, sc.fixtures.get(2));
+
+		VerifyRuleFired vf5 = new VerifyRuleFired();
+		sc.insertAfter(null, vf5);
+		assertEquals(5, sc.fixtures.size());
+		assertEquals(vf5, sc.fixtures.get(0));
+	}
+
+	public void testRemoveFixture() {
+		Scenario sc = new Scenario();
+
+		VerifyRuleFired vf1 = new VerifyRuleFired();
+		VerifyRuleFired vf2 = new VerifyRuleFired();
+		VerifyRuleFired vf3 = new VerifyRuleFired();
+
+		FactData fd = new FactData();
+
+		sc.fixtures.add(vf1);
+		sc.fixtures.add(vf2);
+		sc.fixtures.add(vf3);
+		sc.globals.add(fd);
+
+
+		sc.removeFixture(vf2);
+		assertEquals(2, sc.fixtures.size());
+		assertEquals(vf1, sc.fixtures.get(0));
+		assertEquals(vf3, sc.fixtures.get(1));
+		assertEquals(1, sc.globals.size());
+
+		sc.removeFixture(fd);
+		assertEquals(0, sc.globals.size());
+		assertEquals(2, sc.fixtures.size());
+
+
+
+
+	}
+
+	public void testMapFactTypes() {
+		Scenario sc = new Scenario();
+		sc.fixtures.add(new FactData("X", "q", null, false));
+		sc.globals.add(new FactData("Q", "x", null, false));
+
+		Map r = sc.getVariableTypes();
+		assertEquals(2, r.size());
+
+		assertEquals("X", r.get("q"));
+		assertEquals("Q", r.get("x"));
+
+	}
+
+	public void testVariablesInScope() {
+		Scenario sc = new Scenario();
+		sc.globals.add(new FactData("X", "x", new ArrayList(), false));
+
+		sc.fixtures.add(new FactData("Q", "q", new ArrayList(), true));
+		sc.fixtures.add(new FactData("Z", "z", new ArrayList(), false));
+		ExecutionTrace ex1 = new ExecutionTrace();
+
+		sc.fixtures.add(ex1);
+		sc.fixtures.add(new RetractFact("z"));
+		sc.fixtures.add(new FactData("Y", "y", new ArrayList(), false));
+
+		ExecutionTrace ex2 = new ExecutionTrace();
+		sc.fixtures.add(ex2);
+
+		List l = sc.getFactNamesInScope(ex1, true);
+
+		assertEquals(3, l.size());
+		assertEquals("q", l.get(0));
+		assertEquals("z", l.get(1));
+		assertEquals("x", l.get(2));
+
+
+		l = sc.getFactNamesInScope(ex1, false);
+		assertEquals(2, l.size());
+		assertFalse(l.contains(sc.globals.get(0)));
+
+		l = sc.getFactNamesInScope(ex2, true);
+		assertEquals(3, l.size());
+		assertEquals("q", l.get(0));
+		assertEquals("y", l.get(1));
+		assertEquals("x", l.get(2));
+
+		l= sc.getFactNamesInScope(null, true);
+		assertEquals(0, l.size());
+
+	}
+
+	public void testAllowRemoveFact() {
+		Scenario sc = new Scenario();
+
+		FactData fd1 = new FactData("X", "x", new ArrayList(), false);
+		sc.fixtures.add(fd1);
+		FactData fd2 = new FactData("Q", "q", new ArrayList(), false);
+		sc.fixtures.add(fd2);
+		FactData fd3 = new FactData("Z", "z", new ArrayList(), false);
+		sc.fixtures.add(fd3);
+		ExecutionTrace ex1 = new ExecutionTrace();
+		FactData fd4 = new FactData("I", "i", new ArrayList(), false);
+		sc.globals.add(fd4);
+
+		sc.fixtures.add(ex1);
+		sc.fixtures.add(new RetractFact("z"));
+		sc.fixtures.add(new FactData("Z", "z", new ArrayList(), true));
+		sc.fixtures.add(new VerifyFact("q", new ArrayList()));
+
+		assertFalse(sc.isFactNameUsed(fd1));
+		assertTrue(sc.isFactNameUsed(fd2));
+		assertTrue(sc.isFactNameUsed(fd3));
+		assertFalse(sc.isFactNameUsed(fd4));
+	}
+
+	public void testIsFactNameUsed() {
+		Scenario sc = new Scenario();
+		sc.globals.add(new FactData("X", "x", null, false));
+		sc.fixtures.add(new FactData("Q", "q", null, false));
+		sc.fixtures.add(new ExecutionTrace());
+
+		assertTrue(sc.isFactNameExisting("x"));
+		assertTrue(sc.isFactNameExisting("q"));
+		assertFalse(sc.isFactNameExisting("w"));
+
+
+		sc = new Scenario();
+		assertFalse(sc.isFactNameExisting("w"));
+	}
+
+	public void testCountSuccessFailures() {
+		Scenario sc = new Scenario();
+		sc.fixtures.add(new FactData());
+		sc.fixtures.add(new ExecutionTrace());
+		VerifyRuleFired vr = new VerifyRuleFired();
+		vr.successResult = false;
+		sc.fixtures.add(vr);
+
+		VerifyField vf = new VerifyField();
+		vf.successResult = true;
+		VerifyField vf2 = new VerifyField();
+		vf2.successResult = false;
+		VerifyFact vfact = new VerifyFact();
+		vfact.fieldValues.add(vf);
+		vfact.fieldValues.add(vf2);
+		sc.fixtures.add(vfact);
+
+
+		int[] totals = sc.countFailuresTotal();
+		assertEquals(2, totals[0]);
+		assertEquals(3, totals[1]);
+
+
+
+	}
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/TestingEventListenerTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/TestingEventListenerTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/testframework/TestingEventListenerTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,99 @@
+package org.drools.testframework;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaFilter;
+
+public class TestingEventListenerTest extends RuleUnit {
+
+	public void testInclusive() throws Exception {
+		HashSet<String> set = new HashSet<String>();
+		set.add("rule1");
+		set.add("rule2");
+
+		StatefulSession session  = getWorkingMemory("test_rules.drl");
+
+        TestingEventListener ls = new TestingEventListener();
+        //TestingEventListener.stubOutRules(set, session.getRuleBase(), true);
+
+        session.addEventListener(ls);
+
+        session.insert(new Cheese());
+        session.fireAllRules(ls.getAgendaFilter(set, true));
+
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule2"));
+
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule3"));
+        assertTrue(ls.firingCounts.containsKey("rule3"));
+        assertFalse(ls.firingCounts.containsKey("rule4"));
+
+        session.insert(new Cheese());
+        session.fireAllRules(ls.getAgendaFilter(set, true));
+        assertEquals(new Integer(2), (Integer) ls.firingCounts.get("rule1"));
+        assertEquals(new Integer(2), (Integer) ls.firingCounts.get("rule2"));
+        assertEquals(new Integer(2), (Integer) ls.firingCounts.get("rule3"));
+        assertEquals(6, ls.totalFires);
+
+	}
+
+
+	public void testExclusive() throws Exception {
+		HashSet<String> set = new HashSet<String>();
+		set.add("rule3");
+
+
+		StatefulSession session  = getWorkingMemory("test_rules.drl");
+
+        TestingEventListener ls = new TestingEventListener();
+        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);
+
+        session.addEventListener(ls);
+
+        session.insert(new Cheese());
+        session.fireAllRules(ls.getAgendaFilter(set, false));
+
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule2"));
+
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule3"));
+        assertTrue(ls.firingCounts.containsKey("rule3"));
+        assertFalse(ls.firingCounts.containsKey("rule4"));
+
+
+	}
+
+	public void testNoFilter() throws Exception {
+		HashSet<String> set = new HashSet<String>();
+
+
+		StatefulSession session  = getWorkingMemory("test_rules.drl");
+
+        TestingEventListener ls = new TestingEventListener();
+        //TestingEventListener.stubOutRules(set, session.getRuleBase(), false);
+
+        session.addEventListener(ls);
+
+        session.insert(new Cheese());
+
+        List<String> list = new ArrayList<String>();
+        session.setGlobal("list", list);
+        session.fireAllRules(ls.getAgendaFilter(set, false));
+
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule1"));
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule2"));
+        assertEquals(new Integer(1), (Integer) ls.firingCounts.get("rule3"));
+        assertEquals(1, list.size());
+	}
+
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/StoreHandler.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/StoreHandler.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/StoreHandler.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+package org.drools.xml;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Process;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.StartNode;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class StoreHandler extends BaseAbstractHandler
+    implements
+    Handler {
+    public StoreHandler() {
+        if ( (this.validParents == null) && (this.validPeers == null) ) {
+            this.validParents = new HashSet();
+            this.validParents.add( Process.class );
+
+            this.validPeers = new HashSet();            
+            this.validPeers.add( StartNode.class );
+            this.validPeers.add( ActionNode.class );            
+
+            this.allowNesting = false;
+        }
+    }
+    
+
+    
+    public Object start(final String uri,
+                        final String localName,
+                        final Attributes attrs,
+                        final ExtensibleXmlParser xmlPackageReader) throws SAXException {
+        xmlPackageReader.startConfiguration( localName,
+                                                  attrs );
+        
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) xmlPackageReader.getParent();
+        
+        ActionNode actionNode = new ActionNode();
+        
+        final String name = attrs.getValue( "name" );        
+        emptyAttributeCheck( localName, "name", name, xmlPackageReader );        
+        actionNode.setName( name );
+        
+        process.addNode( actionNode );
+        ((ProcessBuildData)xmlPackageReader.getData()).addNode( actionNode );
+        
+        return actionNode;
+    }    
+    
+    public Object end(final String uri,
+                      final String localName,
+                      final ExtensibleXmlParser xmlPackageReader) throws SAXException {
+        final Configuration config = xmlPackageReader.endConfiguration();
+        WorkflowProcessImpl  process = ( WorkflowProcessImpl ) xmlPackageReader.getParent();
+
+        ActionNode actionNode = ( ActionNode ) xmlPackageReader.getCurrent();
+        
+        String text = config.getText();
+        
+        DroolsConsequenceAction actionText = new DroolsConsequenceAction( "mvel", "list.add(\"" + text + "\")" );
+        
+        actionNode.setAction( actionText );
+        
+        return actionNode;
+    }
+
+    public Class generateNodeFor() {
+        return ActionNode.class;
+    }    
+
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXml.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXml.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXml.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools.xml;
+
+import java.io.InputStreamReader;
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.drools.ruleflow.core.RuleFlowProcess;
+
+public class TestXml extends TestCase {
+
+    public void testSimpleXml() throws Exception {
+        SemanticModules modules = new SemanticModules();
+        modules.addSemanticModule(new ProcessSemanticModule());
+        XmlProcessReader reader = new XmlProcessReader(modules);
+        reader.read(new InputStreamReader(TestXml.class.getResourceAsStream("XmlTest.xml")));
+        RuleFlowProcess process = (RuleFlowProcess) reader.getProcess();
+        assertNotNull(process);
+
+        XmlRuleFlowProcesDumper dumper = new XmlRuleFlowProcesDumper();
+        String output = dumper.dump(process);
+        System.out.println(output);
+        reader = new XmlProcessReader(new SemanticModules());
+        reader.read(new StringReader(output));
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXmlDsl.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXmlDsl.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/TestXmlDsl.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+package org.drools.xml;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+
+import junit.framework.TestCase;
+
+
+public class TestXmlDsl extends TestCase {
+        public void testSimpleDsl() throws Exception {          
+            Properties properties = new Properties();
+            properties.put( "semanticModules", "mydsl.conf" );
+            
+            PackageBuilderConfiguration conf = new PackageBuilderConfiguration( properties );
+            
+            PackageBuilder builder = new PackageBuilder( conf );
+            builder.addProcessFromXml( new InputStreamReader( TestXmlDsl.class.getResourceAsStream( "XmlDslTest.xml" ) ) );
+            
+            System.out.println( builder.getErrors() );
+            
+            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+            ruleBase.addPackage( builder.getPackage() );
+            
+            StatefulSession session = ruleBase.newStatefulSession();
+            List list = new ArrayList();
+            session.setGlobal( "list", list );
+            
+            session.startProcess( "process name" );
+            
+            assertEquals( 2, list.size() );
+            assertEquals( "action node was here", list.get(0) );
+            assertEquals( "dsl was here", list.get(1) );            
+        }   
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/processes/ActionNodeTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/processes/ActionNodeTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/processes/ActionNodeTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.xml.processes;
+
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.process.core.Process;
+import org.drools.xml.XmlProcessReader;
+
+public class ActionNodeTest extends TestCase {
+    public void testSingleActionNode() throws Exception {                
+        PackageBuilder builder = new PackageBuilder();
+        builder.addProcessFromXml( new InputStreamReader( ActionNodeTest.class.getResourceAsStream( "ActionNodeTest.xml" ) ) );
+        
+        System.out.println( builder.getErrors() );
+        
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        ruleBase.addPackage( builder.getPackage() );
+        
+        StatefulSession session = ruleBase.newStatefulSession();
+        List list = new ArrayList();
+        session.setGlobal( "list", list );
+        
+        session.startProcess( "process name" );
+        
+        assertEquals( 1, list.size() );
+        assertEquals( "action node was here", list.get(0) );        
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,90 @@
+package org.drools.xml.rules;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the dump/convert format utilities.
+ * 
+ * @author Michael Neale
+ * @author Fernando Meyer
+ */
+
+public class DumperTest extends TestCase {
+
+    // Xml Dumper test
+    
+    public void testRoundTripAccumulateXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseAccumulate.xml" );
+    }
+
+    public void testRoundTripCollectXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseCollect.xml" );
+    }
+    
+    public void testRoundTripExistsXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseExists.xml" );
+    }
+
+    public void testRoundTripForallXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseForall.xml" );
+    }
+
+    public void testRoundTripFromXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseFrom.xml" );
+    }
+
+    public void testRoundTripComplexRuleXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_RoundTrip.xml" );
+    }
+    
+    // Drl Dumper test
+
+    public void testRoundTripComplexRuleDrl() throws Exception {
+        DumperTestHelper.DrlFile( "test_RoundTrip.drl" );
+    }
+    
+    public void testRoundTripCollectDrl() throws Exception {
+        DumperTestHelper.DrlFile( "../../integrationtests/test_Collect.drl" );
+    }
+    
+    public void testRoundTripAccumulateDrl() throws Exception {
+        DumperTestHelper.DrlFile( "test_accumulateall.drl" );
+    }
+    
+    public void testRoundTripExistsDrl() throws Exception {
+        DumperTestHelper.DrlFile( "../../integrationtests/test_exists.drl" );
+    }
+
+    public void testRoundTripForallDrl() throws Exception {
+        DumperTestHelper.DrlFile( "../../integrationtests/test_Forall.drl" );
+    }
+
+    public void testRoundTripFromDrl() throws Exception {
+        DumperTestHelper.DrlFile( "test_from.drl" );
+    }
+
+    public void testRoundTripSimpleRuleDrl() throws Exception {
+        DumperTestHelper.DrlFile( "test_simplerule.drl" );
+    }
+
+    public void testRoundTripPComplexDrl() throws Exception {
+        DumperTestHelper.DrlFile( "test_complex.drl" );
+    }
+    
+    public void testRoundTripPComplexXml() throws Exception {
+        DumperTestHelper.XmlFile( "test_ParseComplex.xml" );
+    }
+    
+    public static void testStaticMethod1() {
+        System.out.println( "testStaticMethod1" ) ;
+    }
+    
+    public static void testStaticMethod2() {
+        System.out.println( "testStaticMethod2" ) ;
+    }
+    
+    public static void testStaticMethod3() {
+        System.out.println( "testStaticMethod3" ) ;
+    }    
+    
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTestHelper.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTestHelper.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/DumperTestHelper.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,80 @@
+/**
+ * 
+ */
+package org.drools.xml.rules;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+
+import junit.framework.Assert;
+
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.DrlDumper;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.xml.SemanticModules;
+import org.drools.xml.XmlDumper;
+import org.drools.xml.XmlPackageReader;
+
+/**
+ * Helper Class for both xml and drl Dump Tests
+ * 
+ * @author fernandomeyer
+ */
+public class DumperTestHelper extends Assert {
+    
+    public static void XmlFile(String filename) throws Exception {
+        PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        
+        XmlPackageReader xmlPackageReader = new XmlPackageReader( conf.getSemanticModules() );
+        xmlPackageReader.read( new InputStreamReader( DumperTestHelper.class.getResourceAsStream( filename ) ) );
+        final PackageDescr pkgOriginal = xmlPackageReader.getPackageDescr();
+
+        final XmlDumper dumper = new XmlDumper();
+        final String result = dumper.dump( pkgOriginal );
+        
+        String buffer = readFile( filename );
+        
+        assertEqualsIgnoreWhitespace( buffer,
+                                      result );
+        assertNotNull( result );
+    }
+
+    public static void DrlFile(String filename) throws Exception {
+
+        DrlParser parser = new DrlParser();
+        final PackageDescr pkgOriginal = parser.parse( new InputStreamReader( DumperTestHelper.class.getResourceAsStream( filename ) ) );
+        final DrlDumper dumper = new DrlDumper();
+        String result = dumper.dump( pkgOriginal );
+
+        parser = new DrlParser();
+        String buffer = readFile( filename );
+        assertEqualsIgnoreWhitespace( buffer.toString(),
+                                      result );                 
+    }
+
+    private static void assertEqualsIgnoreWhitespace(final String expected,
+                                              final String actual) {
+        final String cleanExpected = expected.replaceAll( "\\s+",
+                                                          "" );
+        final String cleanActual = actual.replaceAll( "\\s+",
+                                                      "" );
+        assertEquals( cleanExpected,
+                      cleanActual );
+    }
+
+    private static String readFile(final String file) throws IOException {
+        final InputStreamReader reader = new InputStreamReader( DumperTestHelper.class.getResourceAsStream( file ) );
+        final StringBuffer text = new StringBuffer();
+        final char[] buf = new char[1024];
+        int len = 0;
+
+        while ( (len = reader.read( buf )) >= 0 ) {
+            text.append( buf,
+                         0,
+                         len );
+        }
+        return text.toString();
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/XmlPackageReaderTest.java
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/XmlPackageReaderTest.java	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/java/org/drools/xml/rules/XmlPackageReaderTest.java	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,686 @@
+package org.drools.xml.rules;
+
+import java.io.InputStreamReader;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.AccessorDescr;
+import org.drools.lang.descr.AccumulateDescr;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.BaseDescr;
+import org.drools.lang.descr.CollectDescr;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.ForallDescr;
+import org.drools.lang.descr.FromDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.GlobalDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.QueryDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.xml.SemanticModules;
+import org.drools.xml.XmlPackageReader;
+
+public class XmlPackageReaderTest extends TestCase {
+
+    protected RuleBase getRuleBase() throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            null );
+    }
+
+    protected RuleBase getRuleBase(final RuleBaseConfiguration config) throws Exception {
+
+        return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
+                                            config );
+    }
+
+    public void testParseFrom() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseFrom.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 0 );
+        PatternDescr patterndescr = (PatternDescr) obj.getLhs().getDescrs().get( 0 );
+        
+        FromDescr from = (FromDescr) patterndescr.getSource();
+        
+        AccessorDescr accessordescriptor =  (AccessorDescr) from.getDataSource();
+        assertEquals( accessordescriptor.getVariableName(), "cheesery" );
+
+        assertEquals( patterndescr.getObjectType(), "Cheese" );
+        assertEquals( patterndescr.getIdentifier(), "cheese" );
+        
+    }
+
+    public void testAccumulate() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseAccumulate.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 0 );
+
+        Object patternobj = obj.getLhs().getDescrs().get( 0 );
+        assertTrue( patternobj instanceof PatternDescr );
+        final PatternDescr patterncheese = (PatternDescr) patternobj;
+        assertEquals( patterncheese.getIdentifier(), "cheese" );
+        assertEquals( patterncheese.getObjectType(), "Cheese" );
+        
+        AccumulateDescr accumulatedescr = (AccumulateDescr) patterncheese.getSource();
+        assertEquals( "total += $cheese.getPrice();",
+                      accumulatedescr.getActionCode() );
+        assertEquals( "int total = 0;",
+                      accumulatedescr.getInitCode() );
+        assertEquals( "new Integer( total ) );",
+                      accumulatedescr.getResultCode() );
+
+        patternobj = obj.getLhs().getDescrs().get( 1 );
+        assertTrue( patternobj instanceof PatternDescr );
+        
+        final PatternDescr patternmax = (PatternDescr) patternobj;
+        assertEquals( patternmax.getIdentifier(), "max" );
+        assertEquals( patternmax.getObjectType(), "Number" );
+        
+        accumulatedescr = (AccumulateDescr) patternmax.getSource();
+        
+        assertTrue( accumulatedescr.isExternalFunction() );
+        
+        assertEquals( "max",
+                      accumulatedescr.getFunctionIdentifier() );
+        
+        assertNull( accumulatedescr.getInitCode() );
+        assertNull( accumulatedescr.getActionCode() );
+        assertNull( accumulatedescr.getResultCode() );
+        assertNull( accumulatedescr.getReverseCode());
+        
+    }
+    
+    
+    public void testAccumulateMultiPattern() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseAccumulate.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 1 );
+
+        Object patternobj = obj.getLhs().getDescrs().get( 0 );
+        assertTrue( patternobj instanceof PatternDescr );
+        final PatternDescr patterncheese = (PatternDescr) patternobj;
+        assertEquals( patterncheese.getIdentifier(), "cheese" );
+        assertEquals( patterncheese.getObjectType(), "Cheese" );
+        
+        AccumulateDescr accumulatedescr = (AccumulateDescr) patterncheese.getSource();
+        assertEquals( "total += $cheese.getPrice();",
+                      accumulatedescr.getActionCode() );
+        assertEquals( "int total = 0;",
+                      accumulatedescr.getInitCode() );
+        assertEquals( "new Integer( total ) );",
+                      accumulatedescr.getResultCode() );
+        
+        AndDescr anddescr = (AndDescr) accumulatedescr.getInput();
+        
+        List descrlist = anddescr.getDescrs(); 
+        
+        PatternDescr[] listpattern = (PatternDescr[]) descrlist.toArray(new PatternDescr[descrlist.size()]);
+        
+        assertEquals(listpattern[0].getObjectType(), "Milk");
+        assertEquals(listpattern[1].getObjectType(), "Cup");
+    }
+    
+    public void testParseForall() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseForall.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 0 );
+        ForallDescr forall = (ForallDescr) obj.getLhs().getDescrs().get( 0 );
+        List forallPaterns = forall.getDescrs();
+
+        PatternDescr pattarnState = (PatternDescr) forallPaterns.get( 0 );
+        PatternDescr personState = (PatternDescr) forallPaterns.get( 1 );
+        PatternDescr cheeseState = (PatternDescr) forallPaterns.get( 2 );
+
+        assertEquals( pattarnState.getObjectType(),
+                      "State" );
+        assertEquals( personState.getObjectType(),
+                      "Person" );
+        assertEquals( cheeseState.getObjectType(),
+                      "Cheese" );
+    }
+
+    public void testParseExists() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseExists.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 0 );
+        Object existdescr = obj.getLhs().getDescrs().get( 0 );
+        assertTrue( existdescr instanceof ExistsDescr );
+
+        Object patternDescriptor = ((ExistsDescr) existdescr).getDescrs().get( 0 );
+        assertTrue( patternDescriptor instanceof PatternDescr );
+        assertEquals( ((PatternDescr) patternDescriptor).getObjectType(),
+                      "Person" );
+
+        Object notDescr = obj.getLhs().getDescrs().get( 1 );
+
+        assertEquals( notDescr.getClass().getName(),
+                      NotDescr.class.getName() );
+        existdescr = ((NotDescr) notDescr).getDescrs().get( 0 );
+        patternDescriptor = ((ExistsDescr) existdescr).getDescrs().get( 0 );
+        assertTrue( patternDescriptor instanceof PatternDescr );
+        assertEquals( ((PatternDescr) patternDescriptor).getObjectType(),
+                      "Cheese" );
+    }
+
+    public void testParseCollect() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseCollect.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+
+        assertNotNull( packageDescr );
+
+        RuleDescr obj = (RuleDescr) packageDescr.getRules().get( 0 );
+        Object objectpattern = obj.getLhs().getDescrs().get( 0 );
+        assertTrue( objectpattern instanceof PatternDescr );
+
+        PatternDescr patterndescr = (PatternDescr) objectpattern;
+        
+        assertEquals( patterndescr.getObjectType(),
+                                    "Cheese" );
+        
+        Object collectobj = patterndescr.getSource();
+        
+        assertTrue( collectobj instanceof CollectDescr );
+        
+        CollectDescr collectDescr = (CollectDescr) collectobj;
+        
+        PatternDescr inputpattern =  collectDescr.getInputPattern();
+        
+        assertEquals( inputpattern.getObjectType(),
+                    "Person" );
+        Object fieldContraintObject = inputpattern.getConstraint().getDescrs().get( 0 );
+        assertTrue( fieldContraintObject instanceof FieldConstraintDescr );
+        FieldConstraintDescr fieldconstraintdescr = (FieldConstraintDescr) fieldContraintObject;
+        assertEquals( fieldconstraintdescr.getFieldName(),
+                      "hair" );
+        Object literal1 = fieldconstraintdescr.getRestrictions().get( 0 );
+        assertTrue( literal1 instanceof LiteralRestrictionDescr );
+        LiteralRestrictionDescr literalDesc = (LiteralRestrictionDescr) literal1;
+        assertEquals( literalDesc.getEvaluator(),
+                      "==" );
+        assertEquals( literalDesc.getText(),
+                      "pink" );
+
+        fieldContraintObject = patterndescr.getConstraint().getDescrs().get( 0 );
+        assertTrue( fieldContraintObject instanceof FieldConstraintDescr );
+        fieldconstraintdescr = (FieldConstraintDescr) fieldContraintObject;
+        assertEquals( fieldconstraintdescr.getFieldName(),
+                      "type" );
+        literal1 = fieldconstraintdescr.getRestrictions().get( 0 );
+        assertTrue( literal1 instanceof LiteralRestrictionDescr );
+        literalDesc = (LiteralRestrictionDescr) literal1;
+        assertEquals( literalDesc.getEvaluator(),
+                      "==" );
+        assertEquals( literalDesc.getText(),
+                      "1" );
+        
+    }
+
+    public void testParsePackageName() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParsePackageName.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+    }
+
+    public void testParseImport() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseImport.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+        
+        final List functionImport = packageDescr.getFunctionImports();
+        
+        assertEquals("org.drools.function", 
+                     ((FunctionImportDescr) functionImport.get( 0 )).getTarget() );
+    }
+
+    public void testParseGlobal() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseGlobal.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+    }
+
+    public void testParseFunction() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseFunction.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+
+        final FunctionDescr functionDescr = (FunctionDescr) packageDescr.getFunctions().get( 0 );
+        final List names = functionDescr.getParameterNames();
+        assertEquals( "foo",
+                      names.get( 0 ) );
+        assertEquals( "bada",
+                      names.get( 1 ) );
+
+        final List types = functionDescr.getParameterTypes();
+        assertEquals( "Bar",
+                      types.get( 0 ) );
+        assertEquals( "Bing",
+                      types.get( 1 ) );
+
+        assertEquals( "System.out.println(\"hello world\");",
+                      functionDescr.getText().trim() );
+    }
+
+    public void testParseRule() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseRule.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+
+        final FunctionDescr functionDescr = (FunctionDescr) packageDescr.getFunctions().get( 0 );
+        final List names = functionDescr.getParameterNames();
+        assertEquals( "foo",
+                      names.get( 0 ) );
+        assertEquals( "bada",
+                      names.get( 1 ) );
+
+        final List types = functionDescr.getParameterTypes();
+        assertEquals( "Bar",
+                      types.get( 0 ) );
+        assertEquals( "Bing",
+                      types.get( 1 ) );
+
+        assertEquals( "System.out.println(\"hello world\");",
+                      functionDescr.getText().trim() );
+
+        final RuleDescr ruleDescr = (RuleDescr) packageDescr.getRules().get( 0 );
+        assertEquals( "simple_rule",
+                      ruleDescr.getName() );
+
+        assertEquals( 4,
+                      ruleDescr.getAttributes().size() );
+        final AttributeDescr attributeDescr = (AttributeDescr) ruleDescr.getAttributes().get( 0 );
+        assertEquals( "salience",
+                      attributeDescr.getName() );
+        assertEquals( "10",
+                      attributeDescr.getValue() );
+
+        final AndDescr lhs = ruleDescr.getLhs();
+        assertEquals( 7,
+                      lhs.getDescrs().size() );
+        final PatternDescr patternDescr = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "Bar",
+                      patternDescr.getObjectType() );
+
+        final String consequence = (String) ruleDescr.getConsequence();
+        assertNotNull( consequence );
+    }
+
+    public void testParseLhs() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseLhs.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+
+        final FunctionDescr functionDescr = (FunctionDescr) packageDescr.getFunctions().get( 0 );
+        final List names = functionDescr.getParameterNames();
+        assertEquals( "foo",
+                      names.get( 0 ) );
+        assertEquals( "bada",
+                      names.get( 1 ) );
+
+        final List types = functionDescr.getParameterTypes();
+        assertEquals( "Bar",
+                      types.get( 0 ) );
+        assertEquals( "Bing",
+                      types.get( 1 ) );
+
+        assertEquals( "System.out.println(\"hello world\");",
+                      functionDescr.getText().trim() );
+
+        final RuleDescr ruleDescr = (RuleDescr) packageDescr.getRules().get( 0 );
+        assertEquals( "my rule",
+                      ruleDescr.getName() );
+
+        final AndDescr lhsDescr = ruleDescr.getLhs();
+
+        AndDescr andDescr = (AndDescr) lhsDescr.getDescrs().get( 0 );
+        OrDescr orDescr = (OrDescr) lhsDescr.getDescrs().get( 1 );
+        final PatternDescr pattern1 = (PatternDescr) lhsDescr.getDescrs().get( 2 );
+        assertNull( pattern1.getIdentifier() );
+        assertEquals( "Foo",
+                      pattern1.getObjectType() );
+
+        final PatternDescr pattern2 = (PatternDescr) lhsDescr.getDescrs().get( 3 );
+        assertEquals( "Bar",
+                      pattern2.getObjectType() );
+        assertEquals( "bar",
+                      pattern2.getIdentifier() );
+
+        final PatternDescr pattern3 = (PatternDescr) lhsDescr.getDescrs().get( 4 );
+        //final LiteralDescr literalDescr = (LiteralDescr) pattern3.getDescrs().get( 0 );
+        final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) pattern3.getDescrs().get( 0 );
+        final LiteralRestrictionDescr literalDescr = (LiteralRestrictionDescr) fieldConstraintDescr.getRestrictions().get( 0 );
+        assertEquals( "field1",
+                      fieldConstraintDescr.getFieldName() );
+        assertEquals( "==",
+                      literalDescr.getEvaluator() );
+        assertEquals( "value1",
+                      literalDescr.getText() );
+
+        final ReturnValueRestrictionDescr returnValueDescr = (ReturnValueRestrictionDescr) fieldConstraintDescr.getRestrictions().get( 1 );
+        assertEquals( "==",
+                      returnValueDescr.getEvaluator() );
+        assertEquals( "1==1",
+                      returnValueDescr.getContent() );
+
+        final VariableRestrictionDescr variableDescr = (VariableRestrictionDescr) fieldConstraintDescr.getRestrictions().get( 2 );
+        assertEquals( "==",
+                      variableDescr.getEvaluator() );
+        assertEquals( "var1",
+                      variableDescr.getIdentifier() );
+
+        final PredicateDescr predicateDescr = (PredicateDescr) pattern3.getDescrs().get( 1 );
+        assertEquals( "1==1",
+                      predicateDescr.getContent() );
+
+        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) pattern3.getDescrs().get( 2 );
+        assertEquals( "field1",
+                      fieldBindingDescr.getFieldName() );
+        assertEquals( "var1",
+                      fieldBindingDescr.getIdentifier() );
+
+        final NotDescr notDescr = (NotDescr) lhsDescr.getDescrs().get( 5 );
+        assertEquals( 1,
+                      notDescr.getDescrs().size() );
+        PatternDescr patternDescr = (PatternDescr) notDescr.getDescrs().get( 0 );
+        assertEquals( "Bar",
+                      patternDescr.getObjectType() );
+
+        final ExistsDescr existsDescr = (ExistsDescr) lhsDescr.getDescrs().get( 6 );
+        assertEquals( 1,
+                      existsDescr.getDescrs().size() );
+        patternDescr = (PatternDescr) existsDescr.getDescrs().get( 0 );
+        assertEquals( "Bar",
+                      patternDescr.getObjectType() );
+
+        andDescr = (AndDescr) lhsDescr.getDescrs().get( 7 );
+        assertEquals( 2,
+                      andDescr.getDescrs().size() );
+        orDescr = (OrDescr) andDescr.getDescrs().get( 1 );
+        patternDescr = (PatternDescr) orDescr.getDescrs().get( 0 );
+        assertEquals( "Bar",
+                      patternDescr.getObjectType() );
+        patternDescr = (PatternDescr) andDescr.getDescrs().get( 0 );
+        assertEquals( "Yada",
+                      patternDescr.getObjectType() );
+
+        orDescr = (OrDescr) lhsDescr.getDescrs().get( 8 );
+        assertEquals( 2,
+                      orDescr.getDescrs().size() );
+        andDescr = (AndDescr) orDescr.getDescrs().get( 1 );
+        patternDescr = (PatternDescr) andDescr.getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      patternDescr.getObjectType() );
+        patternDescr = (PatternDescr) orDescr.getDescrs().get( 0 );
+        assertEquals( "Zaa",
+                      patternDescr.getObjectType() );
+
+        final EvalDescr evalDescr = (EvalDescr) lhsDescr.getDescrs().get( 9 );
+        assertEquals( "1==1",
+                      evalDescr.getContent() );
+    }
+
+    public void testParseRhs() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseRhs.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+
+        final FunctionDescr functionDescr = (FunctionDescr) packageDescr.getFunctions().get( 0 );
+        final List names = functionDescr.getParameterNames();
+        assertEquals( "foo",
+                      names.get( 0 ) );
+        assertEquals( "bada",
+                      names.get( 1 ) );
+
+        final List types = functionDescr.getParameterTypes();
+        assertEquals( "Bar",
+                      types.get( 0 ) );
+        assertEquals( "Bing",
+                      types.get( 1 ) );
+
+        assertEquals( "System.out.println(\"hello world\");",
+                      functionDescr.getText().trim() );
+
+        final RuleDescr ruleDescr = (RuleDescr) packageDescr.getRules().get( 0 );
+        assertEquals( "my rule",
+                      ruleDescr.getName() );
+
+        final String consequence = (String) ruleDescr.getConsequence();
+        assertNotNull( consequence );
+        assertEquals( "System.out.println( \"hello\" );",
+                      consequence.trim() );
+    }
+
+    public void testParseQuery() throws Exception {
+        final XmlPackageReader xmlPackageReader = getXmReader();
+        xmlPackageReader.read( new InputStreamReader( getClass().getResourceAsStream( "test_ParseQuery.xml" ) ) );
+        final PackageDescr packageDescr = xmlPackageReader.getPackageDescr();
+        assertNotNull( packageDescr );
+        assertEquals( "com.sample",
+                      packageDescr.getName() );
+
+        final List imports = packageDescr.getImports();
+        assertEquals( 2,
+                      imports.size() );
+        assertEquals( "java.util.HashMap",
+                      ((ImportDescr) imports.get( 0 )).getTarget() );
+        assertEquals( "org.drools.*",
+                      ((ImportDescr) imports.get( 1 )).getTarget() );
+
+        final List globals = packageDescr.getGlobals();
+        assertEquals( 2,
+                      globals.size() );
+        final GlobalDescr x = (GlobalDescr) globals.get( 0 );
+        final GlobalDescr yada = (GlobalDescr) globals.get( 1 );
+        assertEquals( "com.sample.X",
+                      x.getType() );
+        assertEquals( "x",
+                      x.getIdentifier() );
+        assertEquals( "com.sample.Yada",
+                      yada.getType() );
+        assertEquals( "yada",
+                      yada.getIdentifier() );
+
+        final FunctionDescr functionDescr = (FunctionDescr) packageDescr.getFunctions().get( 0 );
+        final List names = functionDescr.getParameterNames();
+        assertEquals( "foo",
+                      names.get( 0 ) );
+        assertEquals( "bada",
+                      names.get( 1 ) );
+
+        final List types = functionDescr.getParameterTypes();
+        assertEquals( "Bar",
+                      types.get( 0 ) );
+        assertEquals( "Bing",
+                      types.get( 1 ) );
+
+        assertEquals( "System.out.println(\"hello world\");",
+                      functionDescr.getText().trim() );
+
+        final QueryDescr queryDescr = (QueryDescr) packageDescr.getRules().get( 0 );
+        assertEquals( "my query",
+                      queryDescr.getName() );
+
+        final AndDescr lhs = queryDescr.getLhs();
+        assertEquals( 1,
+                      lhs.getDescrs().size() );
+        final PatternDescr patternDescr = (PatternDescr) lhs.getDescrs().get( 0 );
+        assertEquals( "Foo",
+                      patternDescr.getObjectType() );
+
+    }
+    
+    private XmlPackageReader getXmReader() {
+        PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+        
+        return new XmlPackageReader( conf.getSemanticModules() );        
+    }
+}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelNodeBuilderRegistry.conf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelNodeBuilderRegistry.conf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelNodeBuilderRegistry.conf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+// we use MVEL to configure our nodes, simply populate a map, which will be added to the main registry
+import org.drools.bpel.core.BPELAssign;
+import org.drools.process.builder.ActionNodeBuilder;
+
+[
+    BPELAssign   : new ActionNodeBuilder(),
+]

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelProcessNodeInstanceFactory.conf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelProcessNodeInstanceFactory.conf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/bpelProcessNodeInstanceFactory.conf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+// we use MVEL to configure our nodes, simply populate a map, which will be added to the main registry
+import org.drools.bpel.core.BPELAssign;
+import org.drools.bpel.core.BPELFlow;
+import org.drools.bpel.core.BPELInvoke;
+import org.drools.bpel.core.BPELReceive;
+import org.drools.bpel.core.BPELReply;
+import org.drools.bpel.core.BPELScope;
+import org.drools.bpel.core.BPELSequence;
+import org.drools.bpel.instance.BPELAssignInstance;
+import org.drools.bpel.instance.BPELFlowInstance;
+import org.drools.bpel.instance.BPELInvokeInstance;
+import org.drools.bpel.instance.BPELReceiveInstance;
+import org.drools.bpel.instance.BPELReplyInstance;
+import org.drools.bpel.instance.BPELScopeInstance;
+import org.drools.bpel.instance.BPELSequenceInstance;
+import org.drools.workflow.instance.impl.factory.CreateNewNodeFactory;
+
+[
+    BPELAssign   : new CreateNewNodeFactory( BPELAssignInstance ),
+    BPELFlow     : new CreateNewNodeFactory( BPELFlowInstance ),
+    BPELInvoke   : new CreateNewNodeFactory( BPELInvokeInstance ),
+    BPELReceive  : new CreateNewNodeFactory( BPELReceiveInstance ),
+    BPELReply    : new CreateNewNodeFactory( BPELReplyInstance ),
+    BPELScope    : new CreateNewNodeFactory( BPELScopeInstance ),
+    BPELSequence : new CreateNewNodeFactory( BPELSequenceInstance ),
+]

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/mydsl.conf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/mydsl.conf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/META-INF/mydsl.conf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,2 @@
+uri=http://domain/org/mydsl
+store=org.drools.xml.StoreHandler
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/modeldriven/Some.enumeration
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/modeldriven/Some.enumeration	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/modeldriven/Some.enumeration	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+'Person.age' : [1, 2, 3, 4]
+'Person.rating' : ["High", "Low"]
+'Person.something' : (new org.drools.brms.modeldriven.SampleDataSource()).getData()

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/util/existing_brl.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/util/existing_brl.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/brms/server/util/existing_brl.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,52 @@
+<rule>
+  <modelVersion>1.0</modelVersion>
+  <attributes>
+    <attribute>
+      <attributeName>no-loop</attributeName>
+      <value>true</value>
+    </attribute>
+  </attributes>
+  <lhs>
+    <fact>
+     <constraintList>
+      <constraints>
+        <fieldConstraint>
+          <fieldBinding>f1</fieldBinding>
+          <fieldName>age</fieldName>
+          <operator>&lt;</operator>
+          <value>42</value>
+          <constraintValueType>0</constraintValueType>
+        </fieldConstraint>
+      </constraints>
+     </constraintList>
+      <factType>Person</factType>
+      <boundName>p1</boundName>
+    </fact>
+    <compositePattern>
+      <type>not</type>
+      <patterns>
+        <fact>
+          <factType>Cancel</factType>
+        </fact>
+      </patterns>
+    </compositePattern>
+  </lhs>
+  <rhs>
+    <modify>
+      <variable>p1</variable>
+      <fieldValues>
+        <fieldValue>
+          <field>status</field>
+          <value>rejected</value>
+          <type>String</type>
+        </fieldValue>
+      </fieldValues>
+    </modify>
+    <retract>
+      <variableName>p1</variableName>
+    </retract>
+    <dslSentence>
+      <sentence>Send an email to {administrator}</sentence>
+    </dslSentence>
+  </rhs>
+</rule>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/bad_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/bad_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/bad_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package HR2
+
+rule simple_rule 
+  when  		  	
+  	a : (not ( Cheese(type == "stilton") ))
+  	exists ( Foo() )
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/java5_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/java5_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/java5_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "like cheddar"
+    when
+        Cheese( $type:type )
+    then
+        System.out.println("I like " + $type);
+        for (byte bt:$type.getBytes()) {
+            System.out.println("byte=" + bt);
+        }
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumber.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumber.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumber.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3412 @@
+#created on: 27-Jun-2007
+package org.drools.test
+
+
+#list any import classes here.
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+
+
+rule "Cheese_1"	
+	when
+		$c : Cheese( price == 1 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_1"
+	when 
+		$p : Person(name == "p1")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_2"	
+	when
+		$c : Cheese( price == 2 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_2"
+	when 
+		$p : Person(name == "p2")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_3"	
+	when
+		$c : Cheese( price == 3 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_3"
+	when 
+		$p : Person(name == "p3")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_4"	
+	when
+		$c : Cheese( price == 4 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_4"
+	when 
+		$p : Person(name == "p4")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_5"	
+	when
+		$c : Cheese( price == 5 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_5"
+	when 
+		$p : Person(name == "p5")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_6"	
+	when
+		$c : Cheese( price == 6 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_6"
+	when 
+		$p : Person(name == "p6")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_7"	
+	when
+		$c : Cheese( price == 7 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_7"
+	when 
+		$p : Person(name == "p7")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_8"	
+	when
+		$c : Cheese( price == 8 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_8"
+	when 
+		$p : Person(name == "p8")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_9"	
+	when
+		$c : Cheese( price == 9 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_9"
+	when 
+		$p : Person(name == "p9")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_10"	
+	when
+		$c : Cheese( price == 10 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_10"
+	when 
+		$p : Person(name == "p10")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_11"	
+	when
+		$c : Cheese( price == 11 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_11"
+	when 
+		$p : Person(name == "p11")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_12"	
+	when
+		$c : Cheese( price == 12 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_12"
+	when 
+		$p : Person(name == "p12")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_13"	
+	when
+		$c : Cheese( price == 13 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_13"
+	when 
+		$p : Person(name == "p13")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_14"	
+	when
+		$c : Cheese( price == 14 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_14"
+	when 
+		$p : Person(name == "p14")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_15"	
+	when
+		$c : Cheese( price == 15 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_15"
+	when 
+		$p : Person(name == "p15")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_16"	
+	when
+		$c : Cheese( price == 16 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_16"
+	when 
+		$p : Person(name == "p16")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_17"	
+	when
+		$c : Cheese( price == 17 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_17"
+	when 
+		$p : Person(name == "p17")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_18"	
+	when
+		$c : Cheese( price == 18 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_18"
+	when 
+		$p : Person(name == "p18")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_19"	
+	when
+		$c : Cheese( price == 19 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_19"
+	when 
+		$p : Person(name == "p19")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_20"	
+	when
+		$c : Cheese( price == 20 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_20"
+	when 
+		$p : Person(name == "p20")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_21"	
+	when
+		$c : Cheese( price == 21 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_21"
+	when 
+		$p : Person(name == "p21")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_22"	
+	when
+		$c : Cheese( price == 22 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_22"
+	when 
+		$p : Person(name == "p22")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_23"	
+	when
+		$c : Cheese( price == 23 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_23"
+	when 
+		$p : Person(name == "p23")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_24"	
+	when
+		$c : Cheese( price == 24 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_24"
+	when 
+		$p : Person(name == "p24")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_25"	
+	when
+		$c : Cheese( price == 25 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_25"
+	when 
+		$p : Person(name == "p25")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_26"	
+	when
+		$c : Cheese( price == 26 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_26"
+	when 
+		$p : Person(name == "p26")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_27"	
+	when
+		$c : Cheese( price == 27 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_27"
+	when 
+		$p : Person(name == "p27")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_28"	
+	when
+		$c : Cheese( price == 28 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_28"
+	when 
+		$p : Person(name == "p28")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_29"	
+	when
+		$c : Cheese( price == 29 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_29"
+	when 
+		$p : Person(name == "p29")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_30"	
+	when
+		$c : Cheese( price == 30 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_30"
+	when 
+		$p : Person(name == "p30")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_31"	
+	when
+		$c : Cheese( price == 31 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_31"
+	when 
+		$p : Person(name == "p31")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_32"	
+	when
+		$c : Cheese( price == 32 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_32"
+	when 
+		$p : Person(name == "p32")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_33"	
+	when
+		$c : Cheese( price == 33 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_33"
+	when 
+		$p : Person(name == "p33")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_34"	
+	when
+		$c : Cheese( price == 34 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_34"
+	when 
+		$p : Person(name == "p34")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_35"	
+	when
+		$c : Cheese( price == 35 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_35"
+	when 
+		$p : Person(name == "p35")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_36"	
+	when
+		$c : Cheese( price == 36 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_36"
+	when 
+		$p : Person(name == "p36")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_37"	
+	when
+		$c : Cheese( price == 37 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_37"
+	when 
+		$p : Person(name == "p37")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_38"	
+	when
+		$c : Cheese( price == 38 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_38"
+	when 
+		$p : Person(name == "p38")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_39"	
+	when
+		$c : Cheese( price == 39 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_39"
+	when 
+		$p : Person(name == "p39")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_40"	
+	when
+		$c : Cheese( price == 40 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_40"
+	when 
+		$p : Person(name == "p40")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_41"	
+	when
+		$c : Cheese( price == 41 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_41"
+	when 
+		$p : Person(name == "p41")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_42"	
+	when
+		$c : Cheese( price == 42 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_42"
+	when 
+		$p : Person(name == "p42")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_43"	
+	when
+		$c : Cheese( price == 43 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_43"
+	when 
+		$p : Person(name == "p43")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_44"	
+	when
+		$c : Cheese( price == 44 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_44"
+	when 
+		$p : Person(name == "p44")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_45"	
+	when
+		$c : Cheese( price == 45 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_45"
+	when 
+		$p : Person(name == "p45")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_46"	
+	when
+		$c : Cheese( price == 46 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_46"
+	when 
+		$p : Person(name == "p46")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_47"	
+	when
+		$c : Cheese( price == 47 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_47"
+	when 
+		$p : Person(name == "p47")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_48"	
+	when
+		$c : Cheese( price == 48 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_48"
+	when 
+		$p : Person(name == "p48")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_49"	
+	when
+		$c : Cheese( price == 49 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_49"
+	when 
+		$p : Person(name == "p49")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_50"	
+	when
+		$c : Cheese( price == 50 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_50"
+	when 
+		$p : Person(name == "p50")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_51"	
+	when
+		$c : Cheese( price == 51 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_51"
+	when 
+		$p : Person(name == "p51")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_52"	
+	when
+		$c : Cheese( price == 52 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_52"
+	when 
+		$p : Person(name == "p52")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_53"	
+	when
+		$c : Cheese( price == 53 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_53"
+	when 
+		$p : Person(name == "p53")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_54"	
+	when
+		$c : Cheese( price == 54 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_54"
+	when 
+		$p : Person(name == "p54")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_55"	
+	when
+		$c : Cheese( price == 55 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_55"
+	when 
+		$p : Person(name == "p55")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_56"	
+	when
+		$c : Cheese( price == 56 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_56"
+	when 
+		$p : Person(name == "p56")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_57"	
+	when
+		$c : Cheese( price == 57 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_57"
+	when 
+		$p : Person(name == "p57")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_58"	
+	when
+		$c : Cheese( price == 58 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_58"
+	when 
+		$p : Person(name == "p58")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_59"	
+	when
+		$c : Cheese( price == 59 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_59"
+	when 
+		$p : Person(name == "p59")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_60"	
+	when
+		$c : Cheese( price == 60 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_60"
+	when 
+		$p : Person(name == "p60")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_61"	
+	when
+		$c : Cheese( price == 61 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_61"
+	when 
+		$p : Person(name == "p61")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_62"	
+	when
+		$c : Cheese( price == 62 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_62"
+	when 
+		$p : Person(name == "p62")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_63"	
+	when
+		$c : Cheese( price == 63 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_63"
+	when 
+		$p : Person(name == "p63")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_64"	
+	when
+		$c : Cheese( price == 64 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_64"
+	when 
+		$p : Person(name == "p64")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_65"	
+	when
+		$c : Cheese( price == 65 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_65"
+	when 
+		$p : Person(name == "p65")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_66"	
+	when
+		$c : Cheese( price == 66 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_66"
+	when 
+		$p : Person(name == "p66")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_67"	
+	when
+		$c : Cheese( price == 67 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_67"
+	when 
+		$p : Person(name == "p67")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_68"	
+	when
+		$c : Cheese( price == 68 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_68"
+	when 
+		$p : Person(name == "p68")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_69"	
+	when
+		$c : Cheese( price == 69 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_69"
+	when 
+		$p : Person(name == "p69")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_70"	
+	when
+		$c : Cheese( price == 70 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_70"
+	when 
+		$p : Person(name == "p70")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_71"	
+	when
+		$c : Cheese( price == 71 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_71"
+	when 
+		$p : Person(name == "p71")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_72"	
+	when
+		$c : Cheese( price == 72 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_72"
+	when 
+		$p : Person(name == "p72")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_73"	
+	when
+		$c : Cheese( price == 73 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_73"
+	when 
+		$p : Person(name == "p73")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_74"	
+	when
+		$c : Cheese( price == 74 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_74"
+	when 
+		$p : Person(name == "p74")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_75"	
+	when
+		$c : Cheese( price == 75 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_75"
+	when 
+		$p : Person(name == "p75")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_76"	
+	when
+		$c : Cheese( price == 76 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_76"
+	when 
+		$p : Person(name == "p76")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_77"	
+	when
+		$c : Cheese( price == 77 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_77"
+	when 
+		$p : Person(name == "p77")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_78"	
+	when
+		$c : Cheese( price == 78 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_78"
+	when 
+		$p : Person(name == "p78")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_79"	
+	when
+		$c : Cheese( price == 79 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_79"
+	when 
+		$p : Person(name == "p79")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_80"	
+	when
+		$c : Cheese( price == 80 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_80"
+	when 
+		$p : Person(name == "p80")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_81"	
+	when
+		$c : Cheese( price == 81 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_81"
+	when 
+		$p : Person(name == "p81")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_82"	
+	when
+		$c : Cheese( price == 82 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_82"
+	when 
+		$p : Person(name == "p82")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_83"	
+	when
+		$c : Cheese( price == 83 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_83"
+	when 
+		$p : Person(name == "p83")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_84"	
+	when
+		$c : Cheese( price == 84 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_84"
+	when 
+		$p : Person(name == "p84")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_85"	
+	when
+		$c : Cheese( price == 85 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_85"
+	when 
+		$p : Person(name == "p85")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_86"	
+	when
+		$c : Cheese( price == 86 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_86"
+	when 
+		$p : Person(name == "p86")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_87"	
+	when
+		$c : Cheese( price == 87 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_87"
+	when 
+		$p : Person(name == "p87")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_88"	
+	when
+		$c : Cheese( price == 88 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_88"
+	when 
+		$p : Person(name == "p88")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_89"	
+	when
+		$c : Cheese( price == 89 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_89"
+	when 
+		$p : Person(name == "p89")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_90"	
+	when
+		$c : Cheese( price == 90 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_90"
+	when 
+		$p : Person(name == "p90")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_91"	
+	when
+		$c : Cheese( price == 91 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_91"
+	when 
+		$p : Person(name == "p91")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_92"	
+	when
+		$c : Cheese( price == 92 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_92"
+	when 
+		$p : Person(name == "p92")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_93"	
+	when
+		$c : Cheese( price == 93 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_93"
+	when 
+		$p : Person(name == "p93")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_94"	
+	when
+		$c : Cheese( price == 94 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_94"
+	when 
+		$p : Person(name == "p94")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_95"	
+	when
+		$c : Cheese( price == 95 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_95"
+	when 
+		$p : Person(name == "p95")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_96"	
+	when
+		$c : Cheese( price == 96 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_96"
+	when 
+		$p : Person(name == "p96")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_97"	
+	when
+		$c : Cheese( price == 97 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_97"
+	when 
+		$p : Person(name == "p97")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_98"	
+	when
+		$c : Cheese( price == 98 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_98"
+	when 
+		$p : Person(name == "p98")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_99"	
+	when
+		$c : Cheese( price == 99 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_99"
+	when 
+		$p : Person(name == "p99")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_100"	
+	when
+		$c : Cheese( price == 100 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_100"
+	when 
+		$p : Person(name == "p100")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_101"	
+	when
+		$c : Cheese( price == 101 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_101"
+	when 
+		$p : Person(name == "p101")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_102"	
+	when
+		$c : Cheese( price == 102 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_102"
+	when 
+		$p : Person(name == "p102")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_103"	
+	when
+		$c : Cheese( price == 103 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_103"
+	when 
+		$p : Person(name == "p103")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_104"	
+	when
+		$c : Cheese( price == 104 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_104"
+	when 
+		$p : Person(name == "p104")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_105"	
+	when
+		$c : Cheese( price == 105 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_105"
+	when 
+		$p : Person(name == "p105")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_106"	
+	when
+		$c : Cheese( price == 106 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_106"
+	when 
+		$p : Person(name == "p106")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_107"	
+	when
+		$c : Cheese( price == 107 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_107"
+	when 
+		$p : Person(name == "p107")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_108"	
+	when
+		$c : Cheese( price == 108 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_108"
+	when 
+		$p : Person(name == "p108")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_109"	
+	when
+		$c : Cheese( price == 109 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_109"
+	when 
+		$p : Person(name == "p109")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_110"	
+	when
+		$c : Cheese( price == 110 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_110"
+	when 
+		$p : Person(name == "p110")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_111"	
+	when
+		$c : Cheese( price == 111 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_111"
+	when 
+		$p : Person(name == "p111")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_112"	
+	when
+		$c : Cheese( price == 112 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_112"
+	when 
+		$p : Person(name == "p112")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_113"	
+	when
+		$c : Cheese( price == 113 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_113"
+	when 
+		$p : Person(name == "p113")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_114"	
+	when
+		$c : Cheese( price == 114 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_114"
+	when 
+		$p : Person(name == "p114")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_115"	
+	when
+		$c : Cheese( price == 115 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_115"
+	when 
+		$p : Person(name == "p115")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_116"	
+	when
+		$c : Cheese( price == 116 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_116"
+	when 
+		$p : Person(name == "p116")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_117"	
+	when
+		$c : Cheese( price == 117 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_117"
+	when 
+		$p : Person(name == "p117")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_118"	
+	when
+		$c : Cheese( price == 118 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_118"
+	when 
+		$p : Person(name == "p118")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_119"	
+	when
+		$c : Cheese( price == 119 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_119"
+	when 
+		$p : Person(name == "p119")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_120"	
+	when
+		$c : Cheese( price == 120 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_120"
+	when 
+		$p : Person(name == "p120")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_121"	
+	when
+		$c : Cheese( price == 121 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_121"
+	when 
+		$p : Person(name == "p121")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_122"	
+	when
+		$c : Cheese( price == 122 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_122"
+	when 
+		$p : Person(name == "p122")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_123"	
+	when
+		$c : Cheese( price == 123 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_123"
+	when 
+		$p : Person(name == "p123")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_124"	
+	when
+		$c : Cheese( price == 124 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_124"
+	when 
+		$p : Person(name == "p124")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_125"	
+	when
+		$c : Cheese( price == 125 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_125"
+	when 
+		$p : Person(name == "p125")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_126"	
+	when
+		$c : Cheese( price == 126 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_126"
+	when 
+		$p : Person(name == "p126")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_127"	
+	when
+		$c : Cheese( price == 127 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_127"
+	when 
+		$p : Person(name == "p127")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_128"	
+	when
+		$c : Cheese( price == 128 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_128"
+	when 
+		$p : Person(name == "p128")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_129"	
+	when
+		$c : Cheese( price == 129 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_129"
+	when 
+		$p : Person(name == "p129")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_130"	
+	when
+		$c : Cheese( price == 130 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_130"
+	when 
+		$p : Person(name == "p130")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_131"	
+	when
+		$c : Cheese( price == 131 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_131"
+	when 
+		$p : Person(name == "p131")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_132"	
+	when
+		$c : Cheese( price == 132 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_132"
+	when 
+		$p : Person(name == "p132")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_133"	
+	when
+		$c : Cheese( price == 133 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_133"
+	when 
+		$p : Person(name == "p133")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_134"	
+	when
+		$c : Cheese( price == 134 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_134"
+	when 
+		$p : Person(name == "p134")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_135"	
+	when
+		$c : Cheese( price == 135 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_135"
+	when 
+		$p : Person(name == "p135")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_136"	
+	when
+		$c : Cheese( price == 136 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_136"
+	when 
+		$p : Person(name == "p136")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_137"	
+	when
+		$c : Cheese( price == 137 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_137"
+	when 
+		$p : Person(name == "p137")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_138"	
+	when
+		$c : Cheese( price == 138 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_138"
+	when 
+		$p : Person(name == "p138")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_139"	
+	when
+		$c : Cheese( price == 139 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_139"
+	when 
+		$p : Person(name == "p139")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_140"	
+	when
+		$c : Cheese( price == 140 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_140"
+	when 
+		$p : Person(name == "p140")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_141"	
+	when
+		$c : Cheese( price == 141 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_141"
+	when 
+		$p : Person(name == "p141")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_142"	
+	when
+		$c : Cheese( price == 142 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_142"
+	when 
+		$p : Person(name == "p142")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_143"	
+	when
+		$c : Cheese( price == 143 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_143"
+	when 
+		$p : Person(name == "p143")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_144"	
+	when
+		$c : Cheese( price == 144 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_144"
+	when 
+		$p : Person(name == "p144")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_145"	
+	when
+		$c : Cheese( price == 145 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_145"
+	when 
+		$p : Person(name == "p145")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_146"	
+	when
+		$c : Cheese( price == 146 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_146"
+	when 
+		$p : Person(name == "p146")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_147"	
+	when
+		$c : Cheese( price == 147 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_147"
+	when 
+		$p : Person(name == "p147")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_148"	
+	when
+		$c : Cheese( price == 148 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_148"
+	when 
+		$p : Person(name == "p148")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_149"	
+	when
+		$c : Cheese( price == 149 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_149"
+	when 
+		$p : Person(name == "p149")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_150"	
+	when
+		$c : Cheese( price == 150 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_150"
+	when 
+		$p : Person(name == "p150")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_151"	
+	when
+		$c : Cheese( price == 151 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_151"
+	when 
+		$p : Person(name == "p151")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_152"	
+	when
+		$c : Cheese( price == 152 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_152"
+	when 
+		$p : Person(name == "p152")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_153"	
+	when
+		$c : Cheese( price == 153 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_153"
+	when 
+		$p : Person(name == "p153")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_154"	
+	when
+		$c : Cheese( price == 154 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_154"
+	when 
+		$p : Person(name == "p154")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_155"	
+	when
+		$c : Cheese( price == 155 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_155"
+	when 
+		$p : Person(name == "p155")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_156"	
+	when
+		$c : Cheese( price == 156 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_156"
+	when 
+		$p : Person(name == "p156")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_157"	
+	when
+		$c : Cheese( price == 157 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_157"
+	when 
+		$p : Person(name == "p157")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_158"	
+	when
+		$c : Cheese( price == 158 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_158"
+	when 
+		$p : Person(name == "p158")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_159"	
+	when
+		$c : Cheese( price == 159 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_159"
+	when 
+		$p : Person(name == "p159")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_160"	
+	when
+		$c : Cheese( price == 160 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_160"
+	when 
+		$p : Person(name == "p160")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_161"	
+	when
+		$c : Cheese( price == 161 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_161"
+	when 
+		$p : Person(name == "p161")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_162"	
+	when
+		$c : Cheese( price == 162 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_162"
+	when 
+		$p : Person(name == "p162")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_163"	
+	when
+		$c : Cheese( price == 163 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_163"
+	when 
+		$p : Person(name == "p163")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_164"	
+	when
+		$c : Cheese( price == 164 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_164"
+	when 
+		$p : Person(name == "p164")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_165"	
+	when
+		$c : Cheese( price == 165 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_165"
+	when 
+		$p : Person(name == "p165")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_166"	
+	when
+		$c : Cheese( price == 166 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_166"
+	when 
+		$p : Person(name == "p166")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_167"	
+	when
+		$c : Cheese( price == 167 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_167"
+	when 
+		$p : Person(name == "p167")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_168"	
+	when
+		$c : Cheese( price == 168 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_168"
+	when 
+		$p : Person(name == "p168")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_169"	
+	when
+		$c : Cheese( price == 169 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_169"
+	when 
+		$p : Person(name == "p169")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_170"	
+	when
+		$c : Cheese( price == 170 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_170"
+	when 
+		$p : Person(name == "p170")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_171"	
+	when
+		$c : Cheese( price == 171 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_171"
+	when 
+		$p : Person(name == "p171")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_172"	
+	when
+		$c : Cheese( price == 172 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_172"
+	when 
+		$p : Person(name == "p172")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_173"	
+	when
+		$c : Cheese( price == 173 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_173"
+	when 
+		$p : Person(name == "p173")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_174"	
+	when
+		$c : Cheese( price == 174 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_174"
+	when 
+		$p : Person(name == "p174")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_175"	
+	when
+		$c : Cheese( price == 175 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_175"
+	when 
+		$p : Person(name == "p175")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_176"	
+	when
+		$c : Cheese( price == 176 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_176"
+	when 
+		$p : Person(name == "p176")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_177"	
+	when
+		$c : Cheese( price == 177 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_177"
+	when 
+		$p : Person(name == "p177")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_178"	
+	when
+		$c : Cheese( price == 178 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_178"
+	when 
+		$p : Person(name == "p178")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_179"	
+	when
+		$c : Cheese( price == 179 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_179"
+	when 
+		$p : Person(name == "p179")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_180"	
+	when
+		$c : Cheese( price == 180 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_180"
+	when 
+		$p : Person(name == "p180")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_181"	
+	when
+		$c : Cheese( price == 181 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_181"
+	when 
+		$p : Person(name == "p181")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_182"	
+	when
+		$c : Cheese( price == 182 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_182"
+	when 
+		$p : Person(name == "p182")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_183"	
+	when
+		$c : Cheese( price == 183 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_183"
+	when 
+		$p : Person(name == "p183")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_184"	
+	when
+		$c : Cheese( price == 184 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_184"
+	when 
+		$p : Person(name == "p184")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_185"	
+	when
+		$c : Cheese( price == 185 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_185"
+	when 
+		$p : Person(name == "p185")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_186"	
+	when
+		$c : Cheese( price == 186 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_186"
+	when 
+		$p : Person(name == "p186")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_187"	
+	when
+		$c : Cheese( price == 187 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_187"
+	when 
+		$p : Person(name == "p187")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_188"	
+	when
+		$c : Cheese( price == 188 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_188"
+	when 
+		$p : Person(name == "p188")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_189"	
+	when
+		$c : Cheese( price == 189 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_189"
+	when 
+		$p : Person(name == "p189")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_190"	
+	when
+		$c : Cheese( price == 190 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_190"
+	when 
+		$p : Person(name == "p190")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_191"	
+	when
+		$c : Cheese( price == 191 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_191"
+	when 
+		$p : Person(name == "p191")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_192"	
+	when
+		$c : Cheese( price == 192 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_192"
+	when 
+		$p : Person(name == "p192")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_193"	
+	when
+		$c : Cheese( price == 193 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_193"
+	when 
+		$p : Person(name == "p193")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_194"	
+	when
+		$c : Cheese( price == 194 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_194"
+	when 
+		$p : Person(name == "p194")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_195"	
+	when
+		$c : Cheese( price == 195 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_195"
+	when 
+		$p : Person(name == "p195")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_196"	
+	when
+		$c : Cheese( price == 196 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_196"
+	when 
+		$p : Person(name == "p196")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_197"	
+	when
+		$c : Cheese( price == 197 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_197"
+	when 
+		$p : Person(name == "p197")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_198"	
+	when
+		$c : Cheese( price == 198 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_198"
+	when 
+		$p : Person(name == "p198")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_199"	
+	when
+		$c : Cheese( price == 199 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_199"
+	when 
+		$p : Person(name == "p199")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_200"	
+	when
+		$c : Cheese( price == 200 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_200"
+	when 
+		$p : Person(name == "p200")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+		
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumberMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumberMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/compiler/largeRuleNumberMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3413 @@
+#created on: 27-Jun-2007
+package org.drools.test
+
+dialect "mvel"
+
+#list any import classes here.
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+
+
+rule "Cheese_1"	
+	when
+		$c : Cheese( price == 1 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_1"
+	when 
+		$p : Person(name == "p1")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_2"	
+	when
+		$c : Cheese( price == 2 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_2"
+	when 
+		$p : Person(name == "p2")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_3"	
+	when
+		$c : Cheese( price == 3 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_3"
+	when 
+		$p : Person(name == "p3")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_4"	
+	when
+		$c : Cheese( price == 4 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_4"
+	when 
+		$p : Person(name == "p4")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_5"	
+	when
+		$c : Cheese( price == 5 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_5"
+	when 
+		$p : Person(name == "p5")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_6"	
+	when
+		$c : Cheese( price == 6 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_6"
+	when 
+		$p : Person(name == "p6")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_7"	
+	when
+		$c : Cheese( price == 7 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_7"
+	when 
+		$p : Person(name == "p7")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_8"	
+	when
+		$c : Cheese( price == 8 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_8"
+	when 
+		$p : Person(name == "p8")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_9"	
+	when
+		$c : Cheese( price == 9 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_9"
+	when 
+		$p : Person(name == "p9")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_10"	
+	when
+		$c : Cheese( price == 10 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_10"
+	when 
+		$p : Person(name == "p10")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_11"	
+	when
+		$c : Cheese( price == 11 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_11"
+	when 
+		$p : Person(name == "p11")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_12"	
+	when
+		$c : Cheese( price == 12 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_12"
+	when 
+		$p : Person(name == "p12")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_13"	
+	when
+		$c : Cheese( price == 13 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_13"
+	when 
+		$p : Person(name == "p13")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_14"	
+	when
+		$c : Cheese( price == 14 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_14"
+	when 
+		$p : Person(name == "p14")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_15"	
+	when
+		$c : Cheese( price == 15 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_15"
+	when 
+		$p : Person(name == "p15")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_16"	
+	when
+		$c : Cheese( price == 16 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_16"
+	when 
+		$p : Person(name == "p16")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_17"	
+	when
+		$c : Cheese( price == 17 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_17"
+	when 
+		$p : Person(name == "p17")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_18"	
+	when
+		$c : Cheese( price == 18 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_18"
+	when 
+		$p : Person(name == "p18")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_19"	
+	when
+		$c : Cheese( price == 19 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_19"
+	when 
+		$p : Person(name == "p19")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_20"	
+	when
+		$c : Cheese( price == 20 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_20"
+	when 
+		$p : Person(name == "p20")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_21"	
+	when
+		$c : Cheese( price == 21 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_21"
+	when 
+		$p : Person(name == "p21")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_22"	
+	when
+		$c : Cheese( price == 22 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_22"
+	when 
+		$p : Person(name == "p22")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_23"	
+	when
+		$c : Cheese( price == 23 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_23"
+	when 
+		$p : Person(name == "p23")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_24"	
+	when
+		$c : Cheese( price == 24 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_24"
+	when 
+		$p : Person(name == "p24")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_25"	
+	when
+		$c : Cheese( price == 25 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_25"
+	when 
+		$p : Person(name == "p25")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_26"	
+	when
+		$c : Cheese( price == 26 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_26"
+	when 
+		$p : Person(name == "p26")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_27"	
+	when
+		$c : Cheese( price == 27 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_27"
+	when 
+		$p : Person(name == "p27")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_28"	
+	when
+		$c : Cheese( price == 28 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_28"
+	when 
+		$p : Person(name == "p28")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_29"	
+	when
+		$c : Cheese( price == 29 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_29"
+	when 
+		$p : Person(name == "p29")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_30"	
+	when
+		$c : Cheese( price == 30 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_30"
+	when 
+		$p : Person(name == "p30")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_31"	
+	when
+		$c : Cheese( price == 31 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_31"
+	when 
+		$p : Person(name == "p31")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_32"	
+	when
+		$c : Cheese( price == 32 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_32"
+	when 
+		$p : Person(name == "p32")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_33"	
+	when
+		$c : Cheese( price == 33 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_33"
+	when 
+		$p : Person(name == "p33")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_34"	
+	when
+		$c : Cheese( price == 34 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_34"
+	when 
+		$p : Person(name == "p34")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_35"	
+	when
+		$c : Cheese( price == 35 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_35"
+	when 
+		$p : Person(name == "p35")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_36"	
+	when
+		$c : Cheese( price == 36 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_36"
+	when 
+		$p : Person(name == "p36")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_37"	
+	when
+		$c : Cheese( price == 37 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_37"
+	when 
+		$p : Person(name == "p37")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_38"	
+	when
+		$c : Cheese( price == 38 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_38"
+	when 
+		$p : Person(name == "p38")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_39"	
+	when
+		$c : Cheese( price == 39 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_39"
+	when 
+		$p : Person(name == "p39")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_40"	
+	when
+		$c : Cheese( price == 40 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_40"
+	when 
+		$p : Person(name == "p40")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_41"	
+	when
+		$c : Cheese( price == 41 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_41"
+	when 
+		$p : Person(name == "p41")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_42"	
+	when
+		$c : Cheese( price == 42 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_42"
+	when 
+		$p : Person(name == "p42")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_43"	
+	when
+		$c : Cheese( price == 43 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_43"
+	when 
+		$p : Person(name == "p43")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_44"	
+	when
+		$c : Cheese( price == 44 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_44"
+	when 
+		$p : Person(name == "p44")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_45"	
+	when
+		$c : Cheese( price == 45 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_45"
+	when 
+		$p : Person(name == "p45")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_46"	
+	when
+		$c : Cheese( price == 46 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_46"
+	when 
+		$p : Person(name == "p46")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_47"	
+	when
+		$c : Cheese( price == 47 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_47"
+	when 
+		$p : Person(name == "p47")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_48"	
+	when
+		$c : Cheese( price == 48 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_48"
+	when 
+		$p : Person(name == "p48")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_49"	
+	when
+		$c : Cheese( price == 49 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_49"
+	when 
+		$p : Person(name == "p49")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_50"	
+	when
+		$c : Cheese( price == 50 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_50"
+	when 
+		$p : Person(name == "p50")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_51"	
+	when
+		$c : Cheese( price == 51 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_51"
+	when 
+		$p : Person(name == "p51")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_52"	
+	when
+		$c : Cheese( price == 52 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_52"
+	when 
+		$p : Person(name == "p52")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_53"	
+	when
+		$c : Cheese( price == 53 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_53"
+	when 
+		$p : Person(name == "p53")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_54"	
+	when
+		$c : Cheese( price == 54 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_54"
+	when 
+		$p : Person(name == "p54")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_55"	
+	when
+		$c : Cheese( price == 55 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_55"
+	when 
+		$p : Person(name == "p55")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_56"	
+	when
+		$c : Cheese( price == 56 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_56"
+	when 
+		$p : Person(name == "p56")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_57"	
+	when
+		$c : Cheese( price == 57 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_57"
+	when 
+		$p : Person(name == "p57")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_58"	
+	when
+		$c : Cheese( price == 58 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_58"
+	when 
+		$p : Person(name == "p58")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_59"	
+	when
+		$c : Cheese( price == 59 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_59"
+	when 
+		$p : Person(name == "p59")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_60"	
+	when
+		$c : Cheese( price == 60 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_60"
+	when 
+		$p : Person(name == "p60")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_61"	
+	when
+		$c : Cheese( price == 61 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_61"
+	when 
+		$p : Person(name == "p61")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_62"	
+	when
+		$c : Cheese( price == 62 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_62"
+	when 
+		$p : Person(name == "p62")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_63"	
+	when
+		$c : Cheese( price == 63 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_63"
+	when 
+		$p : Person(name == "p63")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_64"	
+	when
+		$c : Cheese( price == 64 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_64"
+	when 
+		$p : Person(name == "p64")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_65"	
+	when
+		$c : Cheese( price == 65 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_65"
+	when 
+		$p : Person(name == "p65")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_66"	
+	when
+		$c : Cheese( price == 66 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_66"
+	when 
+		$p : Person(name == "p66")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_67"	
+	when
+		$c : Cheese( price == 67 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_67"
+	when 
+		$p : Person(name == "p67")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_68"	
+	when
+		$c : Cheese( price == 68 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_68"
+	when 
+		$p : Person(name == "p68")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_69"	
+	when
+		$c : Cheese( price == 69 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_69"
+	when 
+		$p : Person(name == "p69")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_70"	
+	when
+		$c : Cheese( price == 70 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_70"
+	when 
+		$p : Person(name == "p70")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_71"	
+	when
+		$c : Cheese( price == 71 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_71"
+	when 
+		$p : Person(name == "p71")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_72"	
+	when
+		$c : Cheese( price == 72 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_72"
+	when 
+		$p : Person(name == "p72")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_73"	
+	when
+		$c : Cheese( price == 73 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_73"
+	when 
+		$p : Person(name == "p73")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_74"	
+	when
+		$c : Cheese( price == 74 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_74"
+	when 
+		$p : Person(name == "p74")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_75"	
+	when
+		$c : Cheese( price == 75 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_75"
+	when 
+		$p : Person(name == "p75")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_76"	
+	when
+		$c : Cheese( price == 76 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_76"
+	when 
+		$p : Person(name == "p76")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_77"	
+	when
+		$c : Cheese( price == 77 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_77"
+	when 
+		$p : Person(name == "p77")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_78"	
+	when
+		$c : Cheese( price == 78 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_78"
+	when 
+		$p : Person(name == "p78")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_79"	
+	when
+		$c : Cheese( price == 79 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_79"
+	when 
+		$p : Person(name == "p79")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_80"	
+	when
+		$c : Cheese( price == 80 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_80"
+	when 
+		$p : Person(name == "p80")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_81"	
+	when
+		$c : Cheese( price == 81 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_81"
+	when 
+		$p : Person(name == "p81")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_82"	
+	when
+		$c : Cheese( price == 82 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_82"
+	when 
+		$p : Person(name == "p82")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_83"	
+	when
+		$c : Cheese( price == 83 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_83"
+	when 
+		$p : Person(name == "p83")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_84"	
+	when
+		$c : Cheese( price == 84 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_84"
+	when 
+		$p : Person(name == "p84")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_85"	
+	when
+		$c : Cheese( price == 85 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_85"
+	when 
+		$p : Person(name == "p85")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_86"	
+	when
+		$c : Cheese( price == 86 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_86"
+	when 
+		$p : Person(name == "p86")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_87"	
+	when
+		$c : Cheese( price == 87 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_87"
+	when 
+		$p : Person(name == "p87")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_88"	
+	when
+		$c : Cheese( price == 88 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_88"
+	when 
+		$p : Person(name == "p88")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_89"	
+	when
+		$c : Cheese( price == 89 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_89"
+	when 
+		$p : Person(name == "p89")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_90"	
+	when
+		$c : Cheese( price == 90 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_90"
+	when 
+		$p : Person(name == "p90")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_91"	
+	when
+		$c : Cheese( price == 91 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_91"
+	when 
+		$p : Person(name == "p91")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_92"	
+	when
+		$c : Cheese( price == 92 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_92"
+	when 
+		$p : Person(name == "p92")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_93"	
+	when
+		$c : Cheese( price == 93 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_93"
+	when 
+		$p : Person(name == "p93")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_94"	
+	when
+		$c : Cheese( price == 94 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_94"
+	when 
+		$p : Person(name == "p94")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_95"	
+	when
+		$c : Cheese( price == 95 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_95"
+	when 
+		$p : Person(name == "p95")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_96"	
+	when
+		$c : Cheese( price == 96 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_96"
+	when 
+		$p : Person(name == "p96")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_97"	
+	when
+		$c : Cheese( price == 97 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_97"
+	when 
+		$p : Person(name == "p97")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_98"	
+	when
+		$c : Cheese( price == 98 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_98"
+	when 
+		$p : Person(name == "p98")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_99"	
+	when
+		$c : Cheese( price == 99 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_99"
+	when 
+		$p : Person(name == "p99")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_100"	
+	when
+		$c : Cheese( price == 100 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_100"
+	when 
+		$p : Person(name == "p100")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_101"	
+	when
+		$c : Cheese( price == 101 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_101"
+	when 
+		$p : Person(name == "p101")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_102"	
+	when
+		$c : Cheese( price == 102 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_102"
+	when 
+		$p : Person(name == "p102")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_103"	
+	when
+		$c : Cheese( price == 103 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_103"
+	when 
+		$p : Person(name == "p103")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_104"	
+	when
+		$c : Cheese( price == 104 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_104"
+	when 
+		$p : Person(name == "p104")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_105"	
+	when
+		$c : Cheese( price == 105 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_105"
+	when 
+		$p : Person(name == "p105")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_106"	
+	when
+		$c : Cheese( price == 106 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_106"
+	when 
+		$p : Person(name == "p106")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_107"	
+	when
+		$c : Cheese( price == 107 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_107"
+	when 
+		$p : Person(name == "p107")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_108"	
+	when
+		$c : Cheese( price == 108 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_108"
+	when 
+		$p : Person(name == "p108")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_109"	
+	when
+		$c : Cheese( price == 109 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_109"
+	when 
+		$p : Person(name == "p109")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_110"	
+	when
+		$c : Cheese( price == 110 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_110"
+	when 
+		$p : Person(name == "p110")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_111"	
+	when
+		$c : Cheese( price == 111 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_111"
+	when 
+		$p : Person(name == "p111")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_112"	
+	when
+		$c : Cheese( price == 112 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_112"
+	when 
+		$p : Person(name == "p112")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_113"	
+	when
+		$c : Cheese( price == 113 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_113"
+	when 
+		$p : Person(name == "p113")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_114"	
+	when
+		$c : Cheese( price == 114 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_114"
+	when 
+		$p : Person(name == "p114")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_115"	
+	when
+		$c : Cheese( price == 115 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_115"
+	when 
+		$p : Person(name == "p115")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_116"	
+	when
+		$c : Cheese( price == 116 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_116"
+	when 
+		$p : Person(name == "p116")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_117"	
+	when
+		$c : Cheese( price == 117 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_117"
+	when 
+		$p : Person(name == "p117")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_118"	
+	when
+		$c : Cheese( price == 118 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_118"
+	when 
+		$p : Person(name == "p118")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_119"	
+	when
+		$c : Cheese( price == 119 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_119"
+	when 
+		$p : Person(name == "p119")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_120"	
+	when
+		$c : Cheese( price == 120 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_120"
+	when 
+		$p : Person(name == "p120")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_121"	
+	when
+		$c : Cheese( price == 121 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_121"
+	when 
+		$p : Person(name == "p121")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_122"	
+	when
+		$c : Cheese( price == 122 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_122"
+	when 
+		$p : Person(name == "p122")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_123"	
+	when
+		$c : Cheese( price == 123 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_123"
+	when 
+		$p : Person(name == "p123")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_124"	
+	when
+		$c : Cheese( price == 124 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_124"
+	when 
+		$p : Person(name == "p124")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_125"	
+	when
+		$c : Cheese( price == 125 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_125"
+	when 
+		$p : Person(name == "p125")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_126"	
+	when
+		$c : Cheese( price == 126 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_126"
+	when 
+		$p : Person(name == "p126")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_127"	
+	when
+		$c : Cheese( price == 127 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_127"
+	when 
+		$p : Person(name == "p127")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_128"	
+	when
+		$c : Cheese( price == 128 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_128"
+	when 
+		$p : Person(name == "p128")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_129"	
+	when
+		$c : Cheese( price == 129 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_129"
+	when 
+		$p : Person(name == "p129")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_130"	
+	when
+		$c : Cheese( price == 130 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_130"
+	when 
+		$p : Person(name == "p130")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_131"	
+	when
+		$c : Cheese( price == 131 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_131"
+	when 
+		$p : Person(name == "p131")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_132"	
+	when
+		$c : Cheese( price == 132 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_132"
+	when 
+		$p : Person(name == "p132")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_133"	
+	when
+		$c : Cheese( price == 133 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_133"
+	when 
+		$p : Person(name == "p133")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_134"	
+	when
+		$c : Cheese( price == 134 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_134"
+	when 
+		$p : Person(name == "p134")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_135"	
+	when
+		$c : Cheese( price == 135 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_135"
+	when 
+		$p : Person(name == "p135")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_136"	
+	when
+		$c : Cheese( price == 136 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_136"
+	when 
+		$p : Person(name == "p136")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_137"	
+	when
+		$c : Cheese( price == 137 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_137"
+	when 
+		$p : Person(name == "p137")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_138"	
+	when
+		$c : Cheese( price == 138 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_138"
+	when 
+		$p : Person(name == "p138")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_139"	
+	when
+		$c : Cheese( price == 139 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_139"
+	when 
+		$p : Person(name == "p139")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_140"	
+	when
+		$c : Cheese( price == 140 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_140"
+	when 
+		$p : Person(name == "p140")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_141"	
+	when
+		$c : Cheese( price == 141 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_141"
+	when 
+		$p : Person(name == "p141")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_142"	
+	when
+		$c : Cheese( price == 142 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_142"
+	when 
+		$p : Person(name == "p142")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_143"	
+	when
+		$c : Cheese( price == 143 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_143"
+	when 
+		$p : Person(name == "p143")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_144"	
+	when
+		$c : Cheese( price == 144 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_144"
+	when 
+		$p : Person(name == "p144")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_145"	
+	when
+		$c : Cheese( price == 145 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_145"
+	when 
+		$p : Person(name == "p145")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_146"	
+	when
+		$c : Cheese( price == 146 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_146"
+	when 
+		$p : Person(name == "p146")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_147"	
+	when
+		$c : Cheese( price == 147 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_147"
+	when 
+		$p : Person(name == "p147")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_148"	
+	when
+		$c : Cheese( price == 148 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_148"
+	when 
+		$p : Person(name == "p148")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_149"	
+	when
+		$c : Cheese( price == 149 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_149"
+	when 
+		$p : Person(name == "p149")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_150"	
+	when
+		$c : Cheese( price == 150 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_150"
+	when 
+		$p : Person(name == "p150")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_151"	
+	when
+		$c : Cheese( price == 151 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_151"
+	when 
+		$p : Person(name == "p151")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_152"	
+	when
+		$c : Cheese( price == 152 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_152"
+	when 
+		$p : Person(name == "p152")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_153"	
+	when
+		$c : Cheese( price == 153 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_153"
+	when 
+		$p : Person(name == "p153")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_154"	
+	when
+		$c : Cheese( price == 154 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_154"
+	when 
+		$p : Person(name == "p154")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_155"	
+	when
+		$c : Cheese( price == 155 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_155"
+	when 
+		$p : Person(name == "p155")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_156"	
+	when
+		$c : Cheese( price == 156 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_156"
+	when 
+		$p : Person(name == "p156")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_157"	
+	when
+		$c : Cheese( price == 157 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_157"
+	when 
+		$p : Person(name == "p157")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_158"	
+	when
+		$c : Cheese( price == 158 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_158"
+	when 
+		$p : Person(name == "p158")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_159"	
+	when
+		$c : Cheese( price == 159 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_159"
+	when 
+		$p : Person(name == "p159")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_160"	
+	when
+		$c : Cheese( price == 160 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_160"
+	when 
+		$p : Person(name == "p160")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_161"	
+	when
+		$c : Cheese( price == 161 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_161"
+	when 
+		$p : Person(name == "p161")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_162"	
+	when
+		$c : Cheese( price == 162 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_162"
+	when 
+		$p : Person(name == "p162")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_163"	
+	when
+		$c : Cheese( price == 163 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_163"
+	when 
+		$p : Person(name == "p163")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_164"	
+	when
+		$c : Cheese( price == 164 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_164"
+	when 
+		$p : Person(name == "p164")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_165"	
+	when
+		$c : Cheese( price == 165 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_165"
+	when 
+		$p : Person(name == "p165")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_166"	
+	when
+		$c : Cheese( price == 166 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_166"
+	when 
+		$p : Person(name == "p166")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_167"	
+	when
+		$c : Cheese( price == 167 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_167"
+	when 
+		$p : Person(name == "p167")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_168"	
+	when
+		$c : Cheese( price == 168 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_168"
+	when 
+		$p : Person(name == "p168")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_169"	
+	when
+		$c : Cheese( price == 169 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_169"
+	when 
+		$p : Person(name == "p169")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_170"	
+	when
+		$c : Cheese( price == 170 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_170"
+	when 
+		$p : Person(name == "p170")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_171"	
+	when
+		$c : Cheese( price == 171 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_171"
+	when 
+		$p : Person(name == "p171")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_172"	
+	when
+		$c : Cheese( price == 172 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_172"
+	when 
+		$p : Person(name == "p172")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_173"	
+	when
+		$c : Cheese( price == 173 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_173"
+	when 
+		$p : Person(name == "p173")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_174"	
+	when
+		$c : Cheese( price == 174 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_174"
+	when 
+		$p : Person(name == "p174")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_175"	
+	when
+		$c : Cheese( price == 175 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_175"
+	when 
+		$p : Person(name == "p175")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_176"	
+	when
+		$c : Cheese( price == 176 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_176"
+	when 
+		$p : Person(name == "p176")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_177"	
+	when
+		$c : Cheese( price == 177 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_177"
+	when 
+		$p : Person(name == "p177")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_178"	
+	when
+		$c : Cheese( price == 178 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_178"
+	when 
+		$p : Person(name == "p178")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_179"	
+	when
+		$c : Cheese( price == 179 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_179"
+	when 
+		$p : Person(name == "p179")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_180"	
+	when
+		$c : Cheese( price == 180 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_180"
+	when 
+		$p : Person(name == "p180")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_181"	
+	when
+		$c : Cheese( price == 181 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_181"
+	when 
+		$p : Person(name == "p181")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_182"	
+	when
+		$c : Cheese( price == 182 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_182"
+	when 
+		$p : Person(name == "p182")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_183"	
+	when
+		$c : Cheese( price == 183 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_183"
+	when 
+		$p : Person(name == "p183")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_184"	
+	when
+		$c : Cheese( price == 184 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_184"
+	when 
+		$p : Person(name == "p184")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_185"	
+	when
+		$c : Cheese( price == 185 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_185"
+	when 
+		$p : Person(name == "p185")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_186"	
+	when
+		$c : Cheese( price == 186 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_186"
+	when 
+		$p : Person(name == "p186")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_187"	
+	when
+		$c : Cheese( price == 187 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_187"
+	when 
+		$p : Person(name == "p187")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_188"	
+	when
+		$c : Cheese( price == 188 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_188"
+	when 
+		$p : Person(name == "p188")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_189"	
+	when
+		$c : Cheese( price == 189 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_189"
+	when 
+		$p : Person(name == "p189")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_190"	
+	when
+		$c : Cheese( price == 190 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_190"
+	when 
+		$p : Person(name == "p190")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_191"	
+	when
+		$c : Cheese( price == 191 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_191"
+	when 
+		$p : Person(name == "p191")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_192"	
+	when
+		$c : Cheese( price == 192 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_192"
+	when 
+		$p : Person(name == "p192")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_193"	
+	when
+		$c : Cheese( price == 193 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_193"
+	when 
+		$p : Person(name == "p193")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_194"	
+	when
+		$c : Cheese( price == 194 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_194"
+	when 
+		$p : Person(name == "p194")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_195"	
+	when
+		$c : Cheese( price == 195 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_195"
+	when 
+		$p : Person(name == "p195")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_196"	
+	when
+		$c : Cheese( price == 196 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_196"
+	when 
+		$p : Person(name == "p196")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_197"	
+	when
+		$c : Cheese( price == 197 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_197"
+	when 
+		$p : Person(name == "p197")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_198"	
+	when
+		$c : Cheese( price == 198 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_198"
+	when 
+		$p : Person(name == "p198")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_199"	
+	when
+		$c : Cheese( price == 199 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_199"
+	when 
+		$p : Person(name == "p199")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_200"	
+	when
+		$c : Cheese( price == 200 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_200"
+	when 
+		$p : Person(name == "p200")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+		
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/HelloWorld.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/HelloWorld.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/HelloWorld.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+package HelloWorld
+ 
+#we don't use the import, as class is fully qualified below 
+#import org.drools.integrationtests.helloworld.Message
+
+global java.util.List list;
+
+rule "Hello World"
+	when
+		$m : org.drools.Message(list contains "hello", 
+					text:message == "hola", 
+					number > 40, 
+					birthday > "10-Jul-1974", 
+					message matches ".*ho.*",
+					list excludes "wax")
+	then
+	    // putting in a complex consequence, to make sure it picks up the variabels correctly
+		if (1==1)  {
+			int a = 0;
+		}
+		try {
+			//System.out.println("hello world with collections " + $m.getMessage());
+	    } catch  ( Exception e ) {
+	    
+	    } finally {
+	        list.add( $m );
+	    }
+		$m.setFired(true); 
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/MVEL_soundex.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/MVEL_soundex.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/MVEL_soundex.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package MVELTest
+
+dialect "mvel"
+
+import org.drools.Cheese
+
+
+rule "Hello World"
+	when
+		c : Cheese( eval(type soundslike "foobar"), type soundslike "foo bar" )
+	then
+		c.setPrice(42);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/assert_retract.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/assert_retract.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/assert_retract.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,47 @@
+package org.drools.test
+
+import org.drools.Person
+import org.drools.Cheese
+
+global java.util.List list
+
+rule "first"
+    when
+       	p : Person(status=="start")
+    then
+    	list.add("first");
+    	p.setStatus("next");
+	   	update(p);
+end    
+
+rule "second"	
+	when
+		p : Person(status == "next")
+	then
+		list.add("second");
+		p.setStatus("final");
+		update(p);
+end
+
+rule "third"
+	when
+		p :	Person(status == "final")
+	then
+		list.add("third");
+		retract(p);
+end
+
+rule "fourth"
+	when 
+		not Person()
+	then
+		list.add("fourth");
+		insert(new Cheese("stilton", 42));
+end
+
+rule "fifth"
+	when
+		Cheese(type == "stilton")
+	then
+		list.add("fifth");			
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/big_decimal_and_comparable.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/big_decimal_and_comparable.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/big_decimal_and_comparable.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+#created on: 27-Mar-2006
+package org.drools.test
+
+import org.drools.Person;
+import java.math.BigDecimal;
+
+global java.util.List list;
+
+rule "BigDec"
+	
+	when
+		Person($b : bigDecimal )
+		p : Person(bigDecimal < $b)
+	then 		
+		list.add( p );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,118 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>179</x>
+                  <y>100</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.workflow.core.node.EndNode" id="5">
+                  <id>2</id>
+                  <name>End</name>
+                  <incomingConnections id="6">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="7">
+                        <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                          <from class="org.drools.workflow.core.node.StartNode" id="9">
+                            <id>1</id>
+                            <name>Start</name>
+                            <incomingConnections id="10"/>
+                            <outgoingConnections id="11">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="12">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="13">
+                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="14">
+                                <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+                                <nodes id="15">
+                                  <entry>
+                                    <long>1</long>
+                                    <org.drools.workflow.core.node.StartNode reference="9"/>
+                                  </entry>
+                                  <entry>
+                                    <long>2</long>
+                                    <org.drools.workflow.core.node.EndNode reference="5"/>
+                                  </entry>
+                                </nodes>
+                                <lastNodeId>2</lastNodeId>
+                              </nodeContainer>
+                              <id>com.sample.ruleflow</id>
+                              <name>empty_ruleflow</name>
+                              <version>1.0</version>
+                              <type>RuleFlow</type>
+                              <packageName>com.empty</packageName>
+                              <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="16">
+                                <variables id="17"/>
+                              </variableScope>
+                            </nodeContainer>
+                          </from>
+                          <to class="org.drools.workflow.core.node.EndNode" reference="5"/>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                      </list>
+                    </entry>
+                  </incomingConnections>
+                  <outgoingConnections id="18"/>
+                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+                </element>
+                <incomingConnections id="19">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="20" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="21"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="22" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="23">
+                                <x>34</x>
+                                <y>100</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.StartNode" reference="9"/>
+                              <incomingConnections id="24"/>
+                              <outgoingConnections id="25">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="20"/>
+                              </outgoingConnections>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="8"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="26"/>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="22"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,55 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.EndNode" id="9">
+                    <id>2</id>
+                    <name>End</name>
+                    <incomingConnections id="10">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="11">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="12"/>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.EndNode reference="9"/>
+      </entry>
+    </nodes>
+    <lastNodeId>2</lastNodeId>
+  </nodeContainer>
+  <id>com.sample.ruleflow</id>
+  <name>empty_ruleflow</name>
+  <version>1.0</version>
+  <type>RuleFlow</type>
+  <packageName>com.empty</packageName>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="13">
+    <variables id="14"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,46 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl id="3">
+        <id>1</id>
+        <name>Start</name>
+        <incomingConnections id="4"/>
+        <outgoingConnections id="5">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="6">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="3"/>
+            <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="7">
+              <id>4</id>
+              <name>End</name>
+              <incomingConnections id="8">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="6"/>
+              </incomingConnections>
+              <outgoingConnections id="9"/>
+            </to>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </outgoingConnections>
+      </org.drools.ruleflow.core.impl.StartNodeImpl>
+    </entry>
+    <entry>
+      <long>4</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl reference="7"/>
+    </entry>
+  </nodes>
+  <variables id="10"/>
+  <lastNodeId>9</lastNodeId>
+  <imports id="11">
+    <string>com.sample.Property</string>
+  </imports>
+  <globals id="12">
+    <entry>
+      <string>property</string>
+      <string>Property</string>
+    </entry>
+  </globals>
+  <id>com.sample.ruleflow</id>
+  <name>Ruleflow</name>
+  <version>1.0</version>
+  <type>RuleFlow</type>
+  <packageName>com.empty</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.EndNode" id="9">
+                    <id>2</id>
+                    <name>End</name>
+                    <incomingConnections id="10">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="11">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="12"/>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.EndNode reference="9"/>
+      </entry>
+    </nodes>
+    <lastNodeId>2</lastNodeId>
+  </nodeContainer>
+  <id>com.sample.ruleflow</id>
+  <name>empty_ruleflow</name>
+  <version>1.0</version>
+  <type>RuleFlow</type>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="13">
+    <variables id="14"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,45 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl id="3">
+        <id>1</id>
+        <name>Start</name>
+        <incomingConnections id="4"/>
+        <outgoingConnections id="5">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="6">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="3"/>
+            <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="7">
+              <id>4</id>
+              <name>End</name>
+              <incomingConnections id="8">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="6"/>
+              </incomingConnections>
+              <outgoingConnections id="9"/>
+            </to>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </outgoingConnections>
+      </org.drools.ruleflow.core.impl.StartNodeImpl>
+    </entry>
+    <entry>
+      <long>4</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl reference="7"/>
+    </entry>
+  </nodes>
+  <variables id="10"/>
+  <lastNodeId>9</lastNodeId>
+  <imports id="11">
+    <string>com.sample.Property</string>
+  </imports>
+  <globals id="12">
+    <entry>
+      <string>property</string>
+      <string>Property</string>
+    </entry>
+  </globals>
+  <id>com.sample.ruleflow</id>
+  <name>Ruleflow</name>
+  <version>1.0</version>
+  <type>RuleFlow</type>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_in_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_in_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_in_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.lang.Integer five;
+
+rule "eval rule test"
+    when
+    	#some bad stuff here
+        Stilton()
+		Cheese()
+		Poison()
+    then
+    	#this is an error
+        list.add( ;
+end  
+
+rule "This is fine"
+	when
+		Cheese()
+	then
+		//System.out.println("hello");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_parser_multiple.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_parser_multiple.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/errors_parser_multiple.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+package org.drools.test;
+
+impot org.drools.Cheese;
+
+
+rulex "eval rule test"
+    when
+    	#some bad stuff here
+        Stilton()
+		Cheese()
+		Poison()
+    hen
+    	#this is an error
+        list.add( ;
+end 
+
+
+rule "eval rule test"
+    when
+    	#some bad stuff here
+        Stilton()
+		Cheese()
+		Poison()
+    then
+    	#this is an error
+        list.add( ;
+    
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.lang.Integer five;
+
+rule "eval rule test"
+    when
+        $cheese : Cheese( $type:type == "stilton" )
+        eval( $cheese.getPrice() == five.intValue() )
+    then
+        list.add( $cheese );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test_more.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test_more.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eval_rule_test_more.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.test
+
+import org.drools.Cheese
+import org.drools.Person
+
+global java.util.List list
+ 
+
+rule "another test"
+    when
+        p : Person()
+        eval(p.getName().equals("foo") && p.getName().startsWith("f"))
+    then
+        list.add( p );
+end  
+
+rule "yet more"
+    when
+        p : Person()
+        eval(p.getName().equals("foo") && p.getName().startsWith("f"))
+        eval(p.getName().equals("foo") && p.getName().startsWith("q"))        
+    then
+        list.add( p );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/evalmodify.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/evalmodify.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/evalmodify.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package evalmodify;
+
+import org.drools.Cell
+import java.lang.Integer
+
+rule "test eval"
+	when
+		cell1 : Cell(value1:value != 0)
+		cell2 : Cell(value2:value < value1)				
+		eval (true)
+	then
+		System.out.println("setting value to " + (value2 + 1));
+		cell2.setValue(value2 + 1);
+		update(cell2);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/example_scenario.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/example_scenario.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/example_scenario.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,100 @@
+package test;
+
+import java.lang.*;
+import org.drools.integrationtests.eventgenerator.*;
+import org.drools.integrationtests.eventgenerator.example.*;
+
+
+rule "Rule 1: check for expiry of sliding window (and reset window)"
+	no-loop true
+	#salience 0
+	when
+		PseudoSessionClock ( $currentTime : currentTime )
+		$sw : SlidingWindow ( state == SlidingWindow.DEFAULT, $windowStart : windowStart, $windowEnd : windowEnd < $currentTime )
+	then
+		System.out.println ("RULE 1  \"SLIDING WINDOW EXPIRED\" FIRED  : Sliding window "+$sw.getId()+" of Resource " + $sw.getParentId() + " has expired at (" + Tools.formattedDate($currentTime) +");  collecting follows");
+		//$sw.setLastUpdate($currentTime);
+		$sw.setState(SlidingWindow.COLLECT);
+		update ($sw);
+end
+
+rule "Rule 2: collect specified objects within sliding window"
+	no-loop true
+	#salience 0
+	when
+		$sw : SlidingWindow ( state == SlidingWindow.COLLECT, $windowStart : windowStart, $windowEnd : windowEnd )
+        $evCount : Number()
+            from accumulate ( i: ProductionEvent( parentId == $sw.parentId, startTime >= $windowStart, endTime <= $windowEnd), 
+            				  count(i) )
+	then
+		System.out.println ("RULE 2  \"ACCUMULATE EVENTS IN SW\" FIRED : Found "+$evCount.intValue()+" PRODUCTION events within sliding window "+$sw.getId()+"("+Tools.formattedInterval($windowStart, $windowEnd)+");  evaluation follows");
+		//$sw.setEventsInWindow($swQ);
+		$sw.setNumberEvents($evCount.intValue());
+		$sw.setState(SlidingWindow.EVALUATE);
+		update ($sw);
+end
+
+rule "Rule 3a: number events abnormal; set status of NON-RED resource to RED"
+	no-loop true
+	salience 0
+	when
+		$stat : Status ( id == Status.OPERATIONAL, currentValue != Resource.STATUS_RED )
+		$sw : SlidingWindow ( parentId == $stat.resourceId, state == SlidingWindow.EVALUATE, numberEvents < 80 || > 95 ) 
+	then
+		System.out.println ("RULE 3a \"EVALUATION OF SW\" FIRED        : The number of PRODUCTION events found ("+$sw.getNumberEvents() +") within sliding window " + $sw.getId() + " is abnormal;");
+		System.out.println ("                                          Resource "+ $sw.getParentId() +" has status " + Resource.OPERATIONAL_STATUS_VALUES[$stat.getCurrentValue()] + " and needs to be set to " + Resource.OPERATIONAL_STATUS_VALUES[Resource.STATUS_RED] + ";  advance follows");
+		$sw.setState(SlidingWindow.ADVANCE);
+		update ($sw);
+		SimpleEventGenerator.sendGeneratedEvent(new StatusChangedEvent($sw.getParentId(), $stat.getCurrentValue(), Resource.STATUS_RED, $sw.getLastUpdate(), $sw.getLastUpdate()));
+end
+
+rule "Rule 3b: number events normal; set status of NON-GREEN resource to GREEN"
+	no-loop true
+	salience 0
+	when
+		$stat : Status ( id == Status.OPERATIONAL, currentValue != Resource.STATUS_GREEN )
+		$sw : SlidingWindow ( parentId == $stat.resourceId, state == SlidingWindow.EVALUATE, numberEvents >= 80 && <= 95 ) 
+	then
+		System.out.println ("RULE 3b \"EVALUATION OF SW\" FIRED        : The number of PRODUCTION events found ("+$sw.getNumberEvents() +") within sliding window " + $sw.getId() + " is within the expected range;");
+		System.out.println ("                                          Resource "+ $sw.getParentId() +" has status " + Resource.OPERATIONAL_STATUS_VALUES[$stat.getCurrentValue()] + " and can be set to " + Resource.OPERATIONAL_STATUS_VALUES[Resource.STATUS_GREEN] + ";  advance follows");
+		$sw.setState(SlidingWindow.ADVANCE);
+		update ($sw);
+		SimpleEventGenerator.sendGeneratedEvent(new StatusChangedEvent($sw.getParentId(), $stat.getCurrentValue(), Resource.STATUS_GREEN, $sw.getLastUpdate(), $sw.getLastUpdate()));
+end
+
+rule "Rule 3c: none of the above conditions apply; however, the sliding window need to be advanced"
+	no-loop true
+	salience -1
+	when
+		$stat : Status ( id == Status.OPERATIONAL )
+		$sw : SlidingWindow ( state == SlidingWindow.EVALUATE ) 
+	then
+		System.out.println ("RULE 3c \"EVALUATION OF SW\" FIRED        : No change of the state of the resource "+ $sw.getParentId() +" required;");
+		System.out.println ("                                          Found "+$sw.getNumberEvents() +" PRODUCTION events within sliding window " + $sw.getId() +"; resource has status " + Resource.OPERATIONAL_STATUS_VALUES[$stat.getCurrentValue()] + ";  advance follows");
+		$sw.setState(SlidingWindow.ADVANCE);
+		update ($sw);
+end
+
+rule "Rule 4: do nothing but advancing the window"
+	no-loop true
+	salience -1
+	when
+		$sw : SlidingWindow ( state == SlidingWindow.ADVANCE ) 
+	then
+		$sw.advance();
+		System.out.println ("RULE 4  \"ADVANCE SLIDING WINDOW\" FIRED  : Reset sliding window to "+Tools.formattedInterval($sw.getWindowStart(), $sw.getWindowEnd())+";  action follows");
+		$sw.setState(SlidingWindow.DEFAULT);
+		update ($sw);
+end
+
+rule "Rule 5: status changed event - set resource status to desired value"
+	no-loop true
+	when
+		$stat : Status ( id == Status.OPERATIONAL ) 
+		$stChEv : StatusChangedEvent( parentId == $stat.resourceId )
+	then
+		System.out.println ("RULE 5  \"CHANGE STATUS\" FIRED           : Change status from resource " + $stChEv.getParentId() + " from " + $stChEv.getParamOldValue() + " to " + $stChEv.getParamNewValue() + " (" + Tools.formattedDate($stChEv.getEndTime()) +")");
+		$stat.switchCurrentValue($stChEv.getParamOldValue(), $stChEv.getParamNewValue(), $stChEv.getEndTime());
+		update ($stat);
+		retract ($stChEv);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_AccumulateEvent.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_AccumulateEvent.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_AccumulateEvent.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,190 @@
+package org.drools;
+
+import org.drools.integrationtests.eventgenerator.example.*;
+import org.apache.log4j.Logger;
+
+declare PersonEvent {
+    role event,
+    clock_strategy pseudo
+}
+
+declare CheeseEvent {
+    role event,
+    clock_strategy pseudo
+}
+
+//global java.util.List results;
+global org.apache.log4j.Logger logger;
+
+/*rule "TimeWindowAggregation (regular)" salience 100
+    when
+        $person      : PersonEvent( $likes : likes )
+        $totalAmount : Number( ) from timewindow( $cheese : CheeseEvent ( type == $likes ),
+    											  3600000,
+                                                  init( int total = 0; ),
+   	                                          	  action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+    	String currentTime = ((TemporalSession)drools.getWorkingMemory()).getSessionClock().toString();
+        logger.warn ("\nRULE 1: TimeWindowAggregation (regular) @ "+currentTime);
+        logger.warn($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        #results.add($totalAmount);
+end*/
+
+rule "TimeWindowAggregation (with rightInput adapter node)" salience 90
+    when
+        $person      : PersonEvent( $likes : likes )
+        $totalAmount : Number( ) from timewindow( $cheese : CheeseEvent ( type == $likes ) and PersonEvent( name == $person.name ),
+    											  3600000,
+                                                  //sum ($cheese.getPrice() ) );
+                                                  init( int total = 0; ),
+   	                                          	  action( total += $cheese.getPrice(); ),
+   	                                          	  reverse( total -= $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        String currentTime = ((TemporalSession)drools.getWorkingMemory()).getSessionClock().toString();
+        logger.warn ("\nRULE 2 : TimeWindowAggregation (with rightInput adapter node) @ "+ currentTime);
+        logger.warn($person.getName() +" (who likes " + $person.getLikes() + ") will spend US$ "+ $totalAmount + " buying cheese");
+        #results.add($totalAmount);
+end
+
+/*rule "TimeWindowAggregation (with rightInput adapter node and initial fact)" salience 80
+    when
+        $totalAmount : Number( ) from timewindow( PersonEvent( $likes : likes ) and $cheese : CheeseEvent ( type == $likes ),
+    											  3600000,
+                                                  init( int total = 0; ),
+   	                                          	  action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        String currentTime = ((TemporalSession)drools.getWorkingMemory()).getSessionClock().toString();
+        logger.warn ("\nRULE 3 : TimeWindowAggregation (with rightInput adapter node and initial fact) @ "+ currentTime);
+        logger.warn("Customers who found their favourite cheese will spend US$ "+ $totalAmount + " buying cheese");
+        #results.add($totalAmount);
+end*/
+
+/*rule "TimeWindowAggregation (regular, but nested)" salience 70
+	when
+
+	then
+		String currentTime = ((TemporalSession)drools.getWorkingMemory()).getSessionClock().toString();
+		logger.warn ("\nRULE 4 : TimeWindowAggregation (regular, but nested) @ " + currentTime);
+        logger.warn("Customers who found their favourite cheese will spend US$ "+ $totalAmount + " buying cheese");
+        #results.add($totalAmount);
+end*/
+
+
+
+
+
+
+
+/*rule "AccumulateTest" salience 100
+    when
+    	$totalAmount : Number() from accumulate( $cheese : Cheese( ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        logger.warn("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end */
+
+/*rule "Accumulate with Bindings" salience 90
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Number() from accumulate( $cheese : Cheese( type == $likes ),
+                                                  init( int total = 0; ),
+   	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        logger.warn($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end */
+
+/*rule "Accumulate with Bindings" salience 90
+    when
+        $person      : PersonEvent( $likes : likes )
+    	$totalAmount : Number( ) from accumulate( $cheese : CheeseEvent ( type == $likes ) and PersonEvent(name == "Bob"),
+                                                  init( int total = 0; ),
+   	                                          	  action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        logger.warn($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end*/
+
+/*$list : ArrayList() from collect ( Number( intValue > 0 ) 
+    								from accumulate( PersonEvent( $likes : likes ) and $cheese : CheeseEvent ( type == $likes ),
+                                    	              init( int total = 0; ),
+   	                                    	      	  action( total += $cheese.getPrice(); ),
+                                            	      result( new Integer( total ) ) )
+                                         )
+*/                                         
+
+/*
+rule "Accumulate with Bindings" salience 90
+    when
+        $totalAmount : Number( intValue > 0 ) 
+    								from accumulate( PersonEvent( $likes : likes ) and $cheese : CheeseEvent ( type == $likes ),
+                                    	              init( int total = 0; ),
+   	                                    	      	  action( total += $cheese.getPrice(); ),
+                                            	      result( new Integer( total ) ) )
+        
+    then
+        logger.warn("Customers who found their favourite cheese will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end
+*/
+
+/*rule "Constraints everywhere" salience 80
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 100 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        logger.warn($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add(new Integer($cheesery.getTotalAmount()));
+end */
+
+/*rule "Constraints everywhere" salience 80
+    when
+    	$randomInt   : Frame()
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( status == $randomInt.state , totalAmount > 100 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, price > 0 ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        logger.warn($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add(new Integer($cheesery.getTotalAmount()));
+end  */
+
+/*
+rule "Source pattern binds" salience 70
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Number() from accumulate( $cheese : Cheese( type == $likes, $price: price ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        logger.warn($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end
+
+rule "Accumulate with previous Bindings" salience 60
+    when
+        $person      : Person( name == "Bob", $likes : likes, $age : age )
+    	$totalAmount : Number() from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                  init( int total = $age * 10; ),
+   	                                              action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+    	logger.warn($person.getName() +"(" + $person.getAge()+") who likes " + $person.getLikes() + " will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end  
+*/

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_eventGenerator.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_eventGenerator.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/eventgenerator/test_eventGenerator.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package test;
+
+import org.drools.integrationtests.eventgenerator.*;
+
+query "all inserted events"
+	Event()
+end
+
+query "all inserted events with generation time < 1 min"
+	Event(eval(endTime<PseudoSessionClock.timeInMinutes(1)))
+end
+
+query "all inserted events with 2 min < generation time < 3 min"
+	Event(eval (endTime>PseudoSessionClock.timeInMinutes(2)), eval(endTime<PseudoSessionClock.timeInMinutes(3)))
+end
+
+query "all inserted events with parent resource A"
+	Event(parentId=="resA")
+end
+
+query "all inserted events with parent resource B"
+	Event(parentId=="resB")
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/exists_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/exists_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/exists_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "42. exists rule test"
+    when       
+        exists Cheese( price == 5 )
+    then
+		list.add( new Integer( 5 ) );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/globals_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/globals_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/globals_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list
+global java.lang.String string
+
+
+rule "global rule test"
+    when
+        Cheese( $type : type ->  ( $type.equals( string ) ), type == ( string ), type == string )
+        eval( string.equals( "stilton" ) )
+        eval( $type.equals( string ) )
+    then
+		list.add( new Integer(5) );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/insurance_pricing_example.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/insurance_pricing_example.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/insurance_pricing_example.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,177 @@
+package org.acme.insurance;
+#generated from Decision Table
+#From row number: 10
+/*rule "Pricing bracket_10"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "LOW", priorClaims == "1")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(450);
+end
+
+#From row number: 11
+rule "Pricing bracket_11"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "MED")
+		policy: Policy(type == "FIRE_THEFT")
+	then
+		policy.setBasePrice(200);
+		// System.out.println("Priors not relevant");
+end
+
+#From row number: 12
+rule "Pricing bracket_12"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "MED", priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(300);
+end
+
+#From row number: 13
+rule "Pricing bracket_13"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "LOW")
+		policy: Policy(type == "FIRE_THEFT")
+	then
+		policy.setBasePrice(150);
+end
+
+#From row number: 14
+rule "Pricing bracket_14"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "LOW", priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(150);
+		// System.out.println("Safe driver discount");
+end
+
+#From row number: 15
+rule "Pricing bracket_15"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "MED", priorClaims == "1")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(700);
+end
+
+#From row number: 16
+rule "Pricing bracket_16"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "HIGH", priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(700);
+		// System.out.println("Location risk");
+end
+
+#From row number: 17
+rule "Pricing bracket_17"
+	
+	when
+		Driver(age >= 18, age <= 24, locationRiskProfile == "HIGH")
+		policy: Policy(type == "FIRE_THEFT")
+	then
+		policy.setBasePrice(550);
+		// System.out.println("Location risk");
+end
+*/
+#From row number: 18
+rule "Pricing bracket_18"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(120);
+		// System.out.println("Cheapest possible");
+end
+/*
+#From row number: 19
+rule "Pricing bracket_19"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "1")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(300);
+end
+
+#From row number: 20
+rule "Pricing bracket_20"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "2")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.setBasePrice(590);
+end
+
+#From row number: 21
+rule "Pricing bracket_21"
+	
+	when
+		Driver(age >= 25, age <= 35, priorClaims == "3")
+		policy: Policy(type == "THIRD_PARTY")
+	then
+		policy.setBasePrice(800);
+		// System.out.println("High risk");
+end
+
+#From row number: 30
+rule "Discounts_30"
+	
+	when
+		Driver(age >= 18, age <= 24, priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.applyDiscount(1);
+end
+
+#From row number: 31
+rule "Discounts_31"
+	
+	when
+		Driver(age >= 18, age <= 24, priorClaims == "0")
+		policy: Policy(type == "FIRE_THEFT")
+	then
+		policy.applyDiscount(2);
+end
+*/
+#From row number: 32
+rule "Discounts_32"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "1")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.applyDiscount(5);
+end
+
+#From row number: 33
+rule "Discounts_33"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "2")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.applyDiscount(1);
+end
+
+#From row number: 34
+rule "Discounts_34"
+	
+	when
+		Driver(age >= 25, age <= 30, priorClaims == "0")
+		policy: Policy(type == "COMPREHENSIVE")
+	then
+		policy.applyDiscount(20);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/invalid_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/invalid_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/invalid_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+#error 1) missing a person import
+
+
+global java.util.List list;
+
+rule "not rule test"
+    when
+    	#error 2) incorrect field
+        $person : Person( $likes:likeypooh )
+        not Cheese( type == $likes )
+    then
+		list.add( $person );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule simple
+    when
+        Cheese( )
+    then
+
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery
+
+global java.util.List list;
+global Cheesery cheesery;
+
+rule "literal test rule"
+    when
+        Cheese( $x: type == "stilton" )
+    then
+		list.add( $x );        
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_with_boolean.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_with_boolean.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/literal_with_boolean.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+#created on: 27-Mar-2006
+package org.drools.test
+
+import org.drools.*
+
+global java.util.List list;
+
+rule "Literal with boolean"
+	
+	when
+		#conditions
+		alivePerson : PersonInterface(alive ==  true)
+	then 		
+		list.add( alivePerson );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/multiple_rules_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/multiple_rules_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/multiple_rules_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule simple rule
+    when
+        Cheese( )
+    then
+
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.integrationtests;
+
+#list any import classes here.
+import org.drools.FirstClass;
+import org.drools.FirstClass.AlternativeKey;
+
+
+#declare any global variables here
+
+rule "First Class"
+	
+	when
+		FirstClass()
+		FirstClass.AlternativeKey()
+	then 
+		System.out.println("First class!");
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.integrationtests
+
+#list any import classes here.
+import org.drools.SecondClass;
+import org.drools.SecondClass.AlternativeKey;
+
+
+#declare any global variables here
+
+rule "Second Class"
+	
+	when
+		SecondClass()
+		SecondClass.AlternativeKey()
+	then 
+		System.out.println("Second class!");
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested_fields.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested_fields.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/nested_fields.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools;
+
+dialect "mvel"
+
+
+import org.drools.Person
+import org.drools.Address
+
+
+
+rule "test something"
+	
+	when
+		p: Person( name=="Michael", 
+								(addresses[1].street == "Low" && 
+								addresses[0].street == "High"  )
+								)
+	then
+		p.name = "goober";
+		System.out.println(p.name);	
+		insert(new Address("Latona"));	
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/no-loop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/no-loop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/no-loop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list
+
+rule "Do  not loop  forever"
+	no-loop true
+    when
+    	cheese : Cheese( )
+    then     
+    	list.add( cheese );
+    	if ( list.size() > 2 ) {
+    	    throw new Exception( "this should not loop" );
+    	}
+		update( cheese );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "not rule test"
+	salience 10
+    when       
+        not Cheese( price == 5 )
+    then
+		list.add( new Integer( 5 ) );
+end    
+
+rule "not rule with bound variable"
+    when
+        not Cheese( $price:price -> ( $price == 5 ) )
+    then
+		list.add( new Integer( 6 ) );
+end
+
+rule "not rule with other patterns 1"
+    when
+        Cheese( $type : type == "cheddar" )
+        not Cheese( price == 5 )
+    then
+		list.add( new Integer( 7 ) );
+end
+
+rule "not rule with other patterns 2"
+    when
+        not Cheese( price == 5 )
+        Cheese( $type : type == "cheddar" )
+    then
+		list.add( new Integer( 8 ) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_with_bindings_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_with_bindings_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/not_with_bindings_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+#this was missing Person
+import org.drools.Person;
+
+global java.util.List list;
+
+rule "not rule test"
+    when
+    	#and it had like instead of likes
+        $person : Person( $likes:likes )
+        not Cheese( type == $likes )
+    then
+		list.add( $person );
+end    
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_behaviour.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_behaviour.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_behaviour.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+rule "pair with same name (or null name)"
+  when
+    p1 : Person($name : name)
+    p2 : Person(name == $name)
+  then
+    //System.out.println("Persons detected: ");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_constraint.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_constraint.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/null_constraint.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test
+
+import org.drools.Person
+import org.drools.Primitives
+
+global java.util.List messages
+
+rule "person with a null name"
+  when
+    Person(name == null)
+  then
+    messages.add("Null name found");
+end
+
+rule "Raises NPE" salience -10
+  when
+    Primitives(arrayAttribute == null)
+  then
+    messages.add("Null array found");
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/or_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/or_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/or_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "literal test rule"
+    when
+        Cheese(type == "stilton" ) || Cheese(type == "cheddar")
+    then
+		list.add("got cheese");
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_as_first_pattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_as_first_pattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_as_first_pattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package SamplePackage
+ 
+import org.drools.Cheese
+
+rule "Using Predicate as first pattern"
+  when
+    cheese: Cheese( type == "Mussarela", $price:price -> ( $price < 30 ))
+  then
+    cheese.setPrice(40);
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/predicate_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+global java.util.List list;
+global java.lang.Integer two;
+
+rule "predicate rule test"
+    when
+        $person1 : Person( $age1 : age )
+        // We have no autoboxing of primtives, so have to do by hand
+        person2 : Person( $age2:age -> ( $age2 == ( $age1 + two.intValue() ) ) )
+    then
+		list.add( $person1 );
+		list.add( person2 );		
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/returnvalue_rule_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/returnvalue_rule_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/returnvalue_rule_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+global java.util.List list;
+global java.lang.Integer two;
+
+rule "returnvalue rule test"
+    when
+        $person1:Person( $age1 : age )
+        // We have no autoboxing of primtives, so have to do by hand
+        person2:Person( age == ( $age1 + two.intValue() ) )
+    then
+		list.add( $person1 );
+		list.add( person2 );		
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package test
+
+#must be in the following order.
+import org.drools.Person
+import org.drools.Cheese
+
+#refer to test_expander.dsl
+expander test_expander.dsl
+
+global java.util.List messages;
+
+
+
+
+rule "my rule"
+	when
+		#Person(name=="Bob", likes=="stilton")
+		#Cheese(type=="stilton")
+		There is a person with the name of Bob who likes "http://foo.bar"
+		There is some stilton cheese available
+		
+	then
+		Add the message "We have a winner"
+		#messages.add("We have a winner");
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl_more.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl_more.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/rule_with_expander_dsl_more.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package test
+
+#must be in the following order.
+import org.drools.Person
+import org.drools.Cheese
+
+#refer to test_expander.dsl
+expander test_expander.dsl
+
+global java.util.List messages;
+
+
+
+
+rule "my rule"
+	when
+		#both of these should stop it from firing
+		person with eval		
+		>cheese : Cheese() eval(cheese.getType().equals( "brie" ) )
+	then
+		>messages.add("fired");
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+package com.sample
+ 
+import java.util.List;
+
+global List list
+
+rule "Rule1" ruleflow-group "flowgroup-1"
+	when
+		eval(true)
+	then
+		list.add("Rule1");
+end
+
+rule "Rule2" ruleflow-group "flowgroup-2"
+	when
+		eval(true)
+	then
+		list.add("Rule2");
+end
+
+rule "Rule3" ruleflow-group "flowgroup-3" salience 10
+	when
+		eval(true)
+	then
+		list.add("Rule3");
+end
+
+rule "Rule4" ruleflow-group "flowgroup-4" salience 20
+	when
+		eval(true)
+	then
+		list.add("Rule4");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,540 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>4-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>462</x>
+                  <y>103</y>
+                  <width>56</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.workflow.core.node.EndNode" id="5">
+                  <id>4</id>
+                  <name>End</name>
+                  <incomingConnections id="6">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="7">
+                        <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                          <from class="org.drools.workflow.core.node.RuleSetNode" id="9">
+                            <ruleFlowGroup>flowgroup-4</ruleFlowGroup>
+                            <id>9</id>
+                            <name>RuleSet4</name>
+                            <incomingConnections id="10">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="11">
+                                  <org.drools.workflow.core.impl.ConnectionImpl id="12">
+                                    <from class="org.drools.workflow.core.node.Join" id="13">
+                                      <type>1</type>
+                                      <id>6</id>
+                                      <name>Join</name>
+                                      <incomingConnections id="14">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="15">
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="16">
+                                              <from class="org.drools.workflow.core.node.RuleSetNode" id="17">
+                                                <ruleFlowGroup>flowgroup-2</ruleFlowGroup>
+                                                <id>10</id>
+                                                <name>RuleSet2</name>
+                                                <incomingConnections id="18">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="19">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl id="20">
+                                                        <from class="org.drools.workflow.core.node.Split" id="21">
+                                                          <type>1</type>
+                                                          <constraints id="22"/>
+                                                          <id>5</id>
+                                                          <name>Split</name>
+                                                          <incomingConnections id="23">
+                                                            <entry>
+                                                              <string>DROOLS_DEFAULT</string>
+                                                              <list id="24">
+                                                                <org.drools.workflow.core.impl.ConnectionImpl id="25">
+                                                                  <from class="org.drools.workflow.core.node.RuleSetNode" id="26">
+                                                                    <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+                                                                    <id>2</id>
+                                                                    <name>RuleSet1</name>
+                                                                    <incomingConnections id="27">
+                                                                      <entry>
+                                                                        <string>DROOLS_DEFAULT</string>
+                                                                        <list id="28">
+                                                                          <org.drools.workflow.core.impl.ConnectionImpl id="29">
+                                                                            <from class="org.drools.workflow.core.node.StartNode" id="30">
+                                                                              <id>1</id>
+                                                                              <name>Start</name>
+                                                                              <incomingConnections id="31"/>
+                                                                              <outgoingConnections id="32">
+                                                                                <entry>
+                                                                                  <string>DROOLS_DEFAULT</string>
+                                                                                  <list id="33">
+                                                                                    <org.drools.workflow.core.impl.ConnectionImpl reference="29"/>
+                                                                                  </list>
+                                                                                </entry>
+                                                                              </outgoingConnections>
+                                                                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="34">
+                                                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="35">
+                                                                                  <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                                                                  <nodes id="36">
+                                                                                    <entry>
+                                                                                      <long>1</long>
+                                                                                      <org.drools.workflow.core.node.StartNode reference="30"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>2</long>
+                                                                                      <org.drools.workflow.core.node.RuleSetNode reference="26"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>4</long>
+                                                                                      <org.drools.workflow.core.node.EndNode reference="5"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>5</long>
+                                                                                      <org.drools.workflow.core.node.Split reference="21"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>6</long>
+                                                                                      <org.drools.workflow.core.node.Join reference="13"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>9</long>
+                                                                                      <org.drools.workflow.core.node.RuleSetNode reference="9"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>10</long>
+                                                                                      <org.drools.workflow.core.node.RuleSetNode reference="17"/>
+                                                                                    </entry>
+                                                                                    <entry>
+                                                                                      <long>11</long>
+                                                                                      <org.drools.workflow.core.node.RuleSetNode id="37">
+                                                                                        <ruleFlowGroup>flowgroup-3</ruleFlowGroup>
+                                                                                        <id>11</id>
+                                                                                        <name>RuleSet3</name>
+                                                                                        <incomingConnections id="38">
+                                                                                          <entry>
+                                                                                            <string>DROOLS_DEFAULT</string>
+                                                                                            <list id="39">
+                                                                                              <org.drools.workflow.core.impl.ConnectionImpl id="40">
+                                                                                                <from class="org.drools.workflow.core.node.Split" reference="21"/>
+                                                                                                <to class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
+                                                                                                <fromType>DROOLS_DEFAULT</fromType>
+                                                                                                <toType>DROOLS_DEFAULT</toType>
+                                                                                              </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                                            </list>
+                                                                                          </entry>
+                                                                                        </incomingConnections>
+                                                                                        <outgoingConnections id="41">
+                                                                                          <entry>
+                                                                                            <string>DROOLS_DEFAULT</string>
+                                                                                            <list id="42">
+                                                                                              <org.drools.workflow.core.impl.ConnectionImpl id="43">
+                                                                                                <from class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
+                                                                                                <to class="org.drools.workflow.core.node.Join" reference="13"/>
+                                                                                                <fromType>DROOLS_DEFAULT</fromType>
+                                                                                                <toType>DROOLS_DEFAULT</toType>
+                                                                                              </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                                            </list>
+                                                                                          </entry>
+                                                                                        </outgoingConnections>
+                                                                                        <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                                                                      </org.drools.workflow.core.node.RuleSetNode>
+                                                                                    </entry>
+                                                                                  </nodes>
+                                                                                  <lastNodeId>11</lastNodeId>
+                                                                                </nodeContainer>
+                                                                                <id>0</id>
+                                                                                <name>ruleflow</name>
+                                                                                <version>1</version>
+                                                                                <type>RuleFlow</type>
+                                                                                <packageName>com.sample</packageName>
+                                                                                <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="44">
+                                                                                  <variables id="45"/>
+                                                                                </variableScope>
+                                                                              </nodeContainer>
+                                                                            </from>
+                                                                            <to class="org.drools.workflow.core.node.RuleSetNode" reference="26"/>
+                                                                            <fromType>DROOLS_DEFAULT</fromType>
+                                                                            <toType>DROOLS_DEFAULT</toType>
+                                                                          </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                        </list>
+                                                                      </entry>
+                                                                    </incomingConnections>
+                                                                    <outgoingConnections id="46">
+                                                                      <entry>
+                                                                        <string>DROOLS_DEFAULT</string>
+                                                                        <list id="47">
+                                                                          <org.drools.workflow.core.impl.ConnectionImpl reference="25"/>
+                                                                        </list>
+                                                                      </entry>
+                                                                    </outgoingConnections>
+                                                                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                                                  </from>
+                                                                  <to class="org.drools.workflow.core.node.Split" reference="21"/>
+                                                                  <fromType>DROOLS_DEFAULT</fromType>
+                                                                  <toType>DROOLS_DEFAULT</toType>
+                                                                </org.drools.workflow.core.impl.ConnectionImpl>
+                                                              </list>
+                                                            </entry>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="48">
+                                                            <entry>
+                                                              <string>DROOLS_DEFAULT</string>
+                                                              <list id="49">
+                                                                <org.drools.workflow.core.impl.ConnectionImpl reference="20"/>
+                                                                <org.drools.workflow.core.impl.ConnectionImpl reference="40"/>
+                                                              </list>
+                                                            </entry>
+                                                          </outgoingConnections>
+                                                          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                                        </from>
+                                                        <to class="org.drools.workflow.core.node.RuleSetNode" reference="17"/>
+                                                        <fromType>DROOLS_DEFAULT</fromType>
+                                                        <toType>DROOLS_DEFAULT</toType>
+                                                      </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="50">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="51">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl reference="16"/>
+                                                    </list>
+                                                  </entry>
+                                                </outgoingConnections>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                              </from>
+                                              <to class="org.drools.workflow.core.node.Join" reference="13"/>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                            <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
+                                          </list>
+                                        </entry>
+                                      </incomingConnections>
+                                      <outgoingConnections id="52">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="53">
+                                            <org.drools.workflow.core.impl.ConnectionImpl reference="12"/>
+                                          </list>
+                                        </entry>
+                                      </outgoingConnections>
+                                      <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                                    </from>
+                                    <to class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
+                                    <fromType>DROOLS_DEFAULT</fromType>
+                                    <toType>DROOLS_DEFAULT</toType>
+                                  </org.drools.workflow.core.impl.ConnectionImpl>
+                                </list>
+                              </entry>
+                            </incomingConnections>
+                            <outgoingConnections id="54">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="55">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                          </from>
+                          <to class="org.drools.workflow.core.node.EndNode" reference="5"/>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                      </list>
+                    </entry>
+                  </incomingConnections>
+                  <outgoingConnections id="56"/>
+                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+                </element>
+                <incomingConnections id="57">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="58" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="59"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="60" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="61">
+                                <x>366</x>
+                                <y>103</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
+                              <incomingConnections id="62">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="63" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <bendpoints id="64"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" id="65" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="66">
+                                              <x>309</x>
+                                              <y>104</y>
+                                              <width>40</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.workflow.core.node.Join" reference="13"/>
+                                            <incomingConnections id="67">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="68" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <bendpoints id="69"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="70" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="71">
+                                                            <x>218</x>
+                                                            <y>46</y>
+                                                            <width>80</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.workflow.core.node.RuleSetNode" reference="17"/>
+                                                          <incomingConnections id="72">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="73" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <bendpoints id="74"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" id="75" serialization="custom">
+                                                                    <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                      <default>
+                                                                        <constraint id="76">
+                                                                          <x>166</x>
+                                                                          <y>104</y>
+                                                                          <width>38</width>
+                                                                          <height>40</height>
+                                                                        </constraint>
+                                                                        <element class="org.drools.workflow.core.node.Split" reference="21"/>
+                                                                        <incomingConnections id="77">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="78" serialization="custom">
+                                                                            <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                              <default>
+                                                                                <bendpoints id="79"/>
+                                                                                <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="80" serialization="custom">
+                                                                                  <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                    <default>
+                                                                                      <constraint id="81">
+                                                                                        <x>86</x>
+                                                                                        <y>104</y>
+                                                                                        <width>63</width>
+                                                                                        <height>40</height>
+                                                                                      </constraint>
+                                                                                      <element class="org.drools.workflow.core.node.RuleSetNode" reference="26"/>
+                                                                                      <incomingConnections id="82">
+                                                                                        <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="83" serialization="custom">
+                                                                                          <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                                            <default>
+                                                                                              <bendpoints id="84"/>
+                                                                                              <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="85" serialization="custom">
+                                                                                                <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                                  <default>
+                                                                                                    <constraint id="86">
+                                                                                                      <x>13</x>
+                                                                                                      <y>104</y>
+                                                                                                      <width>59</width>
+                                                                                                      <height>40</height>
+                                                                                                    </constraint>
+                                                                                                    <element class="org.drools.workflow.core.node.StartNode" reference="30"/>
+                                                                                                    <incomingConnections id="87"/>
+                                                                                                    <outgoingConnections id="88">
+                                                                                                      <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="83"/>
+                                                                                                    </outgoingConnections>
+                                                                                                  </default>
+                                                                                                </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                              </source>
+                                                                                              <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="80"/>
+                                                                                            </default>
+                                                                                          </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                            <default>
+                                                                                              <connection reference="29"/>
+                                                                                            </default>
+                                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                        </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                      </incomingConnections>
+                                                                                      <outgoingConnections id="89">
+                                                                                        <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="78"/>
+                                                                                      </outgoingConnections>
+                                                                                      <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                                    </default>
+                                                                                  </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                </source>
+                                                                                <target class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="75"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                              <default>
+                                                                                <connection reference="25"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                        </incomingConnections>
+                                                                        <outgoingConnections id="90">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="73"/>
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="91" serialization="custom">
+                                                                            <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                              <default>
+                                                                                <bendpoints id="92"/>
+                                                                                <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="75"/>
+                                                                                <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="93" serialization="custom">
+                                                                                  <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                    <default>
+                                                                                      <constraint id="94">
+                                                                                        <x>221</x>
+                                                                                        <y>158</y>
+                                                                                        <width>80</width>
+                                                                                        <height>40</height>
+                                                                                      </constraint>
+                                                                                      <element class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
+                                                                                      <incomingConnections id="95">
+                                                                                        <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="91"/>
+                                                                                      </incomingConnections>
+                                                                                      <outgoingConnections id="96">
+                                                                                        <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="97" serialization="custom">
+                                                                                          <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                                            <default>
+                                                                                              <bendpoints id="98"/>
+                                                                                              <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="93"/>
+                                                                                              <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="65"/>
+                                                                                            </default>
+                                                                                          </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                            <default>
+                                                                                              <connection reference="43"/>
+                                                                                            </default>
+                                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                        </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                                      </outgoingConnections>
+                                                                                      <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                                    </default>
+                                                                                  </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                                </target>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                              <default>
+                                                                                <connection reference="40"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                        </outgoingConnections>
+                                                                        <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                    <org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+                                                                      <default/>
+                                                                    </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+                                                                  </source>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="70"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection reference="20"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="99">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="68"/>
+                                                          </outgoingConnections>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                    </source>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="65"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection reference="16"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="97"/>
+                                            </incomingConnections>
+                                            <outgoingConnections id="100">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="63"/>
+                                            </outgoingConnections>
+                                            <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </source>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="60"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection reference="12"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </incomingConnections>
+                              <outgoingConnections id="101">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="58"/>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="8"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="102"/>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
+        </entry>
+        <entry>
+          <string>9-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="60"/>
+        </entry>
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="80"/>
+        </entry>
+        <entry>
+          <string>11-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="93"/>
+        </entry>
+        <entry>
+          <string>10-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="70"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="85"/>
+        </entry>
+        <entry>
+          <string>6-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.JoinWrapper reference="65"/>
+        </entry>
+        <entry>
+          <string>5-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.SplitWrapper reference="75"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,243 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.RuleSetNode" id="9">
+                    <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+                    <id>2</id>
+                    <name>RuleSet1</name>
+                    <incomingConnections id="10">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="11">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="12">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="13">
+                          <org.drools.workflow.core.impl.ConnectionImpl id="14">
+                            <from class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
+                            <to class="org.drools.workflow.core.node.Split" id="15">
+                              <type>1</type>
+                              <constraints id="16"/>
+                              <id>5</id>
+                              <name>Split</name>
+                              <incomingConnections id="17">
+                                <entry>
+                                  <string>DROOLS_DEFAULT</string>
+                                  <list id="18">
+                                    <org.drools.workflow.core.impl.ConnectionImpl reference="14"/>
+                                  </list>
+                                </entry>
+                              </incomingConnections>
+                              <outgoingConnections id="19">
+                                <entry>
+                                  <string>DROOLS_DEFAULT</string>
+                                  <list id="20">
+                                    <org.drools.workflow.core.impl.ConnectionImpl id="21">
+                                      <from class="org.drools.workflow.core.node.Split" reference="15"/>
+                                      <to class="org.drools.workflow.core.node.RuleSetNode" id="22">
+                                        <ruleFlowGroup>flowgroup-2</ruleFlowGroup>
+                                        <id>10</id>
+                                        <name>RuleSet2</name>
+                                        <incomingConnections id="23">
+                                          <entry>
+                                            <string>DROOLS_DEFAULT</string>
+                                            <list id="24">
+                                              <org.drools.workflow.core.impl.ConnectionImpl reference="21"/>
+                                            </list>
+                                          </entry>
+                                        </incomingConnections>
+                                        <outgoingConnections id="25">
+                                          <entry>
+                                            <string>DROOLS_DEFAULT</string>
+                                            <list id="26">
+                                              <org.drools.workflow.core.impl.ConnectionImpl id="27">
+                                                <from class="org.drools.workflow.core.node.RuleSetNode" reference="22"/>
+                                                <to class="org.drools.workflow.core.node.Join" id="28">
+                                                  <type>1</type>
+                                                  <id>6</id>
+                                                  <name>Join</name>
+                                                  <incomingConnections id="29">
+                                                    <entry>
+                                                      <string>DROOLS_DEFAULT</string>
+                                                      <list id="30">
+                                                        <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
+                                                        <org.drools.workflow.core.impl.ConnectionImpl id="31">
+                                                          <from class="org.drools.workflow.core.node.RuleSetNode" id="32">
+                                                            <ruleFlowGroup>flowgroup-3</ruleFlowGroup>
+                                                            <id>11</id>
+                                                            <name>RuleSet3</name>
+                                                            <incomingConnections id="33">
+                                                              <entry>
+                                                                <string>DROOLS_DEFAULT</string>
+                                                                <list id="34">
+                                                                  <org.drools.workflow.core.impl.ConnectionImpl id="35">
+                                                                    <from class="org.drools.workflow.core.node.Split" reference="15"/>
+                                                                    <to class="org.drools.workflow.core.node.RuleSetNode" reference="32"/>
+                                                                    <fromType>DROOLS_DEFAULT</fromType>
+                                                                    <toType>DROOLS_DEFAULT</toType>
+                                                                  </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                </list>
+                                                              </entry>
+                                                            </incomingConnections>
+                                                            <outgoingConnections id="36">
+                                                              <entry>
+                                                                <string>DROOLS_DEFAULT</string>
+                                                                <list id="37">
+                                                                  <org.drools.workflow.core.impl.ConnectionImpl reference="31"/>
+                                                                </list>
+                                                              </entry>
+                                                            </outgoingConnections>
+                                                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                                          </from>
+                                                          <to class="org.drools.workflow.core.node.Join" reference="28"/>
+                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                          <toType>DROOLS_DEFAULT</toType>
+                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                      </list>
+                                                    </entry>
+                                                  </incomingConnections>
+                                                  <outgoingConnections id="38">
+                                                    <entry>
+                                                      <string>DROOLS_DEFAULT</string>
+                                                      <list id="39">
+                                                        <org.drools.workflow.core.impl.ConnectionImpl id="40">
+                                                          <from class="org.drools.workflow.core.node.Join" reference="28"/>
+                                                          <to class="org.drools.workflow.core.node.RuleSetNode" id="41">
+                                                            <ruleFlowGroup>flowgroup-4</ruleFlowGroup>
+                                                            <id>9</id>
+                                                            <name>RuleSet4</name>
+                                                            <incomingConnections id="42">
+                                                              <entry>
+                                                                <string>DROOLS_DEFAULT</string>
+                                                                <list id="43">
+                                                                  <org.drools.workflow.core.impl.ConnectionImpl reference="40"/>
+                                                                </list>
+                                                              </entry>
+                                                            </incomingConnections>
+                                                            <outgoingConnections id="44">
+                                                              <entry>
+                                                                <string>DROOLS_DEFAULT</string>
+                                                                <list id="45">
+                                                                  <org.drools.workflow.core.impl.ConnectionImpl id="46">
+                                                                    <from class="org.drools.workflow.core.node.RuleSetNode" reference="41"/>
+                                                                    <to class="org.drools.workflow.core.node.EndNode" id="47">
+                                                                      <id>4</id>
+                                                                      <name>End</name>
+                                                                      <incomingConnections id="48">
+                                                                        <entry>
+                                                                          <string>DROOLS_DEFAULT</string>
+                                                                          <list id="49">
+                                                                            <org.drools.workflow.core.impl.ConnectionImpl reference="46"/>
+                                                                          </list>
+                                                                        </entry>
+                                                                      </incomingConnections>
+                                                                      <outgoingConnections id="50"/>
+                                                                      <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                                                    </to>
+                                                                    <fromType>DROOLS_DEFAULT</fromType>
+                                                                    <toType>DROOLS_DEFAULT</toType>
+                                                                  </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                </list>
+                                                              </entry>
+                                                            </outgoingConnections>
+                                                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                                          </to>
+                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                          <toType>DROOLS_DEFAULT</toType>
+                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                      </list>
+                                                    </entry>
+                                                  </outgoingConnections>
+                                                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                                </to>
+                                                <fromType>DROOLS_DEFAULT</fromType>
+                                                <toType>DROOLS_DEFAULT</toType>
+                                              </org.drools.workflow.core.impl.ConnectionImpl>
+                                            </list>
+                                          </entry>
+                                        </outgoingConnections>
+                                        <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                      </to>
+                                      <fromType>DROOLS_DEFAULT</fromType>
+                                      <toType>DROOLS_DEFAULT</toType>
+                                    </org.drools.workflow.core.impl.ConnectionImpl>
+                                    <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
+                                  </list>
+                                </entry>
+                              </outgoingConnections>
+                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                            </to>
+                            <fromType>DROOLS_DEFAULT</fromType>
+                            <toType>DROOLS_DEFAULT</toType>
+                          </org.drools.workflow.core.impl.ConnectionImpl>
+                        </list>
+                      </entry>
+                    </outgoingConnections>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.RuleSetNode reference="9"/>
+      </entry>
+      <entry>
+        <long>4</long>
+        <org.drools.workflow.core.node.EndNode reference="47"/>
+      </entry>
+      <entry>
+        <long>5</long>
+        <org.drools.workflow.core.node.Split reference="15"/>
+      </entry>
+      <entry>
+        <long>6</long>
+        <org.drools.workflow.core.node.Join reference="28"/>
+      </entry>
+      <entry>
+        <long>9</long>
+        <org.drools.workflow.core.node.RuleSetNode reference="41"/>
+      </entry>
+      <entry>
+        <long>10</long>
+        <org.drools.workflow.core.node.RuleSetNode reference="22"/>
+      </entry>
+      <entry>
+        <long>11</long>
+        <org.drools.workflow.core.node.RuleSetNode reference="32"/>
+      </entry>
+    </nodes>
+    <lastNodeId>11</lastNodeId>
+  </nodeContainer>
+  <id>0</id>
+  <name>ruleflow</name>
+  <version>1</version>
+  <type>RuleFlow</type>
+  <packageName>com.sample</packageName>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="51">
+    <variables id="52"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflow_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,151 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>2</long>
+      <org.drools.ruleflow.core.impl.RuleSetNodeImpl id="3">
+        <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+        <id>2</id>
+        <name>RuleSet1</name>
+        <incomingConnections id="4">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="5">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="6">
+              <id>1</id>
+              <name>Start</name>
+              <incomingConnections id="7"/>
+              <outgoingConnections id="8">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="5"/>
+              </outgoingConnections>
+            </from>
+            <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="3"/>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </incomingConnections>
+        <outgoingConnections id="9">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="10">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="3"/>
+            <to class="org.drools.ruleflow.core.impl.SplitImpl" id="11">
+              <type>1</type>
+              <constraints id="12"/>
+              <id>5</id>
+              <name>Split</name>
+              <incomingConnections id="13">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="10"/>
+              </incomingConnections>
+              <outgoingConnections id="14">
+                <org.drools.ruleflow.core.impl.ConnectionImpl id="15">
+                  <type>1</type>
+                  <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="11"/>
+                  <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="16">
+                    <ruleFlowGroup>flowgroup-2</ruleFlowGroup>
+                    <id>3</id>
+                    <name>RuleSet2</name>
+                    <incomingConnections id="17">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+                    </incomingConnections>
+                    <outgoingConnections id="18">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl id="19">
+                        <type>1</type>
+                        <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="16"/>
+                        <to class="org.drools.ruleflow.core.impl.JoinImpl" id="20">
+                          <type>1</type>
+                          <id>6</id>
+                          <name>Join</name>
+                          <incomingConnections id="21">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl id="22">
+                              <type>1</type>
+                              <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="23">
+                                <ruleFlowGroup>flowgroup-3</ruleFlowGroup>
+                                <id>4</id>
+                                <name>RuleSet3</name>
+                                <incomingConnections id="24">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="25">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="11"/>
+                                    <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="23"/>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                </incomingConnections>
+                                <outgoingConnections id="26">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl reference="22"/>
+                                </outgoingConnections>
+                              </from>
+                              <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="20"/>
+                            </org.drools.ruleflow.core.impl.ConnectionImpl>
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="19"/>
+                          </incomingConnections>
+                          <outgoingConnections id="27">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl id="28">
+                              <type>1</type>
+                              <from class="org.drools.ruleflow.core.impl.JoinImpl" reference="20"/>
+                              <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="29">
+                                <ruleFlowGroup>flowgroup-4</ruleFlowGroup>
+                                <id>7</id>
+                                <name>RuleSet4</name>
+                                <incomingConnections id="30">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl reference="28"/>
+                                </incomingConnections>
+                                <outgoingConnections id="31">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="32">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="29"/>
+                                    <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="33">
+                                      <id>8</id>
+                                      <name>End</name>
+                                      <incomingConnections id="34">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl reference="32"/>
+                                      </incomingConnections>
+                                      <outgoingConnections id="35"/>
+                                    </to>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                </outgoingConnections>
+                              </to>
+                            </org.drools.ruleflow.core.impl.ConnectionImpl>
+                          </outgoingConnections>
+                        </to>
+                      </org.drools.ruleflow.core.impl.ConnectionImpl>
+                    </outgoingConnections>
+                  </to>
+                </org.drools.ruleflow.core.impl.ConnectionImpl>
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="25"/>
+              </outgoingConnections>
+            </to>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </outgoingConnections>
+      </org.drools.ruleflow.core.impl.RuleSetNodeImpl>
+    </entry>
+    <entry>
+      <long>4</long>
+      <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="23"/>
+    </entry>
+    <entry>
+      <long>8</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl reference="33"/>
+    </entry>
+    <entry>
+      <long>6</long>
+      <org.drools.ruleflow.core.impl.JoinImpl reference="20"/>
+    </entry>
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl reference="6"/>
+    </entry>
+    <entry>
+      <long>3</long>
+      <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="16"/>
+    </entry>
+    <entry>
+      <long>7</long>
+      <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="29"/>
+    </entry>
+    <entry>
+      <long>5</long>
+      <org.drools.ruleflow.core.impl.SplitImpl reference="11"/>
+    </entry>
+  </nodes>
+  <variables id="36"/>
+  <lastNodeId>8</lastNodeId>
+  <id>0</id>
+  <name>flow</name>
+  <type>Workflow</type>
+  <packageName>com.sample</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflowgroup.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflowgroup.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/ruleflowgroup.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package com.sample
+ 
+import java.util.List;
+
+global List list
+
+rule "Sample Rule" ruleflow-group "Group1"
+	when
+		s: String()
+	then
+		list.add(s);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfile.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfile.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfile.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3411 @@
+#created on: 27-Jun-2007
+package org.drools.test
+
+#list any import classes here.
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+
+
+rule "Cheese_1"	
+	when
+		$c : Cheese( price == 1 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_1"
+	when 
+		$p : Person(name == "p1")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_2"	
+	when
+		$c : Cheese( price == 2 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_2"
+	when 
+		$p : Person(name == "p2")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_3"	
+	when
+		$c : Cheese( price == 3 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_3"
+	when 
+		$p : Person(name == "p3")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_4"	
+	when
+		$c : Cheese( price == 4 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_4"
+	when 
+		$p : Person(name == "p4")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_5"	
+	when
+		$c : Cheese( price == 5 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_5"
+	when 
+		$p : Person(name == "p5")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_6"	
+	when
+		$c : Cheese( price == 6 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_6"
+	when 
+		$p : Person(name == "p6")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_7"	
+	when
+		$c : Cheese( price == 7 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_7"
+	when 
+		$p : Person(name == "p7")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_8"	
+	when
+		$c : Cheese( price == 8 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_8"
+	when 
+		$p : Person(name == "p8")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_9"	
+	when
+		$c : Cheese( price == 9 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_9"
+	when 
+		$p : Person(name == "p9")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_10"	
+	when
+		$c : Cheese( price == 10 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_10"
+	when 
+		$p : Person(name == "p10")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_11"	
+	when
+		$c : Cheese( price == 11 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_11"
+	when 
+		$p : Person(name == "p11")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_12"	
+	when
+		$c : Cheese( price == 12 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_12"
+	when 
+		$p : Person(name == "p12")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_13"	
+	when
+		$c : Cheese( price == 13 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_13"
+	when 
+		$p : Person(name == "p13")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_14"	
+	when
+		$c : Cheese( price == 14 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_14"
+	when 
+		$p : Person(name == "p14")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_15"	
+	when
+		$c : Cheese( price == 15 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_15"
+	when 
+		$p : Person(name == "p15")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_16"	
+	when
+		$c : Cheese( price == 16 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_16"
+	when 
+		$p : Person(name == "p16")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_17"	
+	when
+		$c : Cheese( price == 17 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_17"
+	when 
+		$p : Person(name == "p17")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_18"	
+	when
+		$c : Cheese( price == 18 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_18"
+	when 
+		$p : Person(name == "p18")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_19"	
+	when
+		$c : Cheese( price == 19 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_19"
+	when 
+		$p : Person(name == "p19")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_20"	
+	when
+		$c : Cheese( price == 20 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_20"
+	when 
+		$p : Person(name == "p20")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_21"	
+	when
+		$c : Cheese( price == 21 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_21"
+	when 
+		$p : Person(name == "p21")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_22"	
+	when
+		$c : Cheese( price == 22 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_22"
+	when 
+		$p : Person(name == "p22")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_23"	
+	when
+		$c : Cheese( price == 23 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_23"
+	when 
+		$p : Person(name == "p23")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_24"	
+	when
+		$c : Cheese( price == 24 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_24"
+	when 
+		$p : Person(name == "p24")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_25"	
+	when
+		$c : Cheese( price == 25 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_25"
+	when 
+		$p : Person(name == "p25")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_26"	
+	when
+		$c : Cheese( price == 26 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_26"
+	when 
+		$p : Person(name == "p26")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_27"	
+	when
+		$c : Cheese( price == 27 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_27"
+	when 
+		$p : Person(name == "p27")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_28"	
+	when
+		$c : Cheese( price == 28 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_28"
+	when 
+		$p : Person(name == "p28")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_29"	
+	when
+		$c : Cheese( price == 29 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_29"
+	when 
+		$p : Person(name == "p29")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_30"	
+	when
+		$c : Cheese( price == 30 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_30"
+	when 
+		$p : Person(name == "p30")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_31"	
+	when
+		$c : Cheese( price == 31 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_31"
+	when 
+		$p : Person(name == "p31")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_32"	
+	when
+		$c : Cheese( price == 32 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_32"
+	when 
+		$p : Person(name == "p32")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_33"	
+	when
+		$c : Cheese( price == 33 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_33"
+	when 
+		$p : Person(name == "p33")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_34"	
+	when
+		$c : Cheese( price == 34 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_34"
+	when 
+		$p : Person(name == "p34")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_35"	
+	when
+		$c : Cheese( price == 35 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_35"
+	when 
+		$p : Person(name == "p35")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_36"	
+	when
+		$c : Cheese( price == 36 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_36"
+	when 
+		$p : Person(name == "p36")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_37"	
+	when
+		$c : Cheese( price == 37 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_37"
+	when 
+		$p : Person(name == "p37")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_38"	
+	when
+		$c : Cheese( price == 38 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_38"
+	when 
+		$p : Person(name == "p38")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_39"	
+	when
+		$c : Cheese( price == 39 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_39"
+	when 
+		$p : Person(name == "p39")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_40"	
+	when
+		$c : Cheese( price == 40 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_40"
+	when 
+		$p : Person(name == "p40")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_41"	
+	when
+		$c : Cheese( price == 41 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_41"
+	when 
+		$p : Person(name == "p41")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_42"	
+	when
+		$c : Cheese( price == 42 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_42"
+	when 
+		$p : Person(name == "p42")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_43"	
+	when
+		$c : Cheese( price == 43 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_43"
+	when 
+		$p : Person(name == "p43")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_44"	
+	when
+		$c : Cheese( price == 44 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_44"
+	when 
+		$p : Person(name == "p44")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_45"	
+	when
+		$c : Cheese( price == 45 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_45"
+	when 
+		$p : Person(name == "p45")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_46"	
+	when
+		$c : Cheese( price == 46 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_46"
+	when 
+		$p : Person(name == "p46")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_47"	
+	when
+		$c : Cheese( price == 47 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_47"
+	when 
+		$p : Person(name == "p47")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_48"	
+	when
+		$c : Cheese( price == 48 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_48"
+	when 
+		$p : Person(name == "p48")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_49"	
+	when
+		$c : Cheese( price == 49 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_49"
+	when 
+		$p : Person(name == "p49")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_50"	
+	when
+		$c : Cheese( price == 50 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_50"
+	when 
+		$p : Person(name == "p50")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_51"	
+	when
+		$c : Cheese( price == 51 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_51"
+	when 
+		$p : Person(name == "p51")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_52"	
+	when
+		$c : Cheese( price == 52 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_52"
+	when 
+		$p : Person(name == "p52")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_53"	
+	when
+		$c : Cheese( price == 53 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_53"
+	when 
+		$p : Person(name == "p53")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_54"	
+	when
+		$c : Cheese( price == 54 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_54"
+	when 
+		$p : Person(name == "p54")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_55"	
+	when
+		$c : Cheese( price == 55 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_55"
+	when 
+		$p : Person(name == "p55")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_56"	
+	when
+		$c : Cheese( price == 56 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_56"
+	when 
+		$p : Person(name == "p56")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_57"	
+	when
+		$c : Cheese( price == 57 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_57"
+	when 
+		$p : Person(name == "p57")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_58"	
+	when
+		$c : Cheese( price == 58 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_58"
+	when 
+		$p : Person(name == "p58")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_59"	
+	when
+		$c : Cheese( price == 59 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_59"
+	when 
+		$p : Person(name == "p59")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_60"	
+	when
+		$c : Cheese( price == 60 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_60"
+	when 
+		$p : Person(name == "p60")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_61"	
+	when
+		$c : Cheese( price == 61 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_61"
+	when 
+		$p : Person(name == "p61")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_62"	
+	when
+		$c : Cheese( price == 62 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_62"
+	when 
+		$p : Person(name == "p62")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_63"	
+	when
+		$c : Cheese( price == 63 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_63"
+	when 
+		$p : Person(name == "p63")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_64"	
+	when
+		$c : Cheese( price == 64 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_64"
+	when 
+		$p : Person(name == "p64")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_65"	
+	when
+		$c : Cheese( price == 65 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_65"
+	when 
+		$p : Person(name == "p65")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_66"	
+	when
+		$c : Cheese( price == 66 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_66"
+	when 
+		$p : Person(name == "p66")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_67"	
+	when
+		$c : Cheese( price == 67 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_67"
+	when 
+		$p : Person(name == "p67")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_68"	
+	when
+		$c : Cheese( price == 68 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_68"
+	when 
+		$p : Person(name == "p68")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_69"	
+	when
+		$c : Cheese( price == 69 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_69"
+	when 
+		$p : Person(name == "p69")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_70"	
+	when
+		$c : Cheese( price == 70 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_70"
+	when 
+		$p : Person(name == "p70")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_71"	
+	when
+		$c : Cheese( price == 71 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_71"
+	when 
+		$p : Person(name == "p71")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_72"	
+	when
+		$c : Cheese( price == 72 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_72"
+	when 
+		$p : Person(name == "p72")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_73"	
+	when
+		$c : Cheese( price == 73 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_73"
+	when 
+		$p : Person(name == "p73")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_74"	
+	when
+		$c : Cheese( price == 74 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_74"
+	when 
+		$p : Person(name == "p74")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_75"	
+	when
+		$c : Cheese( price == 75 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_75"
+	when 
+		$p : Person(name == "p75")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_76"	
+	when
+		$c : Cheese( price == 76 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_76"
+	when 
+		$p : Person(name == "p76")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_77"	
+	when
+		$c : Cheese( price == 77 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_77"
+	when 
+		$p : Person(name == "p77")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_78"	
+	when
+		$c : Cheese( price == 78 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_78"
+	when 
+		$p : Person(name == "p78")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_79"	
+	when
+		$c : Cheese( price == 79 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_79"
+	when 
+		$p : Person(name == "p79")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_80"	
+	when
+		$c : Cheese( price == 80 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_80"
+	when 
+		$p : Person(name == "p80")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_81"	
+	when
+		$c : Cheese( price == 81 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_81"
+	when 
+		$p : Person(name == "p81")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_82"	
+	when
+		$c : Cheese( price == 82 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_82"
+	when 
+		$p : Person(name == "p82")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_83"	
+	when
+		$c : Cheese( price == 83 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_83"
+	when 
+		$p : Person(name == "p83")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_84"	
+	when
+		$c : Cheese( price == 84 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_84"
+	when 
+		$p : Person(name == "p84")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_85"	
+	when
+		$c : Cheese( price == 85 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_85"
+	when 
+		$p : Person(name == "p85")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_86"	
+	when
+		$c : Cheese( price == 86 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_86"
+	when 
+		$p : Person(name == "p86")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_87"	
+	when
+		$c : Cheese( price == 87 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_87"
+	when 
+		$p : Person(name == "p87")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_88"	
+	when
+		$c : Cheese( price == 88 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_88"
+	when 
+		$p : Person(name == "p88")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_89"	
+	when
+		$c : Cheese( price == 89 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_89"
+	when 
+		$p : Person(name == "p89")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_90"	
+	when
+		$c : Cheese( price == 90 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_90"
+	when 
+		$p : Person(name == "p90")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_91"	
+	when
+		$c : Cheese( price == 91 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_91"
+	when 
+		$p : Person(name == "p91")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_92"	
+	when
+		$c : Cheese( price == 92 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_92"
+	when 
+		$p : Person(name == "p92")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_93"	
+	when
+		$c : Cheese( price == 93 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_93"
+	when 
+		$p : Person(name == "p93")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_94"	
+	when
+		$c : Cheese( price == 94 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_94"
+	when 
+		$p : Person(name == "p94")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_95"	
+	when
+		$c : Cheese( price == 95 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_95"
+	when 
+		$p : Person(name == "p95")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_96"	
+	when
+		$c : Cheese( price == 96 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_96"
+	when 
+		$p : Person(name == "p96")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_97"	
+	when
+		$c : Cheese( price == 97 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_97"
+	when 
+		$p : Person(name == "p97")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_98"	
+	when
+		$c : Cheese( price == 98 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_98"
+	when 
+		$p : Person(name == "p98")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_99"	
+	when
+		$c : Cheese( price == 99 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_99"
+	when 
+		$p : Person(name == "p99")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_100"	
+	when
+		$c : Cheese( price == 100 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_100"
+	when 
+		$p : Person(name == "p100")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_101"	
+	when
+		$c : Cheese( price == 101 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_101"
+	when 
+		$p : Person(name == "p101")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_102"	
+	when
+		$c : Cheese( price == 102 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_102"
+	when 
+		$p : Person(name == "p102")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_103"	
+	when
+		$c : Cheese( price == 103 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_103"
+	when 
+		$p : Person(name == "p103")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_104"	
+	when
+		$c : Cheese( price == 104 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_104"
+	when 
+		$p : Person(name == "p104")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_105"	
+	when
+		$c : Cheese( price == 105 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_105"
+	when 
+		$p : Person(name == "p105")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_106"	
+	when
+		$c : Cheese( price == 106 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_106"
+	when 
+		$p : Person(name == "p106")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_107"	
+	when
+		$c : Cheese( price == 107 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_107"
+	when 
+		$p : Person(name == "p107")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_108"	
+	when
+		$c : Cheese( price == 108 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_108"
+	when 
+		$p : Person(name == "p108")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_109"	
+	when
+		$c : Cheese( price == 109 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_109"
+	when 
+		$p : Person(name == "p109")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_110"	
+	when
+		$c : Cheese( price == 110 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_110"
+	when 
+		$p : Person(name == "p110")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_111"	
+	when
+		$c : Cheese( price == 111 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_111"
+	when 
+		$p : Person(name == "p111")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_112"	
+	when
+		$c : Cheese( price == 112 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_112"
+	when 
+		$p : Person(name == "p112")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_113"	
+	when
+		$c : Cheese( price == 113 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_113"
+	when 
+		$p : Person(name == "p113")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_114"	
+	when
+		$c : Cheese( price == 114 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_114"
+	when 
+		$p : Person(name == "p114")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_115"	
+	when
+		$c : Cheese( price == 115 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_115"
+	when 
+		$p : Person(name == "p115")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_116"	
+	when
+		$c : Cheese( price == 116 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_116"
+	when 
+		$p : Person(name == "p116")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_117"	
+	when
+		$c : Cheese( price == 117 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_117"
+	when 
+		$p : Person(name == "p117")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_118"	
+	when
+		$c : Cheese( price == 118 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_118"
+	when 
+		$p : Person(name == "p118")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_119"	
+	when
+		$c : Cheese( price == 119 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_119"
+	when 
+		$p : Person(name == "p119")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_120"	
+	when
+		$c : Cheese( price == 120 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_120"
+	when 
+		$p : Person(name == "p120")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_121"	
+	when
+		$c : Cheese( price == 121 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_121"
+	when 
+		$p : Person(name == "p121")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_122"	
+	when
+		$c : Cheese( price == 122 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_122"
+	when 
+		$p : Person(name == "p122")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_123"	
+	when
+		$c : Cheese( price == 123 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_123"
+	when 
+		$p : Person(name == "p123")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_124"	
+	when
+		$c : Cheese( price == 124 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_124"
+	when 
+		$p : Person(name == "p124")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_125"	
+	when
+		$c : Cheese( price == 125 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_125"
+	when 
+		$p : Person(name == "p125")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_126"	
+	when
+		$c : Cheese( price == 126 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_126"
+	when 
+		$p : Person(name == "p126")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_127"	
+	when
+		$c : Cheese( price == 127 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_127"
+	when 
+		$p : Person(name == "p127")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_128"	
+	when
+		$c : Cheese( price == 128 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_128"
+	when 
+		$p : Person(name == "p128")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_129"	
+	when
+		$c : Cheese( price == 129 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_129"
+	when 
+		$p : Person(name == "p129")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_130"	
+	when
+		$c : Cheese( price == 130 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_130"
+	when 
+		$p : Person(name == "p130")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_131"	
+	when
+		$c : Cheese( price == 131 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_131"
+	when 
+		$p : Person(name == "p131")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_132"	
+	when
+		$c : Cheese( price == 132 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_132"
+	when 
+		$p : Person(name == "p132")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_133"	
+	when
+		$c : Cheese( price == 133 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_133"
+	when 
+		$p : Person(name == "p133")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_134"	
+	when
+		$c : Cheese( price == 134 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_134"
+	when 
+		$p : Person(name == "p134")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_135"	
+	when
+		$c : Cheese( price == 135 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_135"
+	when 
+		$p : Person(name == "p135")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_136"	
+	when
+		$c : Cheese( price == 136 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_136"
+	when 
+		$p : Person(name == "p136")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_137"	
+	when
+		$c : Cheese( price == 137 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_137"
+	when 
+		$p : Person(name == "p137")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_138"	
+	when
+		$c : Cheese( price == 138 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_138"
+	when 
+		$p : Person(name == "p138")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_139"	
+	when
+		$c : Cheese( price == 139 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_139"
+	when 
+		$p : Person(name == "p139")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_140"	
+	when
+		$c : Cheese( price == 140 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_140"
+	when 
+		$p : Person(name == "p140")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_141"	
+	when
+		$c : Cheese( price == 141 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_141"
+	when 
+		$p : Person(name == "p141")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_142"	
+	when
+		$c : Cheese( price == 142 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_142"
+	when 
+		$p : Person(name == "p142")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_143"	
+	when
+		$c : Cheese( price == 143 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_143"
+	when 
+		$p : Person(name == "p143")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_144"	
+	when
+		$c : Cheese( price == 144 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_144"
+	when 
+		$p : Person(name == "p144")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_145"	
+	when
+		$c : Cheese( price == 145 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_145"
+	when 
+		$p : Person(name == "p145")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_146"	
+	when
+		$c : Cheese( price == 146 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_146"
+	when 
+		$p : Person(name == "p146")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_147"	
+	when
+		$c : Cheese( price == 147 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_147"
+	when 
+		$p : Person(name == "p147")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_148"	
+	when
+		$c : Cheese( price == 148 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_148"
+	when 
+		$p : Person(name == "p148")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_149"	
+	when
+		$c : Cheese( price == 149 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_149"
+	when 
+		$p : Person(name == "p149")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_150"	
+	when
+		$c : Cheese( price == 150 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_150"
+	when 
+		$p : Person(name == "p150")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_151"	
+	when
+		$c : Cheese( price == 151 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_151"
+	when 
+		$p : Person(name == "p151")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_152"	
+	when
+		$c : Cheese( price == 152 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_152"
+	when 
+		$p : Person(name == "p152")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_153"	
+	when
+		$c : Cheese( price == 153 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_153"
+	when 
+		$p : Person(name == "p153")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_154"	
+	when
+		$c : Cheese( price == 154 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_154"
+	when 
+		$p : Person(name == "p154")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_155"	
+	when
+		$c : Cheese( price == 155 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_155"
+	when 
+		$p : Person(name == "p155")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_156"	
+	when
+		$c : Cheese( price == 156 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_156"
+	when 
+		$p : Person(name == "p156")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_157"	
+	when
+		$c : Cheese( price == 157 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_157"
+	when 
+		$p : Person(name == "p157")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_158"	
+	when
+		$c : Cheese( price == 158 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_158"
+	when 
+		$p : Person(name == "p158")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_159"	
+	when
+		$c : Cheese( price == 159 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_159"
+	when 
+		$p : Person(name == "p159")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_160"	
+	when
+		$c : Cheese( price == 160 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_160"
+	when 
+		$p : Person(name == "p160")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_161"	
+	when
+		$c : Cheese( price == 161 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_161"
+	when 
+		$p : Person(name == "p161")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_162"	
+	when
+		$c : Cheese( price == 162 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_162"
+	when 
+		$p : Person(name == "p162")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_163"	
+	when
+		$c : Cheese( price == 163 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_163"
+	when 
+		$p : Person(name == "p163")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_164"	
+	when
+		$c : Cheese( price == 164 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_164"
+	when 
+		$p : Person(name == "p164")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_165"	
+	when
+		$c : Cheese( price == 165 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_165"
+	when 
+		$p : Person(name == "p165")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_166"	
+	when
+		$c : Cheese( price == 166 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_166"
+	when 
+		$p : Person(name == "p166")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_167"	
+	when
+		$c : Cheese( price == 167 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_167"
+	when 
+		$p : Person(name == "p167")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_168"	
+	when
+		$c : Cheese( price == 168 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_168"
+	when 
+		$p : Person(name == "p168")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_169"	
+	when
+		$c : Cheese( price == 169 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_169"
+	when 
+		$p : Person(name == "p169")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_170"	
+	when
+		$c : Cheese( price == 170 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_170"
+	when 
+		$p : Person(name == "p170")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_171"	
+	when
+		$c : Cheese( price == 171 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_171"
+	when 
+		$p : Person(name == "p171")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_172"	
+	when
+		$c : Cheese( price == 172 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_172"
+	when 
+		$p : Person(name == "p172")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_173"	
+	when
+		$c : Cheese( price == 173 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_173"
+	when 
+		$p : Person(name == "p173")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_174"	
+	when
+		$c : Cheese( price == 174 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_174"
+	when 
+		$p : Person(name == "p174")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_175"	
+	when
+		$c : Cheese( price == 175 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_175"
+	when 
+		$p : Person(name == "p175")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_176"	
+	when
+		$c : Cheese( price == 176 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_176"
+	when 
+		$p : Person(name == "p176")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_177"	
+	when
+		$c : Cheese( price == 177 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_177"
+	when 
+		$p : Person(name == "p177")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_178"	
+	when
+		$c : Cheese( price == 178 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_178"
+	when 
+		$p : Person(name == "p178")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_179"	
+	when
+		$c : Cheese( price == 179 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_179"
+	when 
+		$p : Person(name == "p179")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_180"	
+	when
+		$c : Cheese( price == 180 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_180"
+	when 
+		$p : Person(name == "p180")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_181"	
+	when
+		$c : Cheese( price == 181 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_181"
+	when 
+		$p : Person(name == "p181")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_182"	
+	when
+		$c : Cheese( price == 182 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_182"
+	when 
+		$p : Person(name == "p182")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_183"	
+	when
+		$c : Cheese( price == 183 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_183"
+	when 
+		$p : Person(name == "p183")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_184"	
+	when
+		$c : Cheese( price == 184 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_184"
+	when 
+		$p : Person(name == "p184")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_185"	
+	when
+		$c : Cheese( price == 185 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_185"
+	when 
+		$p : Person(name == "p185")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_186"	
+	when
+		$c : Cheese( price == 186 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_186"
+	when 
+		$p : Person(name == "p186")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_187"	
+	when
+		$c : Cheese( price == 187 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_187"
+	when 
+		$p : Person(name == "p187")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_188"	
+	when
+		$c : Cheese( price == 188 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_188"
+	when 
+		$p : Person(name == "p188")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_189"	
+	when
+		$c : Cheese( price == 189 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_189"
+	when 
+		$p : Person(name == "p189")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_190"	
+	when
+		$c : Cheese( price == 190 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_190"
+	when 
+		$p : Person(name == "p190")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_191"	
+	when
+		$c : Cheese( price == 191 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_191"
+	when 
+		$p : Person(name == "p191")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_192"	
+	when
+		$c : Cheese( price == 192 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_192"
+	when 
+		$p : Person(name == "p192")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_193"	
+	when
+		$c : Cheese( price == 193 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_193"
+	when 
+		$p : Person(name == "p193")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_194"	
+	when
+		$c : Cheese( price == 194 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_194"
+	when 
+		$p : Person(name == "p194")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_195"	
+	when
+		$c : Cheese( price == 195 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_195"
+	when 
+		$p : Person(name == "p195")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_196"	
+	when
+		$c : Cheese( price == 196 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_196"
+	when 
+		$p : Person(name == "p196")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_197"	
+	when
+		$c : Cheese( price == 197 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_197"
+	when 
+		$p : Person(name == "p197")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_198"	
+	when
+		$c : Cheese( price == 198 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_198"
+	when 
+		$p : Person(name == "p198")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_199"	
+	when
+		$c : Cheese( price == 199 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_199"
+	when 
+		$p : Person(name == "p199")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_200"	
+	when
+		$c : Cheese( price == 200 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_200"
+	when 
+		$p : Person(name == "p200")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+		
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfileMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfileMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/sequentialProfileMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3413 @@
+#created on: 27-Jun-2007
+package org.drools.test
+
+dialect "mvel"
+
+#list any import classes here.
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+
+
+rule "Cheese_1"	
+	when
+		$c : Cheese( price == 1 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_1"
+	when 
+		$p : Person(name == "p1")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_2"	
+	when
+		$c : Cheese( price == 2 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_2"
+	when 
+		$p : Person(name == "p2")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_3"	
+	when
+		$c : Cheese( price == 3 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_3"
+	when 
+		$p : Person(name == "p3")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_4"	
+	when
+		$c : Cheese( price == 4 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_4"
+	when 
+		$p : Person(name == "p4")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_5"	
+	when
+		$c : Cheese( price == 5 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_5"
+	when 
+		$p : Person(name == "p5")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_6"	
+	when
+		$c : Cheese( price == 6 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_6"
+	when 
+		$p : Person(name == "p6")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_7"	
+	when
+		$c : Cheese( price == 7 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_7"
+	when 
+		$p : Person(name == "p7")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_8"	
+	when
+		$c : Cheese( price == 8 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_8"
+	when 
+		$p : Person(name == "p8")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_9"	
+	when
+		$c : Cheese( price == 9 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_9"
+	when 
+		$p : Person(name == "p9")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_10"	
+	when
+		$c : Cheese( price == 10 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_10"
+	when 
+		$p : Person(name == "p10")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_11"	
+	when
+		$c : Cheese( price == 11 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_11"
+	when 
+		$p : Person(name == "p11")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_12"	
+	when
+		$c : Cheese( price == 12 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_12"
+	when 
+		$p : Person(name == "p12")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_13"	
+	when
+		$c : Cheese( price == 13 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_13"
+	when 
+		$p : Person(name == "p13")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_14"	
+	when
+		$c : Cheese( price == 14 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_14"
+	when 
+		$p : Person(name == "p14")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_15"	
+	when
+		$c : Cheese( price == 15 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_15"
+	when 
+		$p : Person(name == "p15")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_16"	
+	when
+		$c : Cheese( price == 16 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_16"
+	when 
+		$p : Person(name == "p16")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_17"	
+	when
+		$c : Cheese( price == 17 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_17"
+	when 
+		$p : Person(name == "p17")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_18"	
+	when
+		$c : Cheese( price == 18 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_18"
+	when 
+		$p : Person(name == "p18")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_19"	
+	when
+		$c : Cheese( price == 19 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_19"
+	when 
+		$p : Person(name == "p19")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_20"	
+	when
+		$c : Cheese( price == 20 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_20"
+	when 
+		$p : Person(name == "p20")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_21"	
+	when
+		$c : Cheese( price == 21 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_21"
+	when 
+		$p : Person(name == "p21")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_22"	
+	when
+		$c : Cheese( price == 22 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_22"
+	when 
+		$p : Person(name == "p22")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_23"	
+	when
+		$c : Cheese( price == 23 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_23"
+	when 
+		$p : Person(name == "p23")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_24"	
+	when
+		$c : Cheese( price == 24 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_24"
+	when 
+		$p : Person(name == "p24")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_25"	
+	when
+		$c : Cheese( price == 25 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_25"
+	when 
+		$p : Person(name == "p25")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_26"	
+	when
+		$c : Cheese( price == 26 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_26"
+	when 
+		$p : Person(name == "p26")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_27"	
+	when
+		$c : Cheese( price == 27 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_27"
+	when 
+		$p : Person(name == "p27")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_28"	
+	when
+		$c : Cheese( price == 28 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_28"
+	when 
+		$p : Person(name == "p28")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_29"	
+	when
+		$c : Cheese( price == 29 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_29"
+	when 
+		$p : Person(name == "p29")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_30"	
+	when
+		$c : Cheese( price == 30 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_30"
+	when 
+		$p : Person(name == "p30")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_31"	
+	when
+		$c : Cheese( price == 31 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_31"
+	when 
+		$p : Person(name == "p31")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_32"	
+	when
+		$c : Cheese( price == 32 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_32"
+	when 
+		$p : Person(name == "p32")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_33"	
+	when
+		$c : Cheese( price == 33 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_33"
+	when 
+		$p : Person(name == "p33")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_34"	
+	when
+		$c : Cheese( price == 34 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_34"
+	when 
+		$p : Person(name == "p34")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_35"	
+	when
+		$c : Cheese( price == 35 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_35"
+	when 
+		$p : Person(name == "p35")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_36"	
+	when
+		$c : Cheese( price == 36 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_36"
+	when 
+		$p : Person(name == "p36")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_37"	
+	when
+		$c : Cheese( price == 37 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_37"
+	when 
+		$p : Person(name == "p37")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_38"	
+	when
+		$c : Cheese( price == 38 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_38"
+	when 
+		$p : Person(name == "p38")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_39"	
+	when
+		$c : Cheese( price == 39 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_39"
+	when 
+		$p : Person(name == "p39")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_40"	
+	when
+		$c : Cheese( price == 40 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_40"
+	when 
+		$p : Person(name == "p40")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_41"	
+	when
+		$c : Cheese( price == 41 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_41"
+	when 
+		$p : Person(name == "p41")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_42"	
+	when
+		$c : Cheese( price == 42 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_42"
+	when 
+		$p : Person(name == "p42")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_43"	
+	when
+		$c : Cheese( price == 43 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_43"
+	when 
+		$p : Person(name == "p43")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_44"	
+	when
+		$c : Cheese( price == 44 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_44"
+	when 
+		$p : Person(name == "p44")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_45"	
+	when
+		$c : Cheese( price == 45 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_45"
+	when 
+		$p : Person(name == "p45")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_46"	
+	when
+		$c : Cheese( price == 46 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_46"
+	when 
+		$p : Person(name == "p46")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_47"	
+	when
+		$c : Cheese( price == 47 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_47"
+	when 
+		$p : Person(name == "p47")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_48"	
+	when
+		$c : Cheese( price == 48 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_48"
+	when 
+		$p : Person(name == "p48")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_49"	
+	when
+		$c : Cheese( price == 49 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_49"
+	when 
+		$p : Person(name == "p49")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_50"	
+	when
+		$c : Cheese( price == 50 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_50"
+	when 
+		$p : Person(name == "p50")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_51"	
+	when
+		$c : Cheese( price == 51 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_51"
+	when 
+		$p : Person(name == "p51")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_52"	
+	when
+		$c : Cheese( price == 52 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_52"
+	when 
+		$p : Person(name == "p52")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_53"	
+	when
+		$c : Cheese( price == 53 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_53"
+	when 
+		$p : Person(name == "p53")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_54"	
+	when
+		$c : Cheese( price == 54 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_54"
+	when 
+		$p : Person(name == "p54")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_55"	
+	when
+		$c : Cheese( price == 55 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_55"
+	when 
+		$p : Person(name == "p55")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_56"	
+	when
+		$c : Cheese( price == 56 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_56"
+	when 
+		$p : Person(name == "p56")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_57"	
+	when
+		$c : Cheese( price == 57 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_57"
+	when 
+		$p : Person(name == "p57")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_58"	
+	when
+		$c : Cheese( price == 58 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_58"
+	when 
+		$p : Person(name == "p58")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_59"	
+	when
+		$c : Cheese( price == 59 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_59"
+	when 
+		$p : Person(name == "p59")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_60"	
+	when
+		$c : Cheese( price == 60 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_60"
+	when 
+		$p : Person(name == "p60")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_61"	
+	when
+		$c : Cheese( price == 61 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_61"
+	when 
+		$p : Person(name == "p61")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_62"	
+	when
+		$c : Cheese( price == 62 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_62"
+	when 
+		$p : Person(name == "p62")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_63"	
+	when
+		$c : Cheese( price == 63 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_63"
+	when 
+		$p : Person(name == "p63")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_64"	
+	when
+		$c : Cheese( price == 64 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_64"
+	when 
+		$p : Person(name == "p64")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_65"	
+	when
+		$c : Cheese( price == 65 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_65"
+	when 
+		$p : Person(name == "p65")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_66"	
+	when
+		$c : Cheese( price == 66 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_66"
+	when 
+		$p : Person(name == "p66")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_67"	
+	when
+		$c : Cheese( price == 67 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_67"
+	when 
+		$p : Person(name == "p67")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_68"	
+	when
+		$c : Cheese( price == 68 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_68"
+	when 
+		$p : Person(name == "p68")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_69"	
+	when
+		$c : Cheese( price == 69 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_69"
+	when 
+		$p : Person(name == "p69")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_70"	
+	when
+		$c : Cheese( price == 70 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_70"
+	when 
+		$p : Person(name == "p70")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_71"	
+	when
+		$c : Cheese( price == 71 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_71"
+	when 
+		$p : Person(name == "p71")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_72"	
+	when
+		$c : Cheese( price == 72 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_72"
+	when 
+		$p : Person(name == "p72")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_73"	
+	when
+		$c : Cheese( price == 73 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_73"
+	when 
+		$p : Person(name == "p73")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_74"	
+	when
+		$c : Cheese( price == 74 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_74"
+	when 
+		$p : Person(name == "p74")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_75"	
+	when
+		$c : Cheese( price == 75 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_75"
+	when 
+		$p : Person(name == "p75")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_76"	
+	when
+		$c : Cheese( price == 76 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_76"
+	when 
+		$p : Person(name == "p76")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_77"	
+	when
+		$c : Cheese( price == 77 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_77"
+	when 
+		$p : Person(name == "p77")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_78"	
+	when
+		$c : Cheese( price == 78 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_78"
+	when 
+		$p : Person(name == "p78")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_79"	
+	when
+		$c : Cheese( price == 79 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_79"
+	when 
+		$p : Person(name == "p79")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_80"	
+	when
+		$c : Cheese( price == 80 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_80"
+	when 
+		$p : Person(name == "p80")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_81"	
+	when
+		$c : Cheese( price == 81 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_81"
+	when 
+		$p : Person(name == "p81")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_82"	
+	when
+		$c : Cheese( price == 82 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_82"
+	when 
+		$p : Person(name == "p82")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_83"	
+	when
+		$c : Cheese( price == 83 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_83"
+	when 
+		$p : Person(name == "p83")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_84"	
+	when
+		$c : Cheese( price == 84 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_84"
+	when 
+		$p : Person(name == "p84")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_85"	
+	when
+		$c : Cheese( price == 85 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_85"
+	when 
+		$p : Person(name == "p85")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_86"	
+	when
+		$c : Cheese( price == 86 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_86"
+	when 
+		$p : Person(name == "p86")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_87"	
+	when
+		$c : Cheese( price == 87 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_87"
+	when 
+		$p : Person(name == "p87")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_88"	
+	when
+		$c : Cheese( price == 88 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_88"
+	when 
+		$p : Person(name == "p88")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_89"	
+	when
+		$c : Cheese( price == 89 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_89"
+	when 
+		$p : Person(name == "p89")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_90"	
+	when
+		$c : Cheese( price == 90 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_90"
+	when 
+		$p : Person(name == "p90")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_91"	
+	when
+		$c : Cheese( price == 91 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_91"
+	when 
+		$p : Person(name == "p91")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_92"	
+	when
+		$c : Cheese( price == 92 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_92"
+	when 
+		$p : Person(name == "p92")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_93"	
+	when
+		$c : Cheese( price == 93 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_93"
+	when 
+		$p : Person(name == "p93")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_94"	
+	when
+		$c : Cheese( price == 94 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_94"
+	when 
+		$p : Person(name == "p94")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_95"	
+	when
+		$c : Cheese( price == 95 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_95"
+	when 
+		$p : Person(name == "p95")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_96"	
+	when
+		$c : Cheese( price == 96 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_96"
+	when 
+		$p : Person(name == "p96")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_97"	
+	when
+		$c : Cheese( price == 97 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_97"
+	when 
+		$p : Person(name == "p97")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_98"	
+	when
+		$c : Cheese( price == 98 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_98"
+	when 
+		$p : Person(name == "p98")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_99"	
+	when
+		$c : Cheese( price == 99 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_99"
+	when 
+		$p : Person(name == "p99")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_100"	
+	when
+		$c : Cheese( price == 100 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_100"
+	when 
+		$p : Person(name == "p100")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_101"	
+	when
+		$c : Cheese( price == 101 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_101"
+	when 
+		$p : Person(name == "p101")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_102"	
+	when
+		$c : Cheese( price == 102 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_102"
+	when 
+		$p : Person(name == "p102")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_103"	
+	when
+		$c : Cheese( price == 103 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_103"
+	when 
+		$p : Person(name == "p103")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_104"	
+	when
+		$c : Cheese( price == 104 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_104"
+	when 
+		$p : Person(name == "p104")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_105"	
+	when
+		$c : Cheese( price == 105 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_105"
+	when 
+		$p : Person(name == "p105")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_106"	
+	when
+		$c : Cheese( price == 106 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_106"
+	when 
+		$p : Person(name == "p106")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_107"	
+	when
+		$c : Cheese( price == 107 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_107"
+	when 
+		$p : Person(name == "p107")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_108"	
+	when
+		$c : Cheese( price == 108 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_108"
+	when 
+		$p : Person(name == "p108")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_109"	
+	when
+		$c : Cheese( price == 109 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_109"
+	when 
+		$p : Person(name == "p109")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_110"	
+	when
+		$c : Cheese( price == 110 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_110"
+	when 
+		$p : Person(name == "p110")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_111"	
+	when
+		$c : Cheese( price == 111 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_111"
+	when 
+		$p : Person(name == "p111")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_112"	
+	when
+		$c : Cheese( price == 112 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_112"
+	when 
+		$p : Person(name == "p112")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_113"	
+	when
+		$c : Cheese( price == 113 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_113"
+	when 
+		$p : Person(name == "p113")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_114"	
+	when
+		$c : Cheese( price == 114 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_114"
+	when 
+		$p : Person(name == "p114")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_115"	
+	when
+		$c : Cheese( price == 115 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_115"
+	when 
+		$p : Person(name == "p115")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_116"	
+	when
+		$c : Cheese( price == 116 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_116"
+	when 
+		$p : Person(name == "p116")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_117"	
+	when
+		$c : Cheese( price == 117 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_117"
+	when 
+		$p : Person(name == "p117")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_118"	
+	when
+		$c : Cheese( price == 118 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_118"
+	when 
+		$p : Person(name == "p118")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_119"	
+	when
+		$c : Cheese( price == 119 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_119"
+	when 
+		$p : Person(name == "p119")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_120"	
+	when
+		$c : Cheese( price == 120 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_120"
+	when 
+		$p : Person(name == "p120")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_121"	
+	when
+		$c : Cheese( price == 121 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_121"
+	when 
+		$p : Person(name == "p121")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_122"	
+	when
+		$c : Cheese( price == 122 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_122"
+	when 
+		$p : Person(name == "p122")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_123"	
+	when
+		$c : Cheese( price == 123 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_123"
+	when 
+		$p : Person(name == "p123")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_124"	
+	when
+		$c : Cheese( price == 124 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_124"
+	when 
+		$p : Person(name == "p124")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_125"	
+	when
+		$c : Cheese( price == 125 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_125"
+	when 
+		$p : Person(name == "p125")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_126"	
+	when
+		$c : Cheese( price == 126 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_126"
+	when 
+		$p : Person(name == "p126")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_127"	
+	when
+		$c : Cheese( price == 127 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_127"
+	when 
+		$p : Person(name == "p127")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_128"	
+	when
+		$c : Cheese( price == 128 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_128"
+	when 
+		$p : Person(name == "p128")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_129"	
+	when
+		$c : Cheese( price == 129 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_129"
+	when 
+		$p : Person(name == "p129")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_130"	
+	when
+		$c : Cheese( price == 130 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_130"
+	when 
+		$p : Person(name == "p130")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_131"	
+	when
+		$c : Cheese( price == 131 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_131"
+	when 
+		$p : Person(name == "p131")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_132"	
+	when
+		$c : Cheese( price == 132 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_132"
+	when 
+		$p : Person(name == "p132")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_133"	
+	when
+		$c : Cheese( price == 133 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_133"
+	when 
+		$p : Person(name == "p133")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_134"	
+	when
+		$c : Cheese( price == 134 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_134"
+	when 
+		$p : Person(name == "p134")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_135"	
+	when
+		$c : Cheese( price == 135 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_135"
+	when 
+		$p : Person(name == "p135")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_136"	
+	when
+		$c : Cheese( price == 136 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_136"
+	when 
+		$p : Person(name == "p136")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_137"	
+	when
+		$c : Cheese( price == 137 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_137"
+	when 
+		$p : Person(name == "p137")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_138"	
+	when
+		$c : Cheese( price == 138 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_138"
+	when 
+		$p : Person(name == "p138")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_139"	
+	when
+		$c : Cheese( price == 139 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_139"
+	when 
+		$p : Person(name == "p139")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_140"	
+	when
+		$c : Cheese( price == 140 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_140"
+	when 
+		$p : Person(name == "p140")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_141"	
+	when
+		$c : Cheese( price == 141 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_141"
+	when 
+		$p : Person(name == "p141")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_142"	
+	when
+		$c : Cheese( price == 142 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_142"
+	when 
+		$p : Person(name == "p142")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_143"	
+	when
+		$c : Cheese( price == 143 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_143"
+	when 
+		$p : Person(name == "p143")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_144"	
+	when
+		$c : Cheese( price == 144 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_144"
+	when 
+		$p : Person(name == "p144")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_145"	
+	when
+		$c : Cheese( price == 145 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_145"
+	when 
+		$p : Person(name == "p145")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_146"	
+	when
+		$c : Cheese( price == 146 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_146"
+	when 
+		$p : Person(name == "p146")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_147"	
+	when
+		$c : Cheese( price == 147 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_147"
+	when 
+		$p : Person(name == "p147")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_148"	
+	when
+		$c : Cheese( price == 148 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_148"
+	when 
+		$p : Person(name == "p148")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_149"	
+	when
+		$c : Cheese( price == 149 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_149"
+	when 
+		$p : Person(name == "p149")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_150"	
+	when
+		$c : Cheese( price == 150 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_150"
+	when 
+		$p : Person(name == "p150")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_151"	
+	when
+		$c : Cheese( price == 151 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_151"
+	when 
+		$p : Person(name == "p151")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_152"	
+	when
+		$c : Cheese( price == 152 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_152"
+	when 
+		$p : Person(name == "p152")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_153"	
+	when
+		$c : Cheese( price == 153 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_153"
+	when 
+		$p : Person(name == "p153")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_154"	
+	when
+		$c : Cheese( price == 154 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_154"
+	when 
+		$p : Person(name == "p154")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_155"	
+	when
+		$c : Cheese( price == 155 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_155"
+	when 
+		$p : Person(name == "p155")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_156"	
+	when
+		$c : Cheese( price == 156 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_156"
+	when 
+		$p : Person(name == "p156")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_157"	
+	when
+		$c : Cheese( price == 157 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_157"
+	when 
+		$p : Person(name == "p157")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_158"	
+	when
+		$c : Cheese( price == 158 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_158"
+	when 
+		$p : Person(name == "p158")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_159"	
+	when
+		$c : Cheese( price == 159 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_159"
+	when 
+		$p : Person(name == "p159")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_160"	
+	when
+		$c : Cheese( price == 160 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_160"
+	when 
+		$p : Person(name == "p160")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_161"	
+	when
+		$c : Cheese( price == 161 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_161"
+	when 
+		$p : Person(name == "p161")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_162"	
+	when
+		$c : Cheese( price == 162 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_162"
+	when 
+		$p : Person(name == "p162")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_163"	
+	when
+		$c : Cheese( price == 163 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_163"
+	when 
+		$p : Person(name == "p163")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_164"	
+	when
+		$c : Cheese( price == 164 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_164"
+	when 
+		$p : Person(name == "p164")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_165"	
+	when
+		$c : Cheese( price == 165 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_165"
+	when 
+		$p : Person(name == "p165")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_166"	
+	when
+		$c : Cheese( price == 166 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_166"
+	when 
+		$p : Person(name == "p166")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_167"	
+	when
+		$c : Cheese( price == 167 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_167"
+	when 
+		$p : Person(name == "p167")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_168"	
+	when
+		$c : Cheese( price == 168 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_168"
+	when 
+		$p : Person(name == "p168")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_169"	
+	when
+		$c : Cheese( price == 169 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_169"
+	when 
+		$p : Person(name == "p169")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_170"	
+	when
+		$c : Cheese( price == 170 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_170"
+	when 
+		$p : Person(name == "p170")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_171"	
+	when
+		$c : Cheese( price == 171 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_171"
+	when 
+		$p : Person(name == "p171")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_172"	
+	when
+		$c : Cheese( price == 172 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_172"
+	when 
+		$p : Person(name == "p172")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_173"	
+	when
+		$c : Cheese( price == 173 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_173"
+	when 
+		$p : Person(name == "p173")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_174"	
+	when
+		$c : Cheese( price == 174 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_174"
+	when 
+		$p : Person(name == "p174")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_175"	
+	when
+		$c : Cheese( price == 175 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_175"
+	when 
+		$p : Person(name == "p175")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_176"	
+	when
+		$c : Cheese( price == 176 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_176"
+	when 
+		$p : Person(name == "p176")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_177"	
+	when
+		$c : Cheese( price == 177 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_177"
+	when 
+		$p : Person(name == "p177")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_178"	
+	when
+		$c : Cheese( price == 178 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_178"
+	when 
+		$p : Person(name == "p178")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_179"	
+	when
+		$c : Cheese( price == 179 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_179"
+	when 
+		$p : Person(name == "p179")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_180"	
+	when
+		$c : Cheese( price == 180 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_180"
+	when 
+		$p : Person(name == "p180")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_181"	
+	when
+		$c : Cheese( price == 181 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_181"
+	when 
+		$p : Person(name == "p181")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_182"	
+	when
+		$c : Cheese( price == 182 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_182"
+	when 
+		$p : Person(name == "p182")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_183"	
+	when
+		$c : Cheese( price == 183 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_183"
+	when 
+		$p : Person(name == "p183")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_184"	
+	when
+		$c : Cheese( price == 184 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_184"
+	when 
+		$p : Person(name == "p184")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_185"	
+	when
+		$c : Cheese( price == 185 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_185"
+	when 
+		$p : Person(name == "p185")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_186"	
+	when
+		$c : Cheese( price == 186 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_186"
+	when 
+		$p : Person(name == "p186")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_187"	
+	when
+		$c : Cheese( price == 187 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_187"
+	when 
+		$p : Person(name == "p187")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_188"	
+	when
+		$c : Cheese( price == 188 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_188"
+	when 
+		$p : Person(name == "p188")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_189"	
+	when
+		$c : Cheese( price == 189 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_189"
+	when 
+		$p : Person(name == "p189")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_190"	
+	when
+		$c : Cheese( price == 190 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_190"
+	when 
+		$p : Person(name == "p190")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_191"	
+	when
+		$c : Cheese( price == 191 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_191"
+	when 
+		$p : Person(name == "p191")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_192"	
+	when
+		$c : Cheese( price == 192 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_192"
+	when 
+		$p : Person(name == "p192")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_193"	
+	when
+		$c : Cheese( price == 193 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_193"
+	when 
+		$p : Person(name == "p193")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_194"	
+	when
+		$c : Cheese( price == 194 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_194"
+	when 
+		$p : Person(name == "p194")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_195"	
+	when
+		$c : Cheese( price == 195 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_195"
+	when 
+		$p : Person(name == "p195")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_196"	
+	when
+		$c : Cheese( price == 196 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_196"
+	when 
+		$p : Person(name == "p196")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_197"	
+	when
+		$c : Cheese( price == 197 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_197"
+	when 
+		$p : Person(name == "p197")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_198"	
+	when
+		$c : Cheese( price == 198 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_198"
+	when 
+		$p : Person(name == "p198")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_199"	
+	when
+		$c : Cheese( price == 199 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_199"
+	when 
+		$p : Person(name == "p199")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+
+
+rule "Cheese_200"	
+	when
+		$c : Cheese( price == 200 )
+	then 
+		list.add( $c.getType() );
+end
+
+rule "Person and cheese_200"
+	when 
+		$p : Person(name == "p200")
+		$c : Cheese(price == 1)
+	then
+		list.add($p.getName());
+	
+end
+		
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/simpleSequential.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/simpleSequential.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/sequential/simpleSequential.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+#created on: 27-Jun-2007
+package org.drools.test
+
+#list any import classes here.
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+rule "Your First Rule"	
+	when
+		$c : Cheese( type == "stilton" )
+		$p : Person( likes == $c.type )
+	then 
+		list.add( $p );
+end
+
+rule "Your Second Rule"
+	when
+		$c : Cheese( type == "cheddar" )
+		$p : Person( likes == $c.type )
+	then 
+		list.add( $p );
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/simple_query_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/simple_query_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/simple_query_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+query "simple query"
+        Cheese(type == "stinky")
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Accumulate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Accumulate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Accumulate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,67 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List results;
+
+rule "AccumulateTest" salience 100
+    when
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+
+rule "Accumulate with Bindings" salience 90
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes ),
+                                                  init( int total = 0; ),
+   	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end  
+
+rule "Constraints everywhere" salience 80
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 100 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        //System.out.println($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add(new Integer($cheesery.getTotalAmount()));
+end  
+
+rule "Source pattern binds" salience 70
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price: price ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end
+
+rule "Accumulate with previous Bindings" salience 60
+    when
+        $person      : Person( name == "Bob", $likes : likes, $age : age )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                  init( int total = $age * 10; ),
+   	                                              action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        results.add($totalAmount);
+end  
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverage.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverage.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverage.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    when
+        $person : Person( $likes : likes )
+    	$avg    : Number( intValue >= 10 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                average( $price ) );
+    then
+        results.add( $avg );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverageMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverageMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateAverageMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    dialect "mvel"
+    when
+        $person : Person( $likes : likes )
+    	$avg    : Number( intValue >= 10 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                average( $price ) );
+    then
+        results.add( $avg );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCount.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCount.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCount.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    when
+        $person : Person( $likes : likes )
+    	$count  : Number( intValue >= 2 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes  ),
+                                                count( $cheese ) );
+    then
+        results.add( $count );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCountMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCountMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateCountMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    dialect "mvel"
+    when
+        $person : Person( $likes : likes )
+    	$count  : Number( intValue >= 2 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes  ),
+                                                count( $cheese ) );
+    then
+        results.add( $count );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateInnerClass.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateInnerClass.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateInnerClass.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+import org.drools.OuterClass.InnerClass;
+
+global java.util.List results;
+
+rule "Accumulate Inner Class" 
+    when
+    	$totalAmount : Number() from accumulate( $inner : InnerClass( $val : intAttr ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $val; ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,68 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List results;
+
+rule "AccumulateTest" salience 100
+	dialect "mvel"
+    when
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( ),
+                                                  init( total = 0; ),
+    	                                          action( total = total + $cheese.price ),
+                                                  result( total ) )
+    then
+        results.add($totalAmount);
+end  
+
+rule "Accumulate with Bindings" salience 90
+	dialect "mvel"
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes ),
+                                                  init( total = 0; ),
+    	                                          action( total = total +  $cheese.price ),
+                                                  result( total ) )
+    then
+        results.add($totalAmount);
+end
+
+rule "Constraints everywhere" salience 80
+	dialect "mvel"
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 100 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        results.add($cheesery.getTotalAmount());
+end  
+
+rule "Source pattern binds" salience 70
+	dialect "mvel"
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price: price ),
+                                                  init( total = 0; ),
+    	                                          action( total = total + $cheese.price ),
+                                                  result( total ) );
+    then
+        results.add($totalAmount);
+end
+
+rule "Accumulate with previous Bindings" salience 60
+	dialect "mvel"
+    when
+        $person      : Person( name == "Bob", $likes : likes, $age : age )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                  init( total = $age * 10; ),
+   	                                              action( total = total + $price; ),
+                                                  result( total ) );
+    then
+        results.add($totalAmount);
+end  
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMax.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMax.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMax.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    when
+        $person : Person( $likes : likes )
+    	$max    : Number( intValue >= 5 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                max( $price ) );
+    then
+        results.add( $max );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMaxMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMaxMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMaxMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    dialect "mvel"
+    when
+        $person : Person( $likes : likes )
+    	$max    : Number( intValue >= 5 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                max( $price ) );
+    then
+        results.add( $max );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMin.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMin.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMin.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    when
+        $person : Person( $likes : likes )
+    	$min    : Number( intValue <= 5 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                min( $price ) );
+    then
+        results.add( $min );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMinMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMinMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMinMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "External Function" salience 80
+    dialect "mvel"
+    when
+        $person : Person( $likes : likes )
+    	$min    : Number( intValue <= 5 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                min( $price ) );
+    then
+        results.add( $min );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModify.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModify.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModify.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Constraints everywhere" salience 80
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 20 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        //System.out.println($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModifyMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModifyMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateModifyMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Constraints everywhere" salience 80
+    dialect "mvel"
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 20 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "MultiPatternAccumulate" salience 80
+    when
+    	$cheesery    : Cheesery( totalAmount > 30 ) 
+    	                       from accumulate( $person : Person( $likes: likes) and $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+    	                                        reverse( cheesery.removeCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionJava.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionJava.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionJava.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Test sum" salience 80
+    dialect "java"
+    when
+    	$sum    : Number( doubleValue >= 10 ) 
+    	                       from accumulate( Person( $likes : likes ) and Cheese( type == $likes, $price : price  ),
+                                                sum( $price ) );
+    then
+        results.add( $sum );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternFunctionMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Test sum" salience 80
+    dialect "mvel"
+    when
+    	$sum    : Number( doubleValue >= 10 ) 
+    	                       from accumulate( Person( $likes : likes ) and Cheese( type == $likes, $price : price  ),
+                                                sum( $price ) );
+    then
+        results.add( $sum );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateMultiPatternMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "MultiPatternAccumulate" salience 80
+    dialect "mvel"
+    when
+    	$cheesery    : Cheesery( totalAmount > 30 ) 
+    	                       from accumulate( $person : Person( $likes: likes) and $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+    	                                        reverse( cheesery.removeCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulatePreviousBinds.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulatePreviousBinds.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulatePreviousBinds.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Accumulate with bound var " salience 100
+    when
+        Cheese( type == "stilton", $price : price )
+    	$totalAmount : Number() from accumulate(  $c : Cheese( type == "brie" ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $c.getPrice() + $price; ),
+    	                                          reverse( total -= $c.getPrice() + $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNull.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNull.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNull.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Accumulate Returning Null" salience 100
+    when
+        # emulating a null return value for accumulate
+    	$totalAmount : Number() from accumulate( Cheese( $price : price ),
+                                                 init( ),
+    	                                         action( ),
+                                                 result( null ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNullMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNullMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReturningNullMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Accumulate Returning Null MVEL" salience 100
+    dialect "mvel"
+    when
+        # emulating a null return value for accumulate
+    	$totalAmount : Number() from accumulate( Cheese( $price : price ),
+                                                 init( ),
+    	                                         action( ),
+                                                 result( null ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModify.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModify.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModify.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Constraints everywhere" salience 80
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 20 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+    	                                        reverse( cheesery.removeCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        //System.out.println($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModifyMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModifyMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateReverseModifyMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Constraints everywhere" salience 80
+    dialect "mvel"
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 20 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+    	                                        reverse( cheesery.removeCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        results.add( $cheesery );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSum.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSum.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSum.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Test sum" salience 80
+    dialect "java"
+    when
+        $person : Person( $likes : likes )
+    	$sum    : Number( doubleValue >= 10 ) 
+    	                       from accumulate( Cheese( type == $likes, $price : price  ),
+                                                sum( $price ) );
+    then
+        results.add( $sum );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSumMVEL.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSumMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateSumMVEL.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "Test sum" salience 80
+    dialect "mvel"
+    when
+        $person : Person( $likes : likes )
+    	$sum    : Number( doubleValue >= 10 ) 
+    	                       from accumulate( Cheese( type == $likes, $price : price  ),
+                                                sum( $price ) );
+    then
+        results.add( $sum );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateWithFromChaining.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateWithFromChaining.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AccumulateWithFromChaining.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+import java.util.List;
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "Accumulate with From Chaining" salience 80
+    when
+        $cheesery : Cheesery()
+        $person   : Person( $likes : likes )
+    	$list     : List( size > 2 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes  ) from $cheesery.getCheeses(),
+                                                init( List l = new ArrayList(); ),
+                                                action( l.add( $cheese ); )
+                                                result( l ) )
+    then
+        results.add( $list );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,296 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>3-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>239</x>
+                  <y>99</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.workflow.core.node.ActionNode" id="5">
+                  <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="6">
+                    <dialect>java</dialect>
+                    <consequence>list.add( &quot;java was here&quot; )</consequence>
+                  </action>
+                  <id>3</id>
+                  <name>java</name>
+                  <incomingConnections id="7">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="8">
+                        <org.drools.workflow.core.impl.ConnectionImpl id="9">
+                          <from class="org.drools.workflow.core.node.ActionNode" id="10">
+                            <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="11">
+                              <dialect>mvel</dialect>
+                              <consequence>list.add(&quot;mvel was here&quot;)</consequence>
+                            </action>
+                            <id>2</id>
+                            <name>mvel</name>
+                            <incomingConnections id="12">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="13">
+                                  <org.drools.workflow.core.impl.ConnectionImpl id="14">
+                                    <from class="org.drools.workflow.core.node.StartNode" id="15">
+                                      <id>1</id>
+                                      <name>Start</name>
+                                      <incomingConnections id="16"/>
+                                      <outgoingConnections id="17">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="18">
+                                            <org.drools.workflow.core.impl.ConnectionImpl reference="14"/>
+                                          </list>
+                                        </entry>
+                                      </outgoingConnections>
+                                      <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="19">
+                                        <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="20">
+                                          <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                                          <nodes id="21">
+                                            <entry>
+                                              <long>1</long>
+                                              <org.drools.workflow.core.node.StartNode reference="15"/>
+                                            </entry>
+                                            <entry>
+                                              <long>2</long>
+                                              <org.drools.workflow.core.node.ActionNode reference="10"/>
+                                            </entry>
+                                            <entry>
+                                              <long>3</long>
+                                              <org.drools.workflow.core.node.ActionNode reference="5"/>
+                                            </entry>
+                                            <entry>
+                                              <long>4</long>
+                                              <org.drools.workflow.core.node.EndNode id="22">
+                                                <id>4</id>
+                                                <name>End</name>
+                                                <incomingConnections id="23">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="24">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl id="25">
+                                                        <from class="org.drools.workflow.core.node.ActionNode" reference="5"/>
+                                                        <to class="org.drools.workflow.core.node.EndNode" reference="22"/>
+                                                        <fromType>DROOLS_DEFAULT</fromType>
+                                                        <toType>DROOLS_DEFAULT</toType>
+                                                      </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="26"/>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                                              </org.drools.workflow.core.node.EndNode>
+                                            </entry>
+                                          </nodes>
+                                          <lastNodeId>4</lastNodeId>
+                                        </nodeContainer>
+                                        <imports id="27">
+                                          <string>java.util.List</string>
+                                        </imports>
+                                        <globals id="28">
+                                          <entry>
+                                            <string>list</string>
+                                            <string>List</string>
+                                          </entry>
+                                        </globals>
+                                        <id>ActionDialects</id>
+                                        <name>ActionDialects</name>
+                                        <type>RuleFlow</type>
+                                        <packageName>org.drools.test</packageName>
+                                        <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="29">
+                                          <variables id="30"/>
+                                        </variableScope>
+                                      </nodeContainer>
+                                    </from>
+                                    <to class="org.drools.workflow.core.node.ActionNode" reference="10"/>
+                                    <fromType>DROOLS_DEFAULT</fromType>
+                                    <toType>DROOLS_DEFAULT</toType>
+                                  </org.drools.workflow.core.impl.ConnectionImpl>
+                                </list>
+                              </entry>
+                            </incomingConnections>
+                            <outgoingConnections id="31">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="32">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="9"/>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                          </from>
+                          <to class="org.drools.workflow.core.node.ActionNode" reference="5"/>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                      </list>
+                    </entry>
+                  </incomingConnections>
+                  <outgoingConnections id="33">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="34">
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="25"/>
+                      </list>
+                    </entry>
+                  </outgoingConnections>
+                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                </element>
+                <incomingConnections id="35">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="36" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="37"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="38" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="39">
+                                <x>130</x>
+                                <y>99</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.ActionNode" reference="10"/>
+                              <incomingConnections id="40">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="41" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <bendpoints id="42"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="43" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="44">
+                                              <x>24</x>
+                                              <y>99</y>
+                                              <width>80</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.workflow.core.node.StartNode" reference="15"/>
+                                            <incomingConnections id="45"/>
+                                            <outgoingConnections id="46">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="41"/>
+                                            </outgoingConnections>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </source>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="38"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection reference="14"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </incomingConnections>
+                              <outgoingConnections id="47">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="36"/>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                            <default>
+                              <descriptors id="48">
+                                <org.eclipse.ui.views.properties.TextPropertyDescriptor id="49">
+                                  <id class="string">Name</id>
+                                  <display>Name</display>
+                                  <incompatible>false</incompatible>
+                                </org.eclipse.ui.views.properties.TextPropertyDescriptor>
+                                <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="50">
+                                  <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                                  <actionNode reference="10"/>
+                                  <id class="string">Action</id>
+                                  <display>Action</display>
+                                  <incompatible>false</incompatible>
+                                </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                              </descriptors>
+                            </default>
+                          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="9"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="51">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="52" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="53"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="54" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="55">
+                                <x>345</x>
+                                <y>100</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.EndNode" reference="22"/>
+                              <incomingConnections id="56">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="52"/>
+                              </incomingConnections>
+                              <outgoingConnections id="57"/>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </target>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="25"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </outgoingConnections>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+            <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+              <default>
+                <descriptors id="58">
+                  <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="49"/>
+                  <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="59">
+                    <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+                    <actionNode reference="5"/>
+                    <id class="string">Action</id>
+                    <display>Action</display>
+                    <incompatible>false</incompatible>
+                  </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                </descriptors>
+              </default>
+            </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+        </entry>
+        <entry>
+          <string>4-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="54"/>
+        </entry>
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="38"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="43"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="19"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,129 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.ActionNode" id="9">
+                    <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="10">
+                      <dialect>mvel</dialect>
+                      <consequence>list.add(&quot;mvel was here&quot;)</consequence>
+                    </action>
+                    <id>2</id>
+                    <name>mvel</name>
+                    <incomingConnections id="11">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="12">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="13">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="14">
+                          <org.drools.workflow.core.impl.ConnectionImpl id="15">
+                            <from class="org.drools.workflow.core.node.ActionNode" reference="9"/>
+                            <to class="org.drools.workflow.core.node.ActionNode" id="16">
+                              <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="17">
+                                <dialect>java</dialect>
+                                <consequence>list.add( &quot;java was here&quot; );</consequence>
+                              </action>
+                              <id>3</id>
+                              <name>java</name>
+                              <incomingConnections id="18">
+                                <entry>
+                                  <string>DROOLS_DEFAULT</string>
+                                  <list id="19">
+                                    <org.drools.workflow.core.impl.ConnectionImpl reference="15"/>
+                                  </list>
+                                </entry>
+                              </incomingConnections>
+                              <outgoingConnections id="20">
+                                <entry>
+                                  <string>DROOLS_DEFAULT</string>
+                                  <list id="21">
+                                    <org.drools.workflow.core.impl.ConnectionImpl id="22">
+                                      <from class="org.drools.workflow.core.node.ActionNode" reference="16"/>
+                                      <to class="org.drools.workflow.core.node.EndNode" id="23">
+                                        <id>4</id>
+                                        <name>End</name>
+                                        <incomingConnections id="24">
+                                          <entry>
+                                            <string>DROOLS_DEFAULT</string>
+                                            <list id="25">
+                                              <org.drools.workflow.core.impl.ConnectionImpl reference="22"/>
+                                            </list>
+                                          </entry>
+                                        </incomingConnections>
+                                        <outgoingConnections id="26"/>
+                                        <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                      </to>
+                                      <fromType>DROOLS_DEFAULT</fromType>
+                                      <toType>DROOLS_DEFAULT</toType>
+                                    </org.drools.workflow.core.impl.ConnectionImpl>
+                                  </list>
+                                </entry>
+                              </outgoingConnections>
+                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                            </to>
+                            <fromType>DROOLS_DEFAULT</fromType>
+                            <toType>DROOLS_DEFAULT</toType>
+                          </org.drools.workflow.core.impl.ConnectionImpl>
+                        </list>
+                      </entry>
+                    </outgoingConnections>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.ActionNode reference="9"/>
+      </entry>
+      <entry>
+        <long>3</long>
+        <org.drools.workflow.core.node.ActionNode reference="16"/>
+      </entry>
+      <entry>
+        <long>4</long>
+        <org.drools.workflow.core.node.EndNode reference="23"/>
+      </entry>
+    </nodes>
+    <lastNodeId>4</lastNodeId>
+  </nodeContainer>
+  <imports id="27">
+    <string>java.util.List</string>
+  </imports>
+  <globals id="28">
+    <entry>
+      <string>list</string>
+      <string>List</string>
+    </entry>
+  </globals>
+  <id>ActionDialects</id>
+  <name>ActionDialects</name>
+  <type>RuleFlow</type>
+  <packageName>org.drools.test</packageName>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="29">
+    <variables id="30"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,257 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>105</x>
+                  <y>78</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="5">
+                  <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="6">
+                    <dialect>mvel</dialect>
+                    <consequence>list.add( &quot;mvel was here&quot; )</consequence>
+                  </action>
+                  <id>2</id>
+                  <name>MVELAction</name>
+                  <incomingConnections id="7">
+                    <org.drools.ruleflow.core.impl.ConnectionImpl id="8">
+                      <type>1</type>
+                      <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="9">
+                        <id>1</id>
+                        <name>Start</name>
+                        <incomingConnections id="10"/>
+                        <outgoingConnections id="11">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl reference="8"/>
+                        </outgoingConnections>
+                      </from>
+                      <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="5"/>
+                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                  </incomingConnections>
+                  <outgoingConnections id="12">
+                    <org.drools.ruleflow.core.impl.ConnectionImpl id="13">
+                      <type>1</type>
+                      <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="5"/>
+                      <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="14">
+                        <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="15">
+                          <dialect>java</dialect>
+                          <consequence>list.add( &quot;java was here&quot; );</consequence>
+                        </action>
+                        <id>3</id>
+                        <name>JavaAction</name>
+                        <incomingConnections id="16">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl reference="13"/>
+                        </incomingConnections>
+                        <outgoingConnections id="17">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl id="18">
+                            <type>1</type>
+                            <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="14"/>
+                            <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="19">
+                              <id>4</id>
+                              <name>End</name>
+                              <incomingConnections id="20">
+                                <org.drools.ruleflow.core.impl.ConnectionImpl reference="18"/>
+                              </incomingConnections>
+                              <outgoingConnections id="21"/>
+                            </to>
+                          </org.drools.ruleflow.core.impl.ConnectionImpl>
+                        </outgoingConnections>
+                      </to>
+                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                  </outgoingConnections>
+                </element>
+                <incomingConnections id="22">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="23" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <type>1</type>
+                        <bendpoints id="24"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="25" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="26">
+                                <x>105</x>
+                                <y>17</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="9"/>
+                              <incomingConnections id="27"/>
+                              <outgoingConnections id="28">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="23"/>
+                              </outgoingConnections>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="8"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="29">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="30" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <type>1</type>
+                        <bendpoints id="31"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="32" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="33">
+                                <x>105</x>
+                                <y>149</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="14"/>
+                              <incomingConnections id="34">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="30"/>
+                              </incomingConnections>
+                              <outgoingConnections id="35">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="36" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <type>1</type>
+                                      <bendpoints id="37"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="32"/>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="38" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="39">
+                                              <x>104</x>
+                                              <y>217</y>
+                                              <width>80</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="19"/>
+                                            <incomingConnections id="40">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="36"/>
+                                            </incomingConnections>
+                                            <outgoingConnections id="41"/>
+                                            <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </target>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="18"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                            <default>
+                              <descriptors id="42">
+                                <org.eclipse.ui.views.properties.TextPropertyDescriptor id="43">
+                                  <id class="string">Name</id>
+                                  <display>Name</display>
+                                  <incompatible>false</incompatible>
+                                </org.eclipse.ui.views.properties.TextPropertyDescriptor>
+                                <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="44">
+                                  <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" id="45">
+                                    <nodes id="46">
+                                      <entry>
+                                        <long>2</long>
+                                        <org.drools.ruleflow.core.impl.ActionNodeImpl reference="5"/>
+                                      </entry>
+                                      <entry>
+                                        <long>4</long>
+                                        <org.drools.ruleflow.core.impl.EndNodeImpl reference="19"/>
+                                      </entry>
+                                      <entry>
+                                        <long>1</long>
+                                        <org.drools.ruleflow.core.impl.StartNodeImpl reference="9"/>
+                                      </entry>
+                                      <entry>
+                                        <long>3</long>
+                                        <org.drools.ruleflow.core.impl.ActionNodeImpl reference="14"/>
+                                      </entry>
+                                    </nodes>
+                                    <variables id="47"/>
+                                    <lastNodeId>4</lastNodeId>
+                                    <imports id="48">
+                                      <string>java.util.List</string>
+                                    </imports>
+                                    <globals id="49">
+                                      <entry>
+                                        <string>list</string>
+                                        <string>List</string>
+                                      </entry>
+                                    </globals>
+                                    <id>ActionDialects</id>
+                                    <name>ActionDialects</name>
+                                    <type>RuleFlow</type>
+                                    <packageName>org.drools.test</packageName>
+                                  </process>
+                                  <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="14"/>
+                                  <id class="string">Action</id>
+                                  <display>Action</display>
+                                  <incompatible>false</incompatible>
+                                </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                              </descriptors>
+                            </default>
+                          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                        </target>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="13"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </outgoingConnections>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+            <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+              <default>
+                <descriptors id="50">
+                  <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="43"/>
+                  <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="51">
+                    <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="45"/>
+                    <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="5"/>
+                    <id class="string">Action</id>
+                    <display>Action</display>
+                    <incompatible>false</incompatible>
+                  </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                </descriptors>
+              </default>
+            </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+        </entry>
+        <entry>
+          <string>4-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="38"/>
+        </entry>
+        <entry>
+          <string>3-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="32"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="25"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="45"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActionDialects_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,87 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>2</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl id="3">
+        <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="4">
+          <dialect>mvel</dialect>
+          <consequence>list.add( &quot;mvel was here&quot; )</consequence>
+        </action>
+        <id>2</id>
+        <name>MVELAction</name>
+        <incomingConnections id="5">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="6">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="7">
+              <id>1</id>
+              <name>Start</name>
+              <incomingConnections id="8"/>
+              <outgoingConnections id="9">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="6"/>
+              </outgoingConnections>
+            </from>
+            <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="3"/>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </incomingConnections>
+        <outgoingConnections id="10">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="11">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="3"/>
+            <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="12">
+              <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="13">
+                <dialect>java</dialect>
+                <consequence>list.add( &quot;java was here&quot; );</consequence>
+              </action>
+              <id>3</id>
+              <name>JavaAction</name>
+              <incomingConnections id="14">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="11"/>
+              </incomingConnections>
+              <outgoingConnections id="15">
+                <org.drools.ruleflow.core.impl.ConnectionImpl id="16">
+                  <type>1</type>
+                  <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="12"/>
+                  <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="17">
+                    <id>4</id>
+                    <name>End</name>
+                    <incomingConnections id="18">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="16"/>
+                    </incomingConnections>
+                    <outgoingConnections id="19"/>
+                  </to>
+                </org.drools.ruleflow.core.impl.ConnectionImpl>
+              </outgoingConnections>
+            </to>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </outgoingConnections>
+      </org.drools.ruleflow.core.impl.ActionNodeImpl>
+    </entry>
+    <entry>
+      <long>4</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl reference="17"/>
+    </entry>
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl reference="7"/>
+    </entry>
+    <entry>
+      <long>3</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl reference="12"/>
+    </entry>
+  </nodes>
+  <variables id="20"/>
+  <lastNodeId>4</lastNodeId>
+  <imports id="21">
+    <string>java.util.List</string>
+  </imports>
+  <globals id="22">
+    <entry>
+      <string>list</string>
+      <string>List</string>
+    </entry>
+  </globals>
+  <id>ActionDialects</id>
+  <name>ActionDialects</name>
+  <type>RuleFlow</type>
+  <packageName>org.drools.test</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationCancellation.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationCancellation.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationCancellation.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package foo.bar
+
+import org.drools.Cheese
+
+global java.util.List list
+
+rule "rule1"
+	when
+		c: Cheese()
+	then
+		list.add("rule1");
+
+end
+
+rule "rule2"
+	when
+		c: Cheese()
+	then
+		list.add("rule2");
+end
+
+rule "rule3"
+	when
+		c: Cheese()
+	then
+		list.add("rule3");
+end
+
+rule "rule4"
+	when
+		not Cheese()
+	then
+		list.add("rule4");
+
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationGroups.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationGroups.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ActivationGroups.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "rule0"
+	salience 10
+	activation-group "activation-group-0"
+    when
+    	Cheese( )
+    then
+		list.add( "rule0" );
+end  
+
+rule "rule1"
+	activation-group "activation-group-0"
+    when
+    	Cheese( )
+    then
+		list.add( "rule1" );
+end  
+
+rule "rul2"
+    when
+    	Cheese( )
+    then
+		list.add( "rule2" );
+end  
+
+rule "rule3"
+	agenda-group "agenda-group-3"
+	activation-group "activation-group-3"		
+    when
+    	Cheese( )
+    then    	
+		list.add( "rule3" );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AgendaGroups.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AgendaGroups.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AgendaGroups.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,73 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "test MAIN 1"
+	salience  10
+    when
+    	Cheese( )
+    then
+		list.add( "MAIN" );
+		drools.setFocus( "group1" );
+end 
+
+rule "test MAIN 2"
+    when
+    	Cheese( )
+    then
+		list.add( "MAIN" );
+end 
+
+rule "test group1 1"
+	agenda-group "group1"
+    when
+    	Cheese( )
+    then
+		list.add( "group1" );
+end  
+
+rule "test group1 2"
+	agenda-group "group1"
+    when
+    	Cheese( )
+    then
+		list.add( "group1" );
+end  
+
+rule "test group2"
+	agenda-group "group2"
+    when
+    	Cheese( )
+    then
+		list.add( "group2" );
+end  
+
+rule "test group3 1"
+	salience 5
+	agenda-group "group3"
+	auto-focus true
+		
+    when
+    	Cheese( )
+    then    	
+		list.add( "group3" );
+		drools.setFocus( "group4" );		
+end  
+
+rule "test group3 2"
+	agenda-group "group3"
+    when
+    	Cheese( )
+    then
+		list.add( "group3" );
+end  
+
+rule "test group4"
+	agenda-group "group4"
+    when
+    	Cheese( )
+    then
+		list.add( "group4" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AlphaEvalWithOrCE.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AlphaEvalWithOrCE.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AlphaEvalWithOrCE.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test eval with OR"
+when
+    FactA( eval( "something".equals( field1 ) ) )
+    FactB() or FactC()
+then
+    results.add( "Should not have fired" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test auto bindings 1"
+when
+	$p : Person();
+	$c : Cheese( type == $p.likes, price == $c.price  )
+then
+    results.add( $p );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindingsErrors.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindingsErrors.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoBindingsErrors.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test auto bindings errors"
+when
+	$p : Person( $name : name );
+	// direct access to properties of non-pattern bindings is not supported
+	Cheese( price == $name.length )
+then
+    results.add( $p );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoVivificationVR.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoVivificationVR.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_AutoVivificationVR.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "autovivification"
+when
+     Cheese( price > oldPrice, price > this.oldPrice )
+then
+     results.add( "OK" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_BooleanWrapper.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_BooleanWrapper.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_BooleanWrapper.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test boolean wrapper"
+	when
+		Primitives( booleanWrapper == true );
+	then
+		results.add( "fired" );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertion.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertion.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertion.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+import org.drools.StockTick;
+
+declare StockTick {
+    role event,
+    clock_strategy pseudo
+}
+
+global java.util.List results;
+
+rule "Check event"
+when
+    $st : StockTick( company == "ACME" )
+then
+    results.add( $st );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+import org.drools.StockTick;
+
+declare StockTick {
+    role event,
+    duration_attribute duration
+}
+
+global java.util.List results;
+
+rule "Check event"
+when
+    $st : StockTick( company == "ACME" )
+then
+    results.add( $st );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleTimeWindow.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleTimeWindow.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_SimpleTimeWindow.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+import event org.drools.OrderEvent;
+
+global java.util.List results;
+
+rule "average over threshold"
+when
+    Number( $avg : intValue >= 50 ) from accumulate(
+              OrderEvent( $amt : total ),
+              average( $amt ) )
+then
+    //System.out.println( "Over threshold: "+$avg );
+    results.add( $avg );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_TimeRelationalOperators.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_TimeRelationalOperators.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CEP_TimeRelationalOperators.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,127 @@
+package org.drools;
+
+import org.drools.StockTick;
+
+declare StockTick {
+    role event,
+    duration_attribute duration
+}
+
+global java.util.List results_coincides;
+global java.util.List results_after;
+global java.util.List results_before;
+global java.util.List results_meets;
+global java.util.List results_met_by;
+global java.util.List results_overlaps;
+global java.util.List results_overlapped_by;
+global java.util.List results_during;
+global java.util.List results_includes;
+global java.util.List results_starts;
+global java.util.List results_started_by;
+global java.util.List results_finishes;
+global java.util.List results_finished_by;
+
+rule "coincides operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~coincides $a )
+then
+    results_coincides.add( $b );
+end
+
+rule "before operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~before[5,8] $a )
+then
+    results_before.add( $b );
+end
+
+rule "after operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~after[5,8] $a )
+then
+    results_after.add( $b );
+end
+
+rule "meets operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~meets[1] $a )
+then
+    results_meets.add( $b );
+end
+
+rule "met-by operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~metby[1] $a )
+then
+    results_met_by.add( $b );
+end
+
+
+rule "overlaps operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "DROO", this ~overlaps[1] $a )
+then
+    results_overlaps.add( $b );
+end
+
+rule "overlapped-by operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~overlappedby[1] $a )
+then
+    results_overlapped_by.add( $b );
+end
+
+rule "during operator"
+when
+    $a : StockTick( company == "DROO" )
+    $b : StockTick( company == "ACME", this ~during[1] $a )
+then
+    results_during.add( $b );
+end
+
+rule "includes operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "DROO", this ~includes[1] $a )
+then
+    results_includes.add( $b );
+end
+
+rule "starts operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "ACME", this ~starts[2] $a )
+then
+    results_starts.add( $b );
+end
+
+rule "started-by operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "ACME", this ~startedby[2] $a )
+then
+    results_started_by.add( $b );
+end
+
+rule "finishes operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "ACME", this ~finishes[2] $a )
+then
+    results_finishes.add( $b );
+end
+
+rule "finished-by operator"
+when
+    $a : StockTick( company == "ACME" )
+    $b : StockTick( company == "ACME", this ~finishedby[2] $a )
+then
+    results_finished_by.add( $b );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Collect.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Collect.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Collect.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "Collect Test" salience 70
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$cheeseList  : ArrayList(size > 2) from collect( Cheese( type == $likes ) );
+    then
+        //System.out.println($person.getName() +" will buy "+ $cheeseList.size() + " pieces of cheese");
+        results.add($cheeseList);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectAlphaRestriction.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectAlphaRestriction.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectAlphaRestriction.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "Collect Alpha Restriction" salience 70
+    when
+    	$cheeseList  : ArrayList(size > 0) from collect( Cheese( type == "stilton" ) );
+    then
+        results.add($cheeseList);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectContainsOperator.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectContainsOperator.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectContainsOperator.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,99 @@
+package org.drools;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.LinkedList;
+
+global java.util.List results;
+
+rule "Collect with memberOf shadow proxy"
+    salience 100
+    dialect "java"
+when
+    $order : Order( number == 1 )
+    $list : ArrayList( this contains $order ) from collect( Order() )
+then
+    results.add( $order );
+end 
+
+rule "Collect with memberOf no shadow proxy"
+    salience 90
+    dialect "java"
+when
+    $item : OrderItem( seq == 1, order.number == 1 )
+    $list : ArrayList( this contains $item.order ) from collect( Order() )
+then
+    results.add( $item );
+end 
+
+rule "Accumulate with memberOf shadow proxy"
+    salience 80
+    dialect "java"
+when
+    $order : Order( number == 2 )
+    $list : List( this contains $order ) from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+then
+    results.add( $order );
+end 
+
+rule "Accumulate with memberOf no shadow proxy"
+    salience 70
+    dialect "java"
+when
+    $item : OrderItem( seq == 1, order.number == 2 )
+    $list : List( this contains $item.order ) from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+then
+    results.add( $item );
+end 
+
+rule "MVEL Collect with memberOf shadow proxy"
+    salience 60
+    dialect "mvel"
+when
+    $order : Order( number == 1 )
+    $list : ArrayList( this contains $order ) from collect( Order() )
+then
+    results.add( $order );
+end 
+
+rule "MVEL Collect with memberOf no shadow proxy"
+    salience 50
+    dialect "mvel"
+when
+    $item : OrderItem( seq == 1, order.number == 1 )
+    $list : ArrayList( this contains $item.order ) from collect( Order() )
+then
+    results.add( $item );
+end 
+
+rule "MVEL Accumulate with memberOf shadow proxy"
+    salience 40
+    dialect "mvel"
+when
+    $order : Order( number == 2 )
+    $list : List( this contains $order ) from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+then
+    results.add( $order );
+end 
+
+rule "MVEL Accumulate with memberOf no shadow proxy"
+    salience 30
+    dialect "mvel"
+when
+    $item : OrderItem( seq == 1, order.number == 2 )
+    $list : List( this contains $item.order ) from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+then
+    results.add( $item );
+end 

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,4 @@
+package org.drools
+
+global java.util.List results
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectDynamicRules2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools
+
+import java.util.ArrayList;
+
+global java.util.List results
+
+rule "Test collect dynamic rule"
+when
+    $list: ArrayList( size > 0 ) from collect( Cheese( type == "stilton" ) )
+then
+    results.add( $list );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectMemberOfOperator.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectMemberOfOperator.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectMemberOfOperator.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,99 @@
+package org.drools;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.LinkedList;
+
+global java.util.List results;
+
+rule "Collect with memberOf shadow proxy"
+    salience 100
+    dialect "java"
+when
+    $list : ArrayList() from collect( Order() )
+    $order : Order( number == 1, this memberOf $list )
+then
+    results.add( $order );
+end 
+
+rule "Collect with memberOf no shadow proxy"
+    salience 90
+    dialect "java"
+when
+    $list : ArrayList() from collect( Order() )
+    $item : OrderItem( seq == 1, order.number == 1, order memberOf $list )
+then
+    results.add( $item );
+end 
+
+rule "Accumulate with memberOf shadow proxy"
+    salience 80
+    dialect "java"
+when
+    $list : List() from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+    $order : Order( number == 2, this memberOf $list )
+then
+    results.add( $order );
+end 
+
+rule "Accumulate with memberOf no shadow proxy"
+    salience 70
+    dialect "java"
+when
+    $list : List() from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+    $item : OrderItem( seq == 1, order.number == 2, order memberOf $list )
+then
+    results.add( $item );
+end 
+
+rule "MVEL Collect with memberOf shadow proxy"
+    salience 60
+    dialect "mvel"
+when
+    $list : ArrayList() from collect( Order() )
+    $order : Order( number == 1, this memberOf $list )
+then
+    results.add( $order );
+end 
+
+rule "MVEL Collect with memberOf no shadow proxy"
+    salience 50
+    dialect "mvel"
+when
+    $list : ArrayList() from collect( Order() )
+    $item : OrderItem( seq == 1, order.number == 1, order memberOf $list )
+then
+    results.add( $item );
+end 
+
+rule "MVEL Accumulate with memberOf shadow proxy"
+    salience 40
+    dialect "mvel"
+when
+    $list : List() from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+    $order : Order( number == 2, this memberOf $list )
+then
+    results.add( $order );
+end 
+
+rule "MVEL Accumulate with memberOf no shadow proxy"
+    salience 30
+    dialect "mvel"
+when
+    $list : List() from accumulate( $o : Order(),
+                                         init( List list = new LinkedList(); ),
+                                         action( list.add( $o ); ),
+                                         result( list ) )
+    $item : OrderItem( seq == 1, order.number == 2, order memberOf $list )
+then
+    results.add( $item );
+end 

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectWithNestedFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectWithNestedFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CollectWithNestedFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools;
+
+import java.util.ArrayList;
+ 
+global java.util.List results;
+
+rule "test collect with nested from"
+	when
+		$cheesery : Cheesery()
+	    $person : Person( $likes : likes )
+		$list : ArrayList() from collect( Cheese( type == $likes ) from $cheesery.getCheeses() )
+	then
+		results.add( $list );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceBuilderException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceBuilderException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceBuilderException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "error compiling consequence"
+	when
+	then
+	    // this must generate a compile error, but not NPE
+	    results.add(message without quotes);
+end
+
+rule "another test"
+    salience 10
+
+   when
+    eval( true ) 
+then
+    System.out.println(1);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConsequenceException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "Throw Consequence Exception"
+    when
+    	cheese : Cheese( )
+    then
+    	throw new Exception( "this should throw an exception" );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintConnectors.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintConnectors.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintConnectors.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,41 @@
+package org.drools
+
+import org.drools.Person;
+
+global java.util.List results;
+
+rule "1. && operator"
+    salience 10
+    when    	
+		$person : Person( age > 30 && < 40 && hair == "red" )		    
+    then
+        results.add( $person );
+end    
+
+rule "2. || operator"
+    salience 8
+    when    	
+		$person : Person( age > 70 && < 90 || hair == "green" )		    
+    then
+        results.add( $person );
+end    
+
+rule "3. Complex expression"
+    salience 7
+    when    	
+		$person : Person( ( age == 70 && hair == "black" ) ||
+		                  ( age == 40 && hair == "pink" ) ||
+		                  ( age == 12 && ( hair == "yellow" || hair == "blue" ) ) )		    
+    then
+        results.add( $person );
+end    
+
+rule "4. Constraint connectors"
+	salience 5
+	when
+	    # forcing a variable restriction so we can trigger the issue reported in JBRULES-909
+	    Person( $age : age == 48, hair == "blue" )  
+		$person : Person( age > $age || hair == "gray" )
+	then
+		results.add( $person );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,711 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>3-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>194</x>
+                  <y>40</y>
+                  <width>163</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.workflow.core.node.ActionNode" id="5">
+                  <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="6">
+                    <dialect>mvel</dialect>
+                    <consequence>outList.add(&quot;MVELCodeConstraint was here&quot;);</consequence>
+                  </action>
+                  <id>3</id>
+                  <name>MVELCodeConstraintAction</name>
+                  <incomingConnections id="7">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="8">
+                        <org.drools.workflow.core.impl.ConnectionImpl id="9">
+                          <from class="org.drools.workflow.core.node.Split" id="10">
+                            <type>3</type>
+                            <constraints id="11">
+                              <entry>
+                                <org.drools.workflow.core.impl.ConnectionImpl id="12">
+                                  <from class="org.drools.workflow.core.node.Split" reference="10"/>
+                                  <to class="org.drools.workflow.core.node.ActionNode" id="13">
+                                    <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="14">
+                                      <dialect>mvel</dialect>
+                                      <consequence>outList.add(&quot;MVELRuleConstraint was here&quot;);</consequence>
+                                    </action>
+                                    <id>6</id>
+                                    <name>MVELRuleConstraintAction</name>
+                                    <incomingConnections id="15">
+                                      <entry>
+                                        <string>DROOLS_DEFAULT</string>
+                                        <list id="16">
+                                          <org.drools.workflow.core.impl.ConnectionImpl reference="12"/>
+                                        </list>
+                                      </entry>
+                                    </incomingConnections>
+                                    <outgoingConnections id="17">
+                                      <entry>
+                                        <string>DROOLS_DEFAULT</string>
+                                        <list id="18">
+                                          <org.drools.workflow.core.impl.ConnectionImpl id="19">
+                                            <from class="org.drools.workflow.core.node.ActionNode" reference="13"/>
+                                            <to class="org.drools.workflow.core.node.Join" id="20">
+                                              <type>1</type>
+                                              <id>7</id>
+                                              <name>Join</name>
+                                              <incomingConnections id="21">
+                                                <entry>
+                                                  <string>DROOLS_DEFAULT</string>
+                                                  <list id="22">
+                                                    <org.drools.workflow.core.impl.ConnectionImpl reference="19"/>
+                                                    <org.drools.workflow.core.impl.ConnectionImpl id="23">
+                                                      <from class="org.drools.workflow.core.node.ActionNode" id="24">
+                                                        <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="25">
+                                                          <dialect>java</dialect>
+                                                          <consequence>outList.add(&quot;JavaRuleConstraint was here&quot;);</consequence>
+                                                        </action>
+                                                        <id>5</id>
+                                                        <name>JavaRuleConstraintAction</name>
+                                                        <incomingConnections id="26">
+                                                          <entry>
+                                                            <string>DROOLS_DEFAULT</string>
+                                                            <list id="27">
+                                                              <org.drools.workflow.core.impl.ConnectionImpl id="28">
+                                                                <from class="org.drools.workflow.core.node.Split" reference="10"/>
+                                                                <to class="org.drools.workflow.core.node.ActionNode" reference="24"/>
+                                                                <fromType>DROOLS_DEFAULT</fromType>
+                                                                <toType>DROOLS_DEFAULT</toType>
+                                                              </org.drools.workflow.core.impl.ConnectionImpl>
+                                                            </list>
+                                                          </entry>
+                                                        </incomingConnections>
+                                                        <outgoingConnections id="29">
+                                                          <entry>
+                                                            <string>DROOLS_DEFAULT</string>
+                                                            <list id="30">
+                                                              <org.drools.workflow.core.impl.ConnectionImpl reference="23"/>
+                                                            </list>
+                                                          </entry>
+                                                        </outgoingConnections>
+                                                        <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="31">
+                                                          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="32">
+                                                            <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                            <nodes id="33">
+                                                              <entry>
+                                                                <long>1</long>
+                                                                <org.drools.workflow.core.node.StartNode id="34">
+                                                                  <id>1</id>
+                                                                  <name>Start</name>
+                                                                  <incomingConnections id="35"/>
+                                                                  <outgoingConnections id="36">
+                                                                    <entry>
+                                                                      <string>DROOLS_DEFAULT</string>
+                                                                      <list id="37">
+                                                                        <org.drools.workflow.core.impl.ConnectionImpl id="38">
+                                                                          <from class="org.drools.workflow.core.node.StartNode" reference="34"/>
+                                                                          <to class="org.drools.workflow.core.node.Split" reference="10"/>
+                                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                                          <toType>DROOLS_DEFAULT</toType>
+                                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                      </list>
+                                                                    </entry>
+                                                                  </outgoingConnections>
+                                                                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                                </org.drools.workflow.core.node.StartNode>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>2</long>
+                                                                <org.drools.workflow.core.node.Split reference="10"/>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>3</long>
+                                                                <org.drools.workflow.core.node.ActionNode reference="5"/>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>4</long>
+                                                                <org.drools.workflow.core.node.ActionNode id="39">
+                                                                  <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="40">
+                                                                    <dialect>mvel</dialect>
+                                                                    <consequence>outList.add(&quot;JavaCodeConstraint was here&quot;);</consequence>
+                                                                  </action>
+                                                                  <id>4</id>
+                                                                  <name>JavaCodeConstraintAction</name>
+                                                                  <incomingConnections id="41">
+                                                                    <entry>
+                                                                      <string>DROOLS_DEFAULT</string>
+                                                                      <list id="42">
+                                                                        <org.drools.workflow.core.impl.ConnectionImpl id="43">
+                                                                          <from class="org.drools.workflow.core.node.Split" reference="10"/>
+                                                                          <to class="org.drools.workflow.core.node.ActionNode" reference="39"/>
+                                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                                          <toType>DROOLS_DEFAULT</toType>
+                                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                      </list>
+                                                                    </entry>
+                                                                  </incomingConnections>
+                                                                  <outgoingConnections id="44">
+                                                                    <entry>
+                                                                      <string>DROOLS_DEFAULT</string>
+                                                                      <list id="45">
+                                                                        <org.drools.workflow.core.impl.ConnectionImpl id="46">
+                                                                          <from class="org.drools.workflow.core.node.ActionNode" reference="39"/>
+                                                                          <to class="org.drools.workflow.core.node.Join" reference="20"/>
+                                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                                          <toType>DROOLS_DEFAULT</toType>
+                                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                      </list>
+                                                                    </entry>
+                                                                  </outgoingConnections>
+                                                                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                                </org.drools.workflow.core.node.ActionNode>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>5</long>
+                                                                <org.drools.workflow.core.node.ActionNode reference="24"/>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>6</long>
+                                                                <org.drools.workflow.core.node.ActionNode reference="13"/>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>7</long>
+                                                                <org.drools.workflow.core.node.Join reference="20"/>
+                                                              </entry>
+                                                              <entry>
+                                                                <long>8</long>
+                                                                <org.drools.workflow.core.node.EndNode id="47">
+                                                                  <id>8</id>
+                                                                  <name>End</name>
+                                                                  <incomingConnections id="48">
+                                                                    <entry>
+                                                                      <string>DROOLS_DEFAULT</string>
+                                                                      <list id="49">
+                                                                        <org.drools.workflow.core.impl.ConnectionImpl id="50">
+                                                                          <from class="org.drools.workflow.core.node.Join" reference="20"/>
+                                                                          <to class="org.drools.workflow.core.node.EndNode" reference="47"/>
+                                                                          <fromType>DROOLS_DEFAULT</fromType>
+                                                                          <toType>DROOLS_DEFAULT</toType>
+                                                                        </org.drools.workflow.core.impl.ConnectionImpl>
+                                                                      </list>
+                                                                    </entry>
+                                                                  </incomingConnections>
+                                                                  <outgoingConnections id="51"/>
+                                                                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                                </org.drools.workflow.core.node.EndNode>
+                                                              </entry>
+                                                            </nodes>
+                                                            <lastNodeId>8</lastNodeId>
+                                                          </nodeContainer>
+                                                          <imports id="52">
+                                                            <string>java.util.List</string>
+                                                          </imports>
+                                                          <globals id="53">
+                                                            <entry>
+                                                              <string>inList</string>
+                                                              <string>List</string>
+                                                            </entry>
+                                                            <entry>
+                                                              <string>outList</string>
+                                                              <string>List</string>
+                                                            </entry>
+                                                          </globals>
+                                                          <id>ConstraintDialects</id>
+                                                          <name>ConstraintDialects</name>
+                                                          <type>RuleFlow</type>
+                                                          <packageName>org.drools.test</packageName>
+                                                          <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="54">
+                                                            <variables id="55"/>
+                                                          </variableScope>
+                                                        </nodeContainer>
+                                                      </from>
+                                                      <to class="org.drools.workflow.core.node.Join" reference="20"/>
+                                                      <fromType>DROOLS_DEFAULT</fromType>
+                                                      <toType>DROOLS_DEFAULT</toType>
+                                                    </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    <org.drools.workflow.core.impl.ConnectionImpl reference="46"/>
+                                                    <org.drools.workflow.core.impl.ConnectionImpl id="56">
+                                                      <from class="org.drools.workflow.core.node.ActionNode" reference="5"/>
+                                                      <to class="org.drools.workflow.core.node.Join" reference="20"/>
+                                                      <fromType>DROOLS_DEFAULT</fromType>
+                                                      <toType>DROOLS_DEFAULT</toType>
+                                                    </org.drools.workflow.core.impl.ConnectionImpl>
+                                                  </list>
+                                                </entry>
+                                              </incomingConnections>
+                                              <outgoingConnections id="57">
+                                                <entry>
+                                                  <string>DROOLS_DEFAULT</string>
+                                                  <list id="58">
+                                                    <org.drools.workflow.core.impl.ConnectionImpl reference="50"/>
+                                                  </list>
+                                                </entry>
+                                              </outgoingConnections>
+                                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                            </to>
+                                            <fromType>DROOLS_DEFAULT</fromType>
+                                            <toType>DROOLS_DEFAULT</toType>
+                                          </org.drools.workflow.core.impl.ConnectionImpl>
+                                        </list>
+                                      </entry>
+                                    </outgoingConnections>
+                                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                  </to>
+                                  <fromType>DROOLS_DEFAULT</fromType>
+                                  <toType>DROOLS_DEFAULT</toType>
+                                </org.drools.workflow.core.impl.ConnectionImpl>
+                                <org.drools.workflow.core.impl.ConstraintImpl id="59">
+                                  <name>MVELRuleConstraint</name>
+                                  <constraint>list : List()&#x0D;
+eval( list.contains( 6 ) )</constraint>
+                                  <priority>6</priority>
+                                  <dialect>mvel</dialect>
+                                  <type>rule</type>
+                                </org.drools.workflow.core.impl.ConstraintImpl>
+                              </entry>
+                              <entry>
+                                <org.drools.workflow.core.impl.ConnectionImpl reference="9"/>
+                                <org.drools.workflow.core.impl.ConstraintImpl id="60">
+                                  <name>MVELCodeConstraint</name>
+                                  <constraint>return inList.contains( 1 );</constraint>
+                                  <priority>1</priority>
+                                  <dialect>mvel</dialect>
+                                  <type>code</type>
+                                </org.drools.workflow.core.impl.ConstraintImpl>
+                              </entry>
+                              <entry>
+                                <org.drools.workflow.core.impl.ConnectionImpl reference="28"/>
+                                <org.drools.workflow.core.impl.ConstraintImpl id="61">
+                                  <name>JavaRuleConstraint</name>
+                                  <constraint>list : List()&#x0D;
+eval( list.contains( 25 ) )</constraint>
+                                  <priority>25</priority>
+                                  <dialect>java</dialect>
+                                  <type>rule</type>
+                                </org.drools.workflow.core.impl.ConstraintImpl>
+                              </entry>
+                              <entry>
+                                <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
+                                <org.drools.workflow.core.impl.ConstraintImpl id="62">
+                                  <name>JavaCodeConstraint</name>
+                                  <constraint>return inList.contains( 3 );</constraint>
+                                  <priority>3</priority>
+                                  <dialect>java</dialect>
+                                  <type>code</type>
+                                </org.drools.workflow.core.impl.ConstraintImpl>
+                              </entry>
+                            </constraints>
+                            <id>2</id>
+                            <name>Split</name>
+                            <incomingConnections id="63">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="64">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="38"/>
+                                </list>
+                              </entry>
+                            </incomingConnections>
+                            <outgoingConnections id="65">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="66">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="9"/>
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="28"/>
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="12"/>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                          </from>
+                          <to class="org.drools.workflow.core.node.ActionNode" reference="5"/>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                      </list>
+                    </entry>
+                  </incomingConnections>
+                  <outgoingConnections id="67">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="68">
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="56"/>
+                      </list>
+                    </entry>
+                  </outgoingConnections>
+                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                </element>
+                <incomingConnections id="69">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="70" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="71"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" id="72" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="73">
+                                <x>121</x>
+                                <y>101</y>
+                                <width>48</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.Split" reference="10"/>
+                              <incomingConnections id="74">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="75" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <bendpoints id="76"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="77" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="78">
+                                              <x>19</x>
+                                              <y>100</y>
+                                              <width>80</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.workflow.core.node.StartNode" reference="34"/>
+                                            <incomingConnections id="79"/>
+                                            <outgoingConnections id="80">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="75"/>
+                                            </outgoingConnections>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </source>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="72"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection reference="38"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </incomingConnections>
+                              <outgoingConnections id="81">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="70"/>
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="82" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <bendpoints id="83"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="72"/>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="84" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="85">
+                                              <x>194</x>
+                                              <y>104</y>
+                                              <width>165</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.workflow.core.node.ActionNode" reference="39"/>
+                                            <incomingConnections id="86">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="82"/>
+                                            </incomingConnections>
+                                            <outgoingConnections id="87">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="88" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <bendpoints id="89"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="84"/>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" id="90" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="91">
+                                                            <x>399</x>
+                                                            <y>101</y>
+                                                            <width>51</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.workflow.core.node.Join" reference="20"/>
+                                                          <incomingConnections id="92">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="93" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <bendpoints id="94"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="95" serialization="custom">
+                                                                    <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                      <default>
+                                                                        <constraint id="96">
+                                                                          <x>196</x>
+                                                                          <y>228</y>
+                                                                          <width>165</width>
+                                                                          <height>40</height>
+                                                                        </constraint>
+                                                                        <element class="org.drools.workflow.core.node.ActionNode" reference="13"/>
+                                                                        <incomingConnections id="97">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="98" serialization="custom">
+                                                                            <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                              <default>
+                                                                                <bendpoints id="99"/>
+                                                                                <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="72"/>
+                                                                                <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="95"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                              <default>
+                                                                                <connection reference="12"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                        </incomingConnections>
+                                                                        <outgoingConnections id="100">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="93"/>
+                                                                        </outgoingConnections>
+                                                                        <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                    <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                                      <default>
+                                                                        <descriptors id="101">
+                                                                          <org.eclipse.ui.views.properties.TextPropertyDescriptor id="102">
+                                                                            <id class="string">Name</id>
+                                                                            <display>Name</display>
+                                                                            <incompatible>false</incompatible>
+                                                                          </org.eclipse.ui.views.properties.TextPropertyDescriptor>
+                                                                          <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="103">
+                                                                            <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                                            <actionNode reference="13"/>
+                                                                            <id class="string">Action</id>
+                                                                            <display>Action</display>
+                                                                            <incompatible>false</incompatible>
+                                                                          </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                                                        </descriptors>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                                  </source>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="90"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection reference="19"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="104" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <bendpoints id="105"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="106" serialization="custom">
+                                                                    <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                      <default>
+                                                                        <constraint id="107">
+                                                                          <x>196</x>
+                                                                          <y>167</y>
+                                                                          <width>165</width>
+                                                                          <height>40</height>
+                                                                        </constraint>
+                                                                        <element class="org.drools.workflow.core.node.ActionNode" reference="24"/>
+                                                                        <incomingConnections id="108">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="109" serialization="custom">
+                                                                            <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                              <default>
+                                                                                <bendpoints id="110"/>
+                                                                                <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="72"/>
+                                                                                <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="106"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                              <default>
+                                                                                <connection reference="28"/>
+                                                                              </default>
+                                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                          </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                        </incomingConnections>
+                                                                        <outgoingConnections id="111">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="104"/>
+                                                                        </outgoingConnections>
+                                                                        <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                    <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                                      <default>
+                                                                        <descriptors id="112">
+                                                                          <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="102"/>
+                                                                          <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="113">
+                                                                            <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                                            <actionNode reference="24"/>
+                                                                            <id class="string">Action</id>
+                                                                            <display>Action</display>
+                                                                            <incompatible>false</incompatible>
+                                                                          </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                                                        </descriptors>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                                  </source>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="90"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection reference="23"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="88"/>
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="114" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <bendpoints id="115"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="90"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection reference="56"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="116">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="117" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <bendpoints id="118"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="90"/>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="119" serialization="custom">
+                                                                    <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                      <default>
+                                                                        <constraint id="120">
+                                                                          <x>480</x>
+                                                                          <y>100</y>
+                                                                          <width>80</width>
+                                                                          <height>40</height>
+                                                                        </constraint>
+                                                                        <element class="org.drools.workflow.core.node.EndNode" reference="47"/>
+                                                                        <incomingConnections id="121">
+                                                                          <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="117"/>
+                                                                        </incomingConnections>
+                                                                        <outgoingConnections id="122"/>
+                                                                        <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                                      </default>
+                                                                    </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                                  </target>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection reference="50"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </outgoingConnections>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                    </target>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection reference="46"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                            </outgoingConnections>
+                                            <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                        <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                          <default>
+                                            <descriptors id="123">
+                                              <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="102"/>
+                                              <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="124">
+                                                <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                                                <actionNode reference="39"/>
+                                                <id class="string">Action</id>
+                                                <display>Action</display>
+                                                <incompatible>false</incompatible>
+                                              </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                            </descriptors>
+                                          </default>
+                                        </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                      </target>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection reference="43"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="109"/>
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="98"/>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                          <org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+                            <default/>
+                          </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="9"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="125">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="114"/>
+                </outgoingConnections>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+            <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+              <default>
+                <descriptors id="126">
+                  <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="102"/>
+                  <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="127">
+                    <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+                    <actionNode reference="5"/>
+                    <id class="string">Action</id>
+                    <display>Action</display>
+                    <incompatible>false</incompatible>
+                  </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                </descriptors>
+              </default>
+            </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+        </entry>
+        <entry>
+          <string>4-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="84"/>
+        </entry>
+        <entry>
+          <string>7-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.JoinWrapper reference="90"/>
+        </entry>
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.SplitWrapper reference="72"/>
+        </entry>
+        <entry>
+          <string>8-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="119"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="77"/>
+        </entry>
+        <entry>
+          <string>6-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="95"/>
+        </entry>
+        <entry>
+          <string>5-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="106"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="31"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,324 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.Split" id="9">
+                    <type>3</type>
+                    <constraints id="10">
+                      <entry>
+                        <org.drools.workflow.core.impl.ConnectionImpl id="11">
+                          <from class="org.drools.workflow.core.node.Split" reference="9"/>
+                          <to class="org.drools.workflow.core.node.ActionNode" id="12">
+                            <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="13">
+                              <dialect>mvel</dialect>
+                              <consequence>outList.add(&quot;MVELRuleConstraint was here&quot;);</consequence>
+                            </action>
+                            <id>6</id>
+                            <name>MVELRuleConstraintAction</name>
+                            <incomingConnections id="14">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="15">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="11"/>
+                                </list>
+                              </entry>
+                            </incomingConnections>
+                            <outgoingConnections id="16">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="17">
+                                  <org.drools.workflow.core.impl.ConnectionImpl id="18">
+                                    <from class="org.drools.workflow.core.node.ActionNode" reference="12"/>
+                                    <to class="org.drools.workflow.core.node.Join" id="19">
+                                      <type>1</type>
+                                      <id>7</id>
+                                      <name>Join</name>
+                                      <incomingConnections id="20">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="21">
+                                            <org.drools.workflow.core.impl.ConnectionImpl reference="18"/>
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="22">
+                                              <from class="org.drools.workflow.core.node.ActionNode" id="23">
+                                                <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="24">
+                                                  <dialect>java</dialect>
+                                                  <consequence>outList.add(&quot;JavaRuleConstraint was here&quot;);</consequence>
+                                                </action>
+                                                <id>5</id>
+                                                <name>JavaRuleConstraintAction</name>
+                                                <incomingConnections id="25">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="26">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl id="27">
+                                                        <from class="org.drools.workflow.core.node.Split" reference="9"/>
+                                                        <to class="org.drools.workflow.core.node.ActionNode" reference="23"/>
+                                                        <fromType>DROOLS_DEFAULT</fromType>
+                                                        <toType>DROOLS_DEFAULT</toType>
+                                                      </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="28">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="29">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl reference="22"/>
+                                                    </list>
+                                                  </entry>
+                                                </outgoingConnections>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                              </from>
+                                              <to class="org.drools.workflow.core.node.Join" reference="19"/>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="30">
+                                              <from class="org.drools.workflow.core.node.ActionNode" id="31">
+                                                <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="32">
+                                                  <dialect>mvel</dialect>
+                                                  <consequence>outList.add(&quot;JavaCodeConstraint was here&quot;);</consequence>
+                                                </action>
+                                                <id>4</id>
+                                                <name>JavaCodeConstraintAction</name>
+                                                <incomingConnections id="33">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="34">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl id="35">
+                                                        <from class="org.drools.workflow.core.node.Split" reference="9"/>
+                                                        <to class="org.drools.workflow.core.node.ActionNode" reference="31"/>
+                                                        <fromType>DROOLS_DEFAULT</fromType>
+                                                        <toType>DROOLS_DEFAULT</toType>
+                                                      </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="36">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="37">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl reference="30"/>
+                                                    </list>
+                                                  </entry>
+                                                </outgoingConnections>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                              </from>
+                                              <to class="org.drools.workflow.core.node.Join" reference="19"/>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="38">
+                                              <from class="org.drools.workflow.core.node.ActionNode" id="39">
+                                                <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="40">
+                                                  <dialect>mvel</dialect>
+                                                  <consequence>outList.add(&quot;MVELCodeConstraint was here&quot;);</consequence>
+                                                </action>
+                                                <id>3</id>
+                                                <name>MVELCodeConstraintAction</name>
+                                                <incomingConnections id="41">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="42">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl id="43">
+                                                        <from class="org.drools.workflow.core.node.Split" reference="9"/>
+                                                        <to class="org.drools.workflow.core.node.ActionNode" reference="39"/>
+                                                        <fromType>DROOLS_DEFAULT</fromType>
+                                                        <toType>DROOLS_DEFAULT</toType>
+                                                      </org.drools.workflow.core.impl.ConnectionImpl>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="44">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="45">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl reference="38"/>
+                                                    </list>
+                                                  </entry>
+                                                </outgoingConnections>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                              </from>
+                                              <to class="org.drools.workflow.core.node.Join" reference="19"/>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                          </list>
+                                        </entry>
+                                      </incomingConnections>
+                                      <outgoingConnections id="46">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="47">
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="48">
+                                              <from class="org.drools.workflow.core.node.Join" reference="19"/>
+                                              <to class="org.drools.workflow.core.node.EndNode" id="49">
+                                                <id>8</id>
+                                                <name>End</name>
+                                                <incomingConnections id="50">
+                                                  <entry>
+                                                    <string>DROOLS_DEFAULT</string>
+                                                    <list id="51">
+                                                      <org.drools.workflow.core.impl.ConnectionImpl reference="48"/>
+                                                    </list>
+                                                  </entry>
+                                                </incomingConnections>
+                                                <outgoingConnections id="52"/>
+                                                <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                              </to>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                          </list>
+                                        </entry>
+                                      </outgoingConnections>
+                                      <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                                    </to>
+                                    <fromType>DROOLS_DEFAULT</fromType>
+                                    <toType>DROOLS_DEFAULT</toType>
+                                  </org.drools.workflow.core.impl.ConnectionImpl>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                          </to>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                        <org.drools.workflow.core.impl.ConstraintImpl id="53">
+                          <name>MVELRuleConstraint</name>
+                          <constraint>list : List()&#x0D;
+eval( list.contains( 6 ) )</constraint>
+                          <priority>6</priority>
+                          <dialect>mvel</dialect>
+                          <type>rule</type>
+                        </org.drools.workflow.core.impl.ConstraintImpl>
+                      </entry>
+                      <entry>
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
+                        <org.drools.workflow.core.impl.ConstraintImpl id="54">
+                          <name>MVELCodeConstraint</name>
+                          <constraint>return inList.contains( 1 );</constraint>
+                          <priority>1</priority>
+                          <dialect>mvel</dialect>
+                          <type>code</type>
+                        </org.drools.workflow.core.impl.ConstraintImpl>
+                      </entry>
+                      <entry>
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
+                        <org.drools.workflow.core.impl.ConstraintImpl id="55">
+                          <name>JavaRuleConstraint</name>
+                          <constraint>list : List()&#x0D;
+eval( list.contains( 25 ) )</constraint>
+                          <priority>25</priority>
+                          <dialect>java</dialect>
+                          <type>rule</type>
+                        </org.drools.workflow.core.impl.ConstraintImpl>
+                      </entry>
+                      <entry>
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
+                        <org.drools.workflow.core.impl.ConstraintImpl id="56">
+                          <name>JavaCodeConstraint</name>
+                          <constraint>return inList.contains( 3 );</constraint>
+                          <priority>3</priority>
+                          <dialect>java</dialect>
+                          <type>code</type>
+                        </org.drools.workflow.core.impl.ConstraintImpl>
+                      </entry>
+                    </constraints>
+                    <id>2</id>
+                    <name>Split</name>
+                    <incomingConnections id="57">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="58">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="59">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="60">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="11"/>
+                        </list>
+                      </entry>
+                    </outgoingConnections>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.Split reference="9"/>
+      </entry>
+      <entry>
+        <long>3</long>
+        <org.drools.workflow.core.node.ActionNode reference="39"/>
+      </entry>
+      <entry>
+        <long>4</long>
+        <org.drools.workflow.core.node.ActionNode reference="31"/>
+      </entry>
+      <entry>
+        <long>5</long>
+        <org.drools.workflow.core.node.ActionNode reference="23"/>
+      </entry>
+      <entry>
+        <long>6</long>
+        <org.drools.workflow.core.node.ActionNode reference="12"/>
+      </entry>
+      <entry>
+        <long>7</long>
+        <org.drools.workflow.core.node.Join reference="19"/>
+      </entry>
+      <entry>
+        <long>8</long>
+        <org.drools.workflow.core.node.EndNode reference="49"/>
+      </entry>
+    </nodes>
+    <lastNodeId>8</lastNodeId>
+  </nodeContainer>
+  <imports id="61">
+    <string>java.util.List</string>
+  </imports>
+  <globals id="62">
+    <entry>
+      <string>inList</string>
+      <string>List</string>
+    </entry>
+    <entry>
+      <string>outList</string>
+      <string>List</string>
+    </entry>
+  </globals>
+  <id>ConstraintDialects</id>
+  <name>ConstraintDialects</name>
+  <type>RuleFlow</type>
+  <packageName>org.drools.test</packageName>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="63">
+    <variables id="64"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,628 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>5-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.SplitWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>259</x>
+                  <y>112</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.ruleflow.core.impl.SplitImpl" id="5">
+                  <type>3</type>
+                  <constraints id="6">
+                    <entry>
+                      <org.drools.ruleflow.core.impl.ConnectionImpl id="7">
+                        <type>1</type>
+                        <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+                        <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="8">
+                          <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="9">
+                            <dialect>java</dialect>
+                            <consequence>outList.add(&quot;JavaCodeConstraint was here&quot;);</consequence>
+                          </action>
+                          <id>7</id>
+                          <name>JavaCodeConstraintAction</name>
+                          <incomingConnections id="10">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
+                          </incomingConnections>
+                          <outgoingConnections id="11">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl id="12">
+                              <type>1</type>
+                              <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+                              <to class="org.drools.ruleflow.core.impl.JoinImpl" id="13">
+                                <type>1</type>
+                                <id>10</id>
+                                <name>Join</name>
+                                <incomingConnections id="14">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="15">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="16">
+                                      <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="17">
+                                        <dialect>mvel</dialect>
+                                        <consequence>outList.add(&quot;MVELCodeConstraint was here&quot;);</consequence>
+                                      </action>
+                                      <id>6</id>
+                                      <name>MVELCodeConstraintAction</name>
+                                      <incomingConnections id="18">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl id="19">
+                                          <type>1</type>
+                                          <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+                                          <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+                                        </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                      </incomingConnections>
+                                      <outgoingConnections id="20">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+                                      </outgoingConnections>
+                                    </from>
+                                    <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="21">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="22">
+                                      <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="23">
+                                        <dialect>mvel</dialect>
+                                        <consequence>outList.add(&quot;MVELRuleConstraint was here&quot;);</consequence>
+                                      </action>
+                                      <id>8</id>
+                                      <name>MVELRuleConstraintAction</name>
+                                      <incomingConnections id="24">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl id="25">
+                                          <type>1</type>
+                                          <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+                                          <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+                                        </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                      </incomingConnections>
+                                      <outgoingConnections id="26">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl reference="21"/>
+                                      </outgoingConnections>
+                                    </from>
+                                    <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="27">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="28">
+                                      <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="29">
+                                        <dialect>java</dialect>
+                                        <consequence>outList.add(&quot;JavaRuleConstraint was here&quot;);</consequence>
+                                      </action>
+                                      <id>9</id>
+                                      <name>JavaRuleConstraintAction</name>
+                                      <incomingConnections id="30">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl id="31">
+                                          <type>1</type>
+                                          <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+                                          <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+                                        </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                      </incomingConnections>
+                                      <outgoingConnections id="32">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl reference="27"/>
+                                      </outgoingConnections>
+                                    </from>
+                                    <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                </incomingConnections>
+                                <outgoingConnections id="33">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl id="34">
+                                    <type>1</type>
+                                    <from class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+                                    <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="35">
+                                      <id>4</id>
+                                      <name>End</name>
+                                      <incomingConnections id="36">
+                                        <org.drools.ruleflow.core.impl.ConnectionImpl reference="34"/>
+                                      </incomingConnections>
+                                      <outgoingConnections id="37"/>
+                                    </to>
+                                  </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                </outgoingConnections>
+                              </to>
+                            </org.drools.ruleflow.core.impl.ConnectionImpl>
+                          </outgoingConnections>
+                        </to>
+                      </org.drools.ruleflow.core.impl.ConnectionImpl>
+                      <org.drools.ruleflow.core.impl.ConstraintImpl id="38">
+                        <name>JavaCodeConstraint</name>
+                        <constraint>return inList.contains( 3 );</constraint>
+                        <priority>3</priority>
+                        <dialect>java</dialect>
+                        <type>eval</type>
+                      </org.drools.ruleflow.core.impl.ConstraintImpl>
+                    </entry>
+                    <entry>
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="31"/>
+                      <org.drools.ruleflow.core.impl.ConstraintImpl id="39">
+                        <name>JavaRuleConstraint</name>
+                        <constraint>list : List()&#x0D;
+eval( list.contains( 25 ) )</constraint>
+                        <priority>25</priority>
+                        <dialect>java</dialect>
+                        <type>rule</type>
+                      </org.drools.ruleflow.core.impl.ConstraintImpl>
+                    </entry>
+                    <entry>
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="25"/>
+                      <org.drools.ruleflow.core.impl.ConstraintImpl id="40">
+                        <name>MVELRuleConstraint</name>
+                        <constraint>list : List()&#x0D;
+eval( list.contains( 6 ) )</constraint>
+                        <priority>6</priority>
+                        <dialect>mvel</dialect>
+                        <type>rule</type>
+                      </org.drools.ruleflow.core.impl.ConstraintImpl>
+                    </entry>
+                    <entry>
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="19"/>
+                      <org.drools.ruleflow.core.impl.ConstraintImpl id="41">
+                        <name>MVELCodeConstraint</name>
+                        <constraint>return inList.contains( 1 );</constraint>
+                        <priority>1</priority>
+                        <dialect>mvel</dialect>
+                        <type>eval</type>
+                      </org.drools.ruleflow.core.impl.ConstraintImpl>
+                    </entry>
+                  </constraints>
+                  <id>5</id>
+                  <name>Split</name>
+                  <incomingConnections id="42">
+                    <org.drools.ruleflow.core.impl.ConnectionImpl id="43">
+                      <type>1</type>
+                      <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="44">
+                        <id>1</id>
+                        <name>Start</name>
+                        <incomingConnections id="45"/>
+                        <outgoingConnections id="46">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl reference="43"/>
+                        </outgoingConnections>
+                      </from>
+                      <to class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                  </incomingConnections>
+                  <outgoingConnections id="47">
+                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="19"/>
+                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
+                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="25"/>
+                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="31"/>
+                  </outgoingConnections>
+                </element>
+                <incomingConnections id="48">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="49" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <type>1</type>
+                        <bendpoints id="50"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="51" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="52">
+                                <x>259</x>
+                                <y>12</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="44"/>
+                              <incomingConnections id="53"/>
+                              <outgoingConnections id="54">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="49"/>
+                              </outgoingConnections>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="43"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="55">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="56" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <type>1</type>
+                        <bendpoints id="57"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="58" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="59">
+                                <x>11</x>
+                                <y>279</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+                              <incomingConnections id="60">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="56"/>
+                              </incomingConnections>
+                              <outgoingConnections id="61">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="62" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <type>1</type>
+                                      <bendpoints id="63"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="58"/>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" id="64" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="65">
+                                              <x>259</x>
+                                              <y>451</y>
+                                              <width>80</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+                                            <incomingConnections id="66">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="62"/>
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="67" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <type>1</type>
+                                                    <bendpoints id="68"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="69" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="70">
+                                                            <x>193</x>
+                                                            <y>279</y>
+                                                            <width>80</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+                                                          <incomingConnections id="71">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="72" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <type>1</type>
+                                                                  <bendpoints id="73"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="69"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="7"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="74">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="67"/>
+                                                          </outgoingConnections>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                      <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                        <default>
+                                                          <descriptors id="75">
+                                                            <org.eclipse.ui.views.properties.TextPropertyDescriptor id="76">
+                                                              <id class="string">Name</id>
+                                                              <display>Name</display>
+                                                              <incompatible>false</incompatible>
+                                                            </org.eclipse.ui.views.properties.TextPropertyDescriptor>
+                                                            <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="77">
+                                                              <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" id="78">
+                                                                <nodes id="79">
+                                                                  <entry>
+                                                                    <long>4</long>
+                                                                    <org.drools.ruleflow.core.impl.EndNodeImpl reference="35"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>8</long>
+                                                                    <org.drools.ruleflow.core.impl.ActionNodeImpl reference="22"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>9</long>
+                                                                    <org.drools.ruleflow.core.impl.ActionNodeImpl reference="28"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>6</long>
+                                                                    <org.drools.ruleflow.core.impl.ActionNodeImpl reference="16"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>1</long>
+                                                                    <org.drools.ruleflow.core.impl.StartNodeImpl reference="44"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>7</long>
+                                                                    <org.drools.ruleflow.core.impl.ActionNodeImpl reference="8"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>10</long>
+                                                                    <org.drools.ruleflow.core.impl.JoinImpl reference="13"/>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <long>5</long>
+                                                                    <org.drools.ruleflow.core.impl.SplitImpl reference="5"/>
+                                                                  </entry>
+                                                                </nodes>
+                                                                <variables id="80"/>
+                                                                <lastNodeId>10</lastNodeId>
+                                                                <imports id="81">
+                                                                  <string>java.util.List</string>
+                                                                </imports>
+                                                                <globals id="82">
+                                                                  <entry>
+                                                                    <string>inList</string>
+                                                                    <string>List</string>
+                                                                  </entry>
+                                                                  <entry>
+                                                                    <string>outList</string>
+                                                                    <string>List</string>
+                                                                  </entry>
+                                                                </globals>
+                                                                <id>ConstraintDialects</id>
+                                                                <name>ConstraintDialects</name>
+                                                                <type>RuleFlow</type>
+                                                                <packageName>org.drools.test</packageName>
+                                                              </process>
+                                                              <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+                                                              <id class="string">Action</id>
+                                                              <display>Action</display>
+                                                              <incompatible>false</incompatible>
+                                                            </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                                          </descriptors>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                    </source>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="12"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="83" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <type>1</type>
+                                                    <bendpoints id="84"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="85" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="86">
+                                                            <x>327</x>
+                                                            <y>279</y>
+                                                            <width>80</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+                                                          <incomingConnections id="87">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="88" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <type>1</type>
+                                                                  <bendpoints id="89"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="85"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="25"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="90">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="83"/>
+                                                          </outgoingConnections>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                      <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                        <default>
+                                                          <descriptors id="91">
+                                                            <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+                                                            <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="92">
+                                                              <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+                                                              <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+                                                              <id class="string">Action</id>
+                                                              <display>Action</display>
+                                                              <incompatible>false</incompatible>
+                                                            </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                                          </descriptors>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                    </source>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="21"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="93" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <type>1</type>
+                                                    <bendpoints id="94"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="95" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="96">
+                                                            <x>505</x>
+                                                            <y>279</y>
+                                                            <width>80</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+                                                          <incomingConnections id="97">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="98" serialization="custom">
+                                                              <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                                <default>
+                                                                  <type>1</type>
+                                                                  <bendpoints id="99"/>
+                                                                  <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+                                                                  <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="95"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                                <default>
+                                                                  <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="31"/>
+                                                                </default>
+                                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                            </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="100">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="93"/>
+                                                          </outgoingConnections>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                      <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                        <default>
+                                                          <descriptors id="101">
+                                                            <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+                                                            <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="102">
+                                                              <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+                                                              <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+                                                              <id class="string">Action</id>
+                                                              <display>Action</display>
+                                                              <incompatible>false</incompatible>
+                                                            </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                                                          </descriptors>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                                                    </source>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="27"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                            </incomingConnections>
+                                            <outgoingConnections id="103">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="104" serialization="custom">
+                                                <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                  <default>
+                                                    <type>1</type>
+                                                    <bendpoints id="105"/>
+                                                    <source class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+                                                    <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="106" serialization="custom">
+                                                      <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                        <default>
+                                                          <constraint id="107">
+                                                            <x>259</x>
+                                                            <y>556</y>
+                                                            <width>80</width>
+                                                            <height>40</height>
+                                                          </constraint>
+                                                          <element class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="35"/>
+                                                          <incomingConnections id="108">
+                                                            <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="104"/>
+                                                          </incomingConnections>
+                                                          <outgoingConnections id="109"/>
+                                                          <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                                        </default>
+                                                      </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                                    </target>
+                                                  </default>
+                                                </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                                  <default>
+                                                    <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="34"/>
+                                                  </default>
+                                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                              </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                            </outgoingConnections>
+                                            <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </target>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="15"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                            <default>
+                              <descriptors id="110">
+                                <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+                                <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="111">
+                                  <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+                                  <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+                                  <id class="string">Action</id>
+                                  <display>Action</display>
+                                  <incompatible>false</incompatible>
+                                </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+                              </descriptors>
+                            </default>
+                          </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+                        </target>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="19"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="72"/>
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="88"/>
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="98"/>
+                </outgoingConnections>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+            <org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+              <default/>
+            </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+        </entry>
+        <entry>
+          <string>9-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="95"/>
+        </entry>
+        <entry>
+          <string>7-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="69"/>
+        </entry>
+        <entry>
+          <string>4-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="106"/>
+        </entry>
+        <entry>
+          <string>6-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="58"/>
+        </entry>
+        <entry>
+          <string>10-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.JoinWrapper reference="64"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="51"/>
+        </entry>
+        <entry>
+          <string>8-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="85"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ConstraintDialects_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,231 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>4</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl id="3">
+        <id>4</id>
+        <name>End</name>
+        <incomingConnections id="4">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="5">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.JoinImpl" id="6">
+              <type>1</type>
+              <id>10</id>
+              <name>Join</name>
+              <incomingConnections id="7">
+                <org.drools.ruleflow.core.impl.ConnectionImpl id="8">
+                  <type>1</type>
+                  <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="9">
+                    <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="10">
+                      <dialect>mvel</dialect>
+                      <consequence>outList.add(&quot;MVELCodeConstraint was here&quot;);</consequence>
+                    </action>
+                    <id>6</id>
+                    <name>MVELCodeConstraintAction</name>
+                    <incomingConnections id="11">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl id="12">
+                        <type>1</type>
+                        <from class="org.drools.ruleflow.core.impl.SplitImpl" id="13">
+                          <type>3</type>
+                          <constraints id="14">
+                            <entry>
+                              <org.drools.ruleflow.core.impl.ConnectionImpl id="15">
+                                <type>1</type>
+                                <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+                                <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="16">
+                                  <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="17">
+                                    <dialect>java</dialect>
+                                    <consequence>outList.add(&quot;JavaCodeConstraint was here&quot;);</consequence>
+                                  </action>
+                                  <id>7</id>
+                                  <name>JavaCodeConstraintAction</name>
+                                  <incomingConnections id="18">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+                                  </incomingConnections>
+                                  <outgoingConnections id="19">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl id="20">
+                                      <type>1</type>
+                                      <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+                                      <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+                                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                  </outgoingConnections>
+                                </to>
+                              </org.drools.ruleflow.core.impl.ConnectionImpl>
+                              <org.drools.ruleflow.core.impl.ConstraintImpl id="21">
+                                <name>JavaCodeConstraint</name>
+                                <constraint>return inList.contains( 3 );</constraint>
+                                <priority>3</priority>
+                                <dialect>java</dialect>
+                                <type>code</type>
+                              </org.drools.ruleflow.core.impl.ConstraintImpl>
+                            </entry>
+                            <entry>
+                              <org.drools.ruleflow.core.impl.ConnectionImpl id="22">
+                                <type>1</type>
+                                <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+                                <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="23">
+                                  <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="24">
+                                    <dialect>java</dialect>
+                                    <consequence>outList.add(&quot;JavaRuleConstraint was here&quot;);</consequence>
+                                  </action>
+                                  <id>9</id>
+                                  <name>JavaRuleConstraintAction</name>
+                                  <incomingConnections id="25">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="22"/>
+                                  </incomingConnections>
+                                  <outgoingConnections id="26">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl id="27">
+                                      <type>1</type>
+                                      <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="23"/>
+                                      <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+                                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                  </outgoingConnections>
+                                </to>
+                              </org.drools.ruleflow.core.impl.ConnectionImpl>
+                              <org.drools.ruleflow.core.impl.ConstraintImpl id="28">
+                                <name>JavaRuleConstraint</name>
+                                <constraint>list : List()&#x0D;
+eval( list.contains( 25 ) )</constraint>
+                                <priority>25</priority>
+                                <dialect>java</dialect>
+                                <type>rule</type>
+                              </org.drools.ruleflow.core.impl.ConstraintImpl>
+                            </entry>
+                            <entry>
+                              <org.drools.ruleflow.core.impl.ConnectionImpl id="29">
+                                <type>1</type>
+                                <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+                                <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="30">
+                                  <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="31">
+                                    <dialect>mvel</dialect>
+                                    <consequence>outList.add(&quot;MVELRuleConstraint was here&quot;);</consequence>
+                                  </action>
+                                  <id>8</id>
+                                  <name>MVELRuleConstraintAction</name>
+                                  <incomingConnections id="32">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl reference="29"/>
+                                  </incomingConnections>
+                                  <outgoingConnections id="33">
+                                    <org.drools.ruleflow.core.impl.ConnectionImpl id="34">
+                                      <type>1</type>
+                                      <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="30"/>
+                                      <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+                                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                                  </outgoingConnections>
+                                </to>
+                              </org.drools.ruleflow.core.impl.ConnectionImpl>
+                              <org.drools.ruleflow.core.impl.ConstraintImpl id="35">
+                                <name>MVELRuleConstraint</name>
+                                <constraint>list : List()&#x0D;
+eval( list.contains( 6 ) )</constraint>
+                                <priority>6</priority>
+                                <dialect>mvel</dialect>
+                                <type>rule</type>
+                              </org.drools.ruleflow.core.impl.ConstraintImpl>
+                            </entry>
+                            <entry>
+                              <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+                              <org.drools.ruleflow.core.impl.ConstraintImpl id="36">
+                                <name>MVELCodeConstraint</name>
+                                <constraint>return inList.contains( 1 );</constraint>
+                                <priority>1</priority>
+                                <dialect>mvel</dialect>
+                                <type>code</type>
+                              </org.drools.ruleflow.core.impl.ConstraintImpl>
+                            </entry>
+                          </constraints>
+                          <id>5</id>
+                          <name>Split</name>
+                          <incomingConnections id="37">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl id="38">
+                              <type>1</type>
+                              <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="39">
+                                <id>1</id>
+                                <name>Start</name>
+                                <incomingConnections id="40"/>
+                                <outgoingConnections id="41">
+                                  <org.drools.ruleflow.core.impl.ConnectionImpl reference="38"/>
+                                </outgoingConnections>
+                              </from>
+                              <to class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+                            </org.drools.ruleflow.core.impl.ConnectionImpl>
+                          </incomingConnections>
+                          <outgoingConnections id="42">
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="29"/>
+                            <org.drools.ruleflow.core.impl.ConnectionImpl reference="22"/>
+                          </outgoingConnections>
+                        </from>
+                        <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="9"/>
+                      </org.drools.ruleflow.core.impl.ConnectionImpl>
+                    </incomingConnections>
+                    <outgoingConnections id="43">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="8"/>
+                    </outgoingConnections>
+                  </from>
+                  <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+                </org.drools.ruleflow.core.impl.ConnectionImpl>
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="20"/>
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="34"/>
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="27"/>
+              </incomingConnections>
+              <outgoingConnections id="44">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="5"/>
+              </outgoingConnections>
+            </from>
+            <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="3"/>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </incomingConnections>
+        <outgoingConnections id="45"/>
+      </org.drools.ruleflow.core.impl.EndNodeImpl>
+    </entry>
+    <entry>
+      <long>8</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl reference="30"/>
+    </entry>
+    <entry>
+      <long>9</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl reference="23"/>
+    </entry>
+    <entry>
+      <long>6</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl reference="9"/>
+    </entry>
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl reference="39"/>
+    </entry>
+    <entry>
+      <long>7</long>
+      <org.drools.ruleflow.core.impl.ActionNodeImpl reference="16"/>
+    </entry>
+    <entry>
+      <long>10</long>
+      <org.drools.ruleflow.core.impl.JoinImpl reference="6"/>
+    </entry>
+    <entry>
+      <long>5</long>
+      <org.drools.ruleflow.core.impl.SplitImpl reference="13"/>
+    </entry>
+  </nodes>
+  <variables id="46"/>
+  <lastNodeId>10</lastNodeId>
+  <imports id="47">
+    <string>java.util.List</string>
+  </imports>
+  <globals id="48">
+    <entry>
+      <string>inList</string>
+      <string>List</string>
+    </entry>
+    <entry>
+      <string>outList</string>
+      <string>List</string>
+    </entry>
+  </globals>
+  <id>ConstraintDialects</id>
+  <name>ConstraintDialects</name>
+  <type>RuleFlow</type>
+  <packageName>org.drools.test</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ContainsCheese.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ContainsCheese.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ContainsCheese.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+rule "Cheesery contains stilton"
+	salience 10
+    when
+        stilton : Cheese( type == "stilton" )
+        Cheesery( cheeses contains stilton )
+    then
+		list.add( stilton );
+end   
+
+rule "Cheesery do not contains brie"
+    when
+        brie : Cheese( type == "brie" )
+        Cheesery( cheeses not contains brie )
+    then
+		list.add( brie );
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CrossProductRemovingIdentityEquals.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CrossProductRemovingIdentityEquals.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_CrossProductRemovingIdentityEquals.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.integrationtests
+
+import org.drools.SpecialString
+import java.util.List
+
+
+global List list1;
+global List list2;
+
+rule "A test"
+
+when
+    x : SpecialString()
+    y : SpecialString(this!=x)
+then
+    list1.add( x );
+    list2.add( y );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclarationUsage.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclarationUsage.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclarationUsage.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools;
+
+rule "test declaration"
+when
+    Cheese( type == $likes )
+    Person( $likes : likes );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclaringAndUsingBindsInSamePattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclaringAndUsingBindsInSamePattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DeclaringAndUsingBindsInSamePattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+#created on: 10/11/2006
+package org.drools.integrationtests
+
+import org.drools.Sensor;
+
+global java.util.List sensors;
+
+rule "BindsTest1_returnValue"
+	when
+		$sensor1 : Sensor( $temp1 : temperature, pressure < $temp1 )
+		$sensor2 : Sensor( $temp2 : temperature, pressure < ( $temp1 + $temp2 ) )
+	then 
+	    sensors.add( $sensor1 );
+end
+
+rule "BindsTest2_predicate"
+	when
+		$sensor1 : Sensor( $temp1 : temperature, pressure < $temp1 )
+		$sensor2 : Sensor( $temp2 : temperature, $p : pressure -> ( $p < ($temp1 + $temp2 ) ) )
+	then 
+	    sensors.add( $sensor1 );
+end
+
+rule "BindsTest3_eval"
+	when
+		$sensor1 : Sensor( $temp1 : temperature, pressure < $temp1 )
+		$sensor2 : Sensor( $temp2 : temperature, $p : pressure )
+		eval( $p < $temp1 + $temp2 )
+	then 
+	    sensors.add( $sensor1 );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DefaultBetaConstraint.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DefaultBetaConstraint.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DefaultBetaConstraint.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "5+ constraints with not"
+	when
+		FirstClass($i1 : item1, $i2 : item2, $i3 : item3, $i4 : item4, $i5 : item5) 
+		not SecondClass( item1 == $i1, item2 == $i2, item3 == $i3, item4 == $i4, item5 == $i5 ) 
+	then
+		results.add( "NOT" );
+end
+
+rule "5+ constraints with pattern"
+	when
+		FirstClass($i1 : item1, $i2 : item2, $i3 : item3, $i4 : item4, $i5 : item5) 
+		SecondClass( item1 == $i1, item2 == $i2, item3 == $i3, item4 == $i4, item5 == $i5 ) 
+	then
+		results.add( "EQUALS" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DoubleQueryWithExists.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DoubleQueryWithExists.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DoubleQueryWithExists.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+package org.drools
+
+query "2 persons with the same status"
+		p : Person($status : status, $age : age)
+		exists Person(status == $status, age > $age);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dumpers.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dumpers.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dumpers.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+function boolean testIllegalChars() {
+    return ( 3 < 4 && 4 > 3 );
+}
+
+rule "test MAIN 1"
+	salience  10
+    when
+    	Cheese( $type : type -> ( 3 < 4 && 4 > 3 ),
+    	        price < ( new Integer( 100 ) ) )
+    	eval( 3 < 4 && 4 > 3 )
+        eval( testIllegalChars() )
+    then
+        // lets also make sure that special chars are converted
+        if ( 3 < 4 && 4 > 3 ) {
+			list.add( "MAIN" );
+			drools.setFocus( "agenda group 1" );
+		}
+		
+end 
+
+rule "test group1 1"
+	agenda-group "agenda group 1"
+    when
+    	Cheese( $price : price )
+    then
+		list.add( "1 1" );
+end  
+
+rule "test group3 1"
+	salience 5
+	agenda-group "agenda group 3"
+	activation-group "activation group 3"
+	auto-focus true		
+    when
+    	Cheese( )
+    then    	
+		list.add( "3 1" );		
+end 
+
+
+rule "test group3 2"
+	agenda-group "agenda group 3"
+	activation-group "activation group 3"		
+    when
+    	Cheese( $type : type, $price : price )
+    then    	
+		list.add( "3 2" );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateLocalVariableMVELConsequence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateLocalVariableMVELConsequence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateLocalVariableMVELConsequence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test local variable in mvel consequence - same type"
+    dialect "mvel"
+	when
+		$p : Person( $likes : likes ) 
+	then
+	    Cheese c = new Cheese( $likes );
+	    results.add( c );
+	    // bellow should raise a duplicate local variable declaration
+	    Cheese c = new Cheese( "stilton" );
+end
+
+
+rule "test local variable in mvel consequence - different type"
+    dialect "mvel"
+	when
+		$p : Person( $likes : likes ) 
+	then
+	    Cheese c = new Cheese( $likes );
+	    results.add( c );
+	    // bellow should raise a duplicate local variable declaration
+	    String c = new String( "stilton" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package Some_business_rules;
+#generated from Decision Table
+import org.drools.Cheese;
+import org.drools.Person;
+global java.util.List list;
+#From row number: 17
+rule "Cheese fans_17"
+ 
+ salience 65519
+ when
+  Person(age == 42)
+  Cheese(type=="stilton")
+ then
+  list.add("Old man stilton");
+end
+
+#From row number: 18
+rule "Cheese fans_18"
+ 
+ salience 65518
+ when
+  Person(age == 21)
+  Cheese(type=="cheddar")
+ then
+  list.add("Young man cheddar");
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DuplicateRuleName2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package Some_other_business_rules;
+#generated from Decision Table
+import org.drools.Cheese;
+import org.drools.Person;
+global java.util.List list;
+#From row number: 17
+rule "Cheese fans_17"
+ 
+ salience 65519
+ when
+  Person(age == 42)
+  Cheese(type=="stilton")
+ then
+  list.add("Old man stilton");
+end
+
+#From row number: 18
+rule "Cheese fans_18"
+ 
+ salience 65518
+ when
+  Person(age == 21)
+  Cheese(type=="cheddar")
+ then
+  list.add("Young man cheddar");
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List list;
+
+rule delayed
+	duration 100
+    when
+        cheese : Cheese( )
+    then
+		list.add( cheese );
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration_with_NoLoop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration_with_NoLoop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Duration_with_NoLoop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List list;
+
+rule delayed
+	duration 100
+	no-loop true
+    when
+        cheese : Cheese( )
+    then
+		list.add( cheese );
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.lang.Integer total;
+global java.util.List list
+
+rule "like stilton"
+    when
+        Cheese( type:type == "stilton", price > ( -1 )  )
+    then
+		list.add( type );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list
+
+// make these rules share
+// so that we know things are being 
+// removed correctly still
+rule "like cheese"
+    when
+        Cheese( t:type )
+    then
+		list.add( t );
+end    
+
+rule "like cheese2"
+    when
+        Cheese( t:type )
+    then
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic3.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic3.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic3.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+global java.util.List list
+
+rule "match Person"
+    when
+        $person : Person()
+    then
+		list.add( $person );
+        $person.setStatus("match Person ok");		
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic4.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic4.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Dynamic4.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List list
+
+rule "Who likes Stilton"
+    when
+        Cheese( $type:type == "stilton" )    
+        $person:Person( likes == $type )
+    then
+        $person.setStatus("Who likes Stilton ok");    
+		list.add( $person );		
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import java.util.List;
+import org.drools.Cheese;
+
+global java.util.List list
+
+function void addFive(List list) {
+	list.add( new Integer(5) );
+}
+
+rule "global rule test"
+    when
+        Cheese( )
+    then
+		addFive( list );
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.test;
+
+import java.util.List;
+import org.drools.Cheese;
+
+
+global java.util.List list
+
+function void addFive(List list) {
+	list.add( new Integer(6) );
+} 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction3.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction3.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicFunction3.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools.test;
+
+import java.util.List;
+import org.drools.Cheese;
+
+
+global java.util.List list
+
+function void addFive(List list) {
+	list.add( new Integer(5) );
+} 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools;
+
+rule "Cheese"
+no-loop true
+    when
+        a: Cheese( $type : type, price == 10 );
+        b: Cheese( type == $type, price == 15 );
+        c: Cheese( type == $type );
+    then
+        c.setPrice( 30 );
+        retract(a);
+        update(c);
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_DynamicRules2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools;
+
+rule "setupFactC"
+no-loop true
+    when
+        a: FactA(s:field1, i:field2, f:field3)
+        not FactC(f1==s)
+    then
+        insert(s != null ? new FactC(s, i, f) :
+                                  new FactC());
+end
+
+rule "factBWithRetract"
+    when
+        b : FactB(s:f1, i:f2, f:f3)
+        a : FactA(field1==s)
+        c : FactC(f1==s)
+    then
+        c.setF3(f);
+        retract(b);
+        update(c);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EffectiveDate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EffectiveDate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EffectiveDate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package HelloWorld
+ 
+#we don't use the import, as class is fully qualified below 
+#import org.drools.integrationtests.helloworld.Message
+
+global java.util.List list;
+
+rule "Hello World"
+	date-effective "9-Jul-1974"
+	date-expires "10-Jul-1974"
+	when
+		$m : org.drools.Message()
+	then
+		$m.setFired(true); 
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyPattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyPattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyPattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+
+global java.util.List list;
+ 
+rule "simple rule"
+    when
+        cheese : Cheese( )
+    then
+		list.add( new Integer(5) ); 
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyRule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyRule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EmptyRule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test
+
+global java.util.List list
+
+rule "empty lhs1"
+    when
+    then
+    	list.add("fired1");
+end    
+
+rule "empty lhs2"
+    when
+    then
+    	list.add("fired2");
+end    
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EntryPoint.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EntryPoint.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EntryPoint.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+import org.drools.StockTick;
+
+global java.util.List results;
+
+declare StockTick {
+    role event
+}
+
+rule "Test entry point"
+when
+    $st : StockTick( company == "ACME", price > 10 ) from entry-point StockStream
+then
+    results.add( $st );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+function boolean throwException(Object object) {
+	throw new Exception( "this should throw an exception" );
+}
+
+rule "Throw Eval Exception"
+    when
+    	cheese : Cheese( )
+ 		eval( throwException( cheese ) )
+    then
+
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewrite.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewrite.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewrite.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools;
+
+global java.util.List results;
+
+
+rule "eval rewrite"
+	when
+		$o : OrderItem( order.number == 10 )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite2"
+	when
+		$o1 : OrderItem( order.number == 11, $seq : seq == 1 )
+		$o2 : OrderItem( order.number == $o1.order.number, seq != $seq )
+	then
+		results.add( $o2 );
+end
+
+rule "eval rewrite3"
+	when
+		$o1 : OrderItem( order.number == 12, seq == 1 )
+		$o : Order( items[(Integer) 1] == $o1 )
+	then
+		results.add( $o );
+end
+
+rule "eval rewrite4"
+	when
+		OrderItem( $nbr : order.number == 13, seq == 1 )
+		$o : Order( number == $nbr )
+	then
+		results.add( $o );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteMatches.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteMatches.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteMatches.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "eval rewrite with 'matches'"
+    salience 20
+	when
+	    $oi : OrderItem( order.number == 14, seq == 1, order.customer matches "M\w*" )
+	then
+	    results.add( $oi );
+end
+
+rule "eval rewrite with 'not matches'"
+    salience 10
+	when
+	    $oi : OrderItem( order.number == 14, seq == 2, order.customer not matches "B\w*" )
+	then
+	    results.add( $oi );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteWithSpecialOperators.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteWithSpecialOperators.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EvalRewriteWithSpecialOperators.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,88 @@
+package org.drools;
+
+global java.util.List results;
+
+// [not] in
+// [not] contains
+// [not] memberOf
+// excludes
+// [not] matches
+
+rule "eval rewrite with 'in'"
+    salience 100
+	when
+	    Order( $id : number == 10 )
+		$o : OrderItem( order.number in ( 1, (1+1), $id ), seq == 1 )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'not in'"
+    salience 90
+	when
+	    Order( $id : number == 10 )
+		$o : OrderItem( order.number not in ( 1, (1+1), ( $id + 1 ) ), order.number == $id, seq == 2 )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'contains'"
+    salience 80
+	when
+		$o : OrderItem( order.number == 11, seq == 1 )
+	    Order( this.itemsValues contains $o )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'not contains'"
+    salience 70
+	when
+		$o : OrderItem( order.number == 11, seq == 2 )
+	    Order( number == 12, this.itemsValues not contains $o )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'memberOf'"
+    salience 60
+	when
+	    $order : Order( number == 12 )
+		$o : OrderItem( seq == 1, order.number==12, this.seq memberOf $order.itemsKeys )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'not memberOf'"
+    salience 50
+	when
+	    $order : Order( number == 11 )
+		$o : OrderItem( seq == 3, order.number==12, this.seq not memberOf $order.itemsKeys )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'excludes'"
+    salience 30
+	when
+		$o : OrderItem( order.number == 13, seq == 1 )
+	    Order( number == 12, this.itemsValues excludes $o )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'matches'"
+    salience 20
+	when
+	    $o : Order( number == 14, this.customer matches "Mark" )
+	then
+	    results.add( $o );
+end
+
+rule "eval rewrite with 'not matches'"
+    salience 10
+	when
+	    $o : Order( number == 14, this.customer not matches "Bob" )
+	then
+	    results.add( $o );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EventModel.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EventModel.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_EventModel.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+
+rule "simple rule 1"
+	agenda-group "agenda group 1"
+    when
+        cheese : Cheese( type == "stilton" )
+    then
+end 
+
+
+
+rule "simple rule 2"
+	agenda-group "agenda group 2"
+    when
+        cheese : Cheese( type == "cheddar" )
+    then
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExistsWithBindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExistsWithBindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExistsWithBindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package com.sample
+
+import org.drools.Cheese
+import org.drools.Person
+
+global java.util.List results
+
+rule "Exists with Bindings"	
+	when
+		exists Cheese()
+		c: Cheese( $type : type );
+		p: Person( likes == $type );
+	then 
+		results.add( $type );		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExplicitAnd.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExplicitAnd.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ExplicitAnd.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package HelloWorld
+ 
+import org.drools.Message
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "Hello World"
+	when
+		Message() && Cheese()
+	then
+		list.add("hola");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactBindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactBindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactBindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+import org.drools.Person;
+ 
+rule "simple rule"
+	no-loop true
+    when
+        $person : Person( name == "big cheese", $cheese : cheese )
+    then
+       	update( $cheese );
+    	update( $person );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactTemplate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactTemplate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FactTemplate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.integrationtest
+
+import java.util.List
+
+global List list
+
+template Cheese
+    String  name
+    Integer price
+end
+
+rule "Match Stilton"
+	when
+	    $stilton : Cheese( name == "stilton" )
+    then
+    	$stilton.setFieldValue( "price", new Integer( 200 ) );
+    	list.add( $stilton );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndEvalSharing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndEvalSharing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndEvalSharing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+global java.util.List list;
+
+#this is to test eval condition node sharing working properly
+rule rule1
+    when
+        TestParam(val: value1)
+        eval(val == null)
+    then
+    	list.add("rule1 fired");
+end    
+
+
+rule rule2
+    when
+        TestParam(val: value2)
+        eval(val == null) #note its the same guts, but different binding
+    then
+		list.add("rule2 fired");
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndPredicateSharing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndPredicateSharing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FieldBindingsAndPredicateSharing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List list;
+
+#this is to test eval condition node sharing working properly
+rule rule1
+    when
+        TestParam(val: value1 -> (val == null))
+    then
+    	list.add("rule1 fired");
+end    
+
+
+rule rule2
+    when
+        TestParam(val: value2 -> (val == null))
+    then
+		list.add("rule2 fired");
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test final class 1"
+    dialect "mvel"
+    salience 10
+	when
+		$p : Person( name == "bob", status == null )
+	then
+		$p.status = "OK";
+		results.add("OK");
+		update( $p );
+end
+
+rule "test final class 2"
+    dialect "mvel"
+    when
+        $p : Person( name == "bob", status == null )
+    then
+        # this rule should not fire
+        $p.status = "NOT OK";
+        results.add("NOT OK");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FinalClass2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test final class 3"
+    dialect "mvel"
+    salience 10
+	when
+		$p : PersonFinal( name == "bob" )
+	then
+		results.add("Final OK");
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FireRuleAfterDuration.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FireRuleAfterDuration.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FireRuleAfterDuration.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule delayed
+	duration 100
+    when
+        cheese : Cheese( $type:type == "brie" )
+    then
+		list.add( cheese );
+		insert(new Cheese("stilton", 42));
+		retract(cheese);
+end
+
+rule after_delayed
+    when
+        cheese : Cheese( $type:type == "stilton" )
+    then
+		list.add( cheese );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Forall.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Forall.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Forall.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test nested CEs"	
+	when
+	    forall( State( $state : state )
+	            Person( status == $state, $likes : likes )
+	            Cheese( type == $likes ) )
+	then 
+		results.add("OK");		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ForallSinglePattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ForallSinglePattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ForallSinglePattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test forall single pattern"	
+	when
+	    forall( Cheese( type == "stilton" ) )
+	then 
+		results.add("OK");		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+package org.drools.test;
+ 
+#we don't use the import, as class is fully qualified below 
+#import org.drools.integrationtests.helloworld.Message
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import java.util.List;
+
+global List list1;
+global List list2;
+global List list3;
+global Cheesery cheesery;
+
+rule "test from using a global"
+	when
+		$cheese : Cheese() from cheesery.getCheeses()		
+	then
+		list1.add( $cheese );
+end
+
+
+rule "test from using a declaration"
+	when
+		$ch : Cheesery()
+		$cheese : Cheese() from $ch.getCheeses()		
+	then
+		list2.add( $cheese );
+end
+
+
+rule "test from with filter"
+	when
+		$cheese : Cheese(type == "stilton" ) from cheesery.getCheeses()		
+	then
+		list3.add( $cheese );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_From2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.test;
+ 
+#we don't use the import, as class is fully qualified below 
+#import org.drools.integrationtests.helloworld.Message
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import java.util.List;
+
+global List list1;
+global List list2;
+global List list3;
+global Cheesery cheesery;
+
+rule "test from using a global against a map lookup"
+	when
+		$cheese : Cheese( type == "stilton" ) from cheesery.getCheeseMap["stilton"]	
+	then
+		list1.add( $cheese );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromInsideNotAndExists.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromInsideNotAndExists.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromInsideNotAndExists.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "exists with from"
+	when
+		Cheesery( $cheeses : cheeses ) 
+		exists( Cheese( type == "stilton" ) from $cheeses )
+	then
+		results.add( "1" );
+end
+
+rule "not with from"
+	when
+		Cheesery( $cheeses : cheeses ) 
+		not( Cheese( type == "cheddar" ) from $cheeses )
+	then
+		results.add( "2" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromNestedAccessors.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromNestedAccessors.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromNestedAccessors.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test from nested accessors"
+when
+    $oi : OrderItem( seq == 1 )
+    $os : Order.OrderStatus() from $oi.order.status
+then
+    results.add( $os );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithNewConstructor.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithNewConstructor.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithNewConstructor.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+import org.drools.Query;
+import org.drools.Results;
+import org.drools.Storage;
+
+rule "Verify_1"
+    when
+        content : Storage()
+        results : Results( ) from content.search(new Query("test","field"))
+    then
+        System.out.println( results );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithParams.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithParams.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FromWithParams.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+ 
+import org.drools.FromTestClass;
+import org.drools.Person
+
+global FromTestClass testObject;
+global java.util.List list;
+global java.lang.Object globalObject;
+
+rule "test from"
+	when
+		$person : Person()
+		$object : Object() from testObject.toList(globalObject, $person, "literal", 42, [ $person : globalObject, "key1" : [ "key2" : "value2"]], [$person, 42, ["x", "y"]])		
+	then
+		list.add( $object );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+function void throwException() {
+	throw new Exception( "this should throw an exception" );
+}
+
+rule "Throw Function Exception"
+    when
+    	cheese : Cheese( )
+    then
+		throwException();
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionInConsequence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionInConsequence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionInConsequence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test;
+
+import java.util.List;
+import org.drools.Cheese;
+
+
+global java.util.List list
+
+function void addFive(List list) {
+	list.add( new Integer(5) );
+}
+
+rule "global rule test"
+    when
+        Cheese( )
+    then
+		addFive( list );
+		// Calling methods does not mess with function calls
+		// System.out.println(list);
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionWithPrimitives.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionWithPrimitives.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_FunctionWithPrimitives.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list
+
+function int addFive( int price ) {
+	return price + 5;
+}
+
+rule "Function with Primitives"
+    when
+        Cheese( $price: price )
+    then
+        list.add( new Integer( addFive( $price ) ) );
+end    

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportConflict.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportConflict.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportConflict.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.example;
+
+import org.drools.Process
+
+rule "A rule"
+    when
+        p:Process( )
+    then
+        // do something
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportFunctions.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportFunctions.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ImportFunctions.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,45 @@
+package org.drools.test;
+
+import function org.drools.StaticMethods.*;
+import function org.drools.StaticMethods2.getString3;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+function String getString4( String string ) {
+    return string;
+}
+
+rule "test rule1"
+	salience 30
+    when
+        Cheese()
+    then
+		list.add( getString1( "rule1" ) );
+end    
+
+rule "test rule2"
+	salience 20
+    when
+        Cheese( type == ( getString2("stilton") ) );
+    then
+		list.add( getString3( "rule", new Integer( 2 ) ) );
+end    
+
+rule "test rule3"
+	salience 10
+    when
+        Cheese( $type : type);
+        eval( $type.equals( getString1( "stilton" ) ) );
+    then
+		list.add( getString2( "rule3" ) );
+end    
+
+rule "test rule4"
+	salience 0
+    when
+        Cheese();
+    then
+		list.add( getString4( "rule4" ) );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Insert_Retract_Noloop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Insert_Retract_Noloop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Insert_Retract_Noloop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "test1"
+	salience 10
+	no-loop true
+	when
+        cheese : Cheese();
+    then
+    	retract(cheese);
+		insert(cheese);
+end
+
+
+rule "test2"
+	salience 0
+	no-loop true
+	when
+        cheese : Cheese();
+    then
+		retract(cheese);
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_IterateObjects.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_IterateObjects.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_IterateObjects.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test iterate objects"
+when
+    Cheese( $type : type )
+then
+    results.add( new Person( "Bob", $type ) );
+    insert( results.get(0) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JavaModifyBlock.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JavaModifyBlock.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JavaModifyBlock.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test modify block"
+when
+    $p: Person( status == "hungry" )
+    $c: Cheese( )
+then
+    retract( $c );
+    modify( $p ) { 
+        setStatus( "full" ), 
+        setAge( $p.getAge() + 1 ) 
+    }
+    results.add( $p );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyObject.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyObject.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyObject.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,52 @@
+#created on: 12 juin 2006
+package Number
+
+import org.drools.IndexedNumber;
+import java.util.List;
+
+global java.util.List orderedNumbers;
+global java.util.List errors;
+ 
+rule "Order1"
+salience 210
+	when
+	    # testing join node + eval
+		n1 : IndexedNumber($nb1 : number);
+		n2 : IndexedNumber(number < $nb1);
+		eval(n1.getIndex() < n2.getIndex());
+	then
+		if ( ! (n1.getIndex() < n2.getIndex())) {
+		    errors.add("{1} Shouldn't fire for: " + n1 + " " + n2);
+        }
+end		
+
+rule "Order2"
+salience 200
+	when
+	    #testing pure join nodes
+		n1 : IndexedNumber($nb1 : number, $index : index);
+		n2 : IndexedNumber(number < $nb1, index > $index );
+	then
+		if ( ! (n1.getIndex() < n2.getIndex())) {
+		    errors.add("{2} Shouldn't fire for: " + n1 + " " + n2);
+        }
+		swap(n1, n2);
+		update(n1);
+		update(n2);
+end		
+
+rule "Debug"
+salience 10
+	when
+		n : IndexedNumber($idx : index);
+		not IndexedNumber(index < $idx);
+	then
+		orderedNumbers.add(n);
+		retract(n);
+end
+
+function void swap(IndexedNumber n1, IndexedNumber n2) {
+	int tmp = n1.getIndex();
+	n1.setIndex(n2.getIndex());
+	n2.setIndex(tmp);
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyTuple.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyTuple.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_JoinNodeModifyTuple.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package TrafficControl
+
+import org.drools.*
+
+rule "Target Retract"
+	salience -100
+	when
+      $tgt1 : Target( $label1 : label, $time : time )
+      Target( label == $label1, time > $time )
+	then
+      retract( $tgt1 );
+end
+
+rule "Close Assert"
+	when
+      Target( $label : label, $time : time, $lat : lat, $lon : lon )
+      Target( $label2 : label, time == $time, $lat2 : lat, $lon2 : lon )
+      eval( $label.compareTo( $label2 ) < 0 )
+	then
+      float s1 =  $lat.floatValue() - $lat2.floatValue();
+      float s2 =  $lon.floatValue() - $lon2.floatValue();
+      double distance = Math.sqrt( s1*s1 + s2*s2 );
+      if ( distance < 8.0 )
+      {
+        Close cl = new Close();
+        cl.label = $label;
+        cl.label2 = $label2;
+        cl.time = $time;
+        cl.distance = new Float( distance );
+        cl.bearing = new Float( 144.9 );
+        insert( cl );
+      }
+end
+
+rule "Close Retract"
+	salience -100
+	when
+      $cls : Close( $label : label, $label2 : label2, $time : time )
+      Close( label == $label, label2 == $label2, time > $time )
+	then
+      retract( $cls );
+end
+
+rule "Approach Begin"
+	when
+      $cls1 : Close( $label : label, $label2 : label2, $time : time, $distance : distance, $bearing : bearing )
+      not Approach( label == $label, label2 == $label2 )
+      $cls2 : Close( label == $label, label2 == $label2, $time2 : time > $time, $distance2 : distance < $distance, $bearing2 : bearing )
+	then
+      Approach a = new Approach();
+      a.label = $label;
+      a.label2 = $label2;
+      a.distance = $distance;
+      a.distance2 = $distance2;
+      a.time = $time;
+      a.time2 = $time2;
+      a.bearing = $bearing;
+      a.bearing2 = $bearing2;
+      insert( a );
+      retract( $cls1 );
+end
+
+rule "Approach Continue"
+	no-loop true
+	when
+      $app : Approach( $label : label, $label2 : label2, $time2 : time2, $distance2 : distance2 )
+      Close( label == $label, label2 == $label2, $time3 : time > $time2, $distance3 : distance <=  $distance2, $bearing3 : bearing )
+	then
+      $app.distance2 = $distance3;
+      $app.bearing2 = $bearing3;
+      $app.time2 = $time3;
+      update( $app );
+end
+
+rule "Danger Distance Warning"
+	when
+      Approach( $label : label, $label2 : label2, $distance2 : distance2, $time2 : time2, $bearing2 : bearing2 )
+      Target( label == $label, time == $time2, $speed : speed, $course : course )
+      eval( $distance2.floatValue() <= 5.2 )
+	then
+      //System.out.println( "Danger Distance Warning "+$label+" "+$label2+" distance: "+$distance2 );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LocalVariableMVELConsequence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LocalVariableMVELConsequence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LocalVariableMVELConsequence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+ 
+global java.util.List results;
+ 
+rule "test local variable in mvel consequence"
+    dialect "mvel"
+	when
+		$p : Person( $likes : likes ) 
+	then
+	    Cheese c = new Cheese( $likes );
+	    results.add( c );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActive.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActive.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActive.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "test group1 1"
+	agenda-group "group1"
+	lock-on-active true
+    when
+    	Cheese( type == "brie" )
+    then
+		list.add( "group1" );
+end  
+
+rule "test group2 ruleflow2"
+	agenda-group "group2"
+	ruleflow-group "ruleflow2"
+	lock-on-active true
+    when
+    	Cheese(  type == "cheddar" )
+    then
+		list.add( "group1" );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActiveWithUpdate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActiveWithUpdate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LockOnActiveWithUpdate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,27 @@
+package org.drools.test;
+
+import org.drools.Person;
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "test lock with modify"
+	agenda-group "group1"
+	lock-on-active true
+    when
+    	$cheese : Cheese( price < 30 )
+    	$person : Person( cheese == $cheese )
+    then
+		list.add( $person );
+end  
+
+rule "test group2 ruleflow2"
+	agenda-group "group2"
+	ruleflow-group "ruleflow2"
+	lock-on-active true
+    when
+    	$cheese : Cheese( price < 30 )
+    	$person : Person( cheese == $cheese )
+    then
+		list.add( $person );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Logger.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Logger.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Logger.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+rule "test logger"
+when
+    ( or 
+        not Cheese( type == "a" )
+        (and $a : Cheese( type == "a" ) 
+             $b : Cheese( type == "b" )
+        )
+    )
+then
+    // rule fires
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionWithExists.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionWithExists.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionWithExists.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools
+
+rule "Supply cheese for for every person when there already exists someone of the same status and they are older"
+	when
+		p : Person($status : status, $age : age)
+		exists Person(status == $status, age > $age);
+	then
+        insertLogical(new Cheese("Cheese for person with age " + $age, 0));
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List list;
+
+rule justifier1
+    when
+        cheese : Cheese( type == "brie" )
+    then
+	    insertLogical( new  Person( "jane" ) );
+		list.add( cheese );
+end   
+
+rule justifier2
+    when
+        cheese : Cheese( type == "provolone" )
+    then
+		insertLogical( new  Person( "jane" ) );
+		list.add( cheese );
+end   
+
+rule justified
+    when
+        person : Person( )
+    then
+		list.add( person );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertions2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.test;
+
+import org.drools.Alarm;
+import org.drools.EmergencyTeam;
+import org.drools.Sensor;
+
+global java.util.List events;
+
+rule "Everything is Normal"
+    when
+        not Alarm( )
+    then
+        events.add("Everything is Normal");
+end   
+
+rule "Problem detected" 
+    salience 10
+    when
+        sensor : ( Sensor( temperature > 100 ) or Sensor( pressure > 150 ) )
+    then
+        events.add( "Problem detected: "+sensor.toString() );
+        insertLogical( new Alarm( "Call emergency team" ) );
+end 
+
+rule "Call Emergency Team"
+    when
+        Alarm ( )
+    then
+        events.add( "Calling Emergency Team" );
+        insertLogical( new EmergencyTeam() );
+end
+
+rule "Emergency Team solves temperature" 
+    salience 20
+    when 
+        EmergencyTeam()
+        sensor : Sensor( temperature > 100 )
+    then
+        events.add( "Solving temperature problem" );
+        sensor.setTemperature(80);
+        update(sensor);
+end
+
+rule "Emergency Team solves pressure" 
+    salience 20
+    when 
+        EmergencyTeam()
+        sensor : Sensor( pressure > 150 )
+    then
+        events.add( "Solving pressure problem" );
+        sensor.setPressure(80);
+        update(sensor);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsAccumulatorPattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsAccumulatorPattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsAccumulatorPattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,63 @@
+package org.drools.test;
+
+import java.lang.Integer;
+import java.lang.Float;
+import java.lang.Double;
+import java.lang.Short;
+import java.lang.String;
+import org.drools.CheeseEqual;
+
+global java.lang.String ga;
+global java.lang.String gb;
+global java.lang.Short gs;
+
+rule "assert-item"
+	when
+		i : Integer()
+	then
+		insertLogical(new Double(2.0));
+end
+
+rule "kickstart-accumulation"
+	when
+		i : Integer()
+	then
+		insertLogical(new Float(1.0));
+end
+
+rule "item qualifies"
+    when
+    	d : Double()
+    	f : Float()
+    then
+    	//assert(new Short((short)3));
+    	insert(gs);
+   		insertLogical(new CheeseEqual(ga, 4));
+end
+
+rule "accumulate item"
+	when
+		f : Float()
+		s : Short()
+		c : CheeseEqual(type == (ga), price == 4)
+		not CheeseEqual(type == (gb), price == 5)
+	then
+		update(f);
+		insert(new CheeseEqual(gb, 5));
+end
+
+rule "clean-up-1"
+	when
+		s : Short()
+		not Float()
+	then
+		retract(s);
+end
+
+rule "clean-up-2"
+	when
+		c : CheeseEqual(type == (gb), price == 5)
+		not Float()
+	then
+		retract(c);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsBacking.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsBacking.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsBacking.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "Cheese => type"
+    when
+        Cheese( type : type )
+    then
+		insertLogical( type );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Person;
+import org.drools.Cheese;
+
+rule "rule1"
+    when
+        Cheese( type : type, price : price -> (price > 1))
+        #Cheese( type : type, price > 1 )
+    then
+		insertLogical( new  Person( type ) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsDynamicRule2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test2;
+
+import org.drools.Person;
+import org.drools.Cheese;
+
+rule "rule2"
+    when
+        Cheese( type : type, price : price -> (price < 3))
+        #Cheese( type : type, price < 3)
+    then
+		insertLogical( new  Person( type ) );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsLoop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsLoop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsLoop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.test;
+
+import org.drools.Person;
+import java.util.List;
+
+global Person a;
+global List l;
+
+rule "r"
+    when
+        not Person()
+    then
+    	if (l.size() < 10)
+    	{
+    		l.add(new Integer(0));
+    		insertLogical( a );
+    	}
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNoLoop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNoLoop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNoLoop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test;
+
+import org.drools.Person;
+import java.util.List;
+
+global Person a;
+global List l;
+
+rule "r"
+	no-loop true
+    when
+        not Person()
+    then
+   		l.add(new Person("0"));
+   		if (l.size() > 2)
+    	{
+    	    throw new Exception( "this should not loop" );
+    	}
+   		insertLogical( a );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNot.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNot.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNot.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese
+import org.drools.Person
+
+global Cheese cheese
+
+rule "r"
+    when
+        not Person()
+    then
+   		insertLogical(cheese);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNotPingPong.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNotPingPong.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsNotPingPong.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+package org.drools.test;
+
+import java.util.List;
+import org.drools.Person
+import org.drools.Cheese
+
+global Cheese cheese;
+global Person person;
+global java.util.List list;
+
+rule "not person then cheese"
+    when
+        not Person()
+    then
+    	if (list.size() < 10) {
+    		list.add(new Integer(0));
+	   		insertLogical( cheese );
+	   	}
+end
+rule "if cheese then person"
+	when
+		Cheese()
+	then
+    	if (list.size() < 10) {
+	   		list.add(new Integer(0));
+			insertLogical( person );
+	   	}
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsSelfreferencing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsSelfreferencing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsSelfreferencing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+global Person b;
+
+
+rule "Person => b"
+    when
+        s : Person()
+    then
+		insertLogical( b );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsUpdateEqual.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsUpdateEqual.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsUpdateEqual.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools.test;
+
+import org.drools.Person
+import org.drools.CheeseEqual;
+
+rule "assert"
+	when
+		p : Person()
+	then
+		insertLogical( new CheeseEqual( p.getName(), p.getAge() ) );
+end
+
+rule "modify"
+	no-loop true
+	when
+		c : CheeseEqual(price == 2)
+	then
+		c.setPrice(c.getPrice() + 1);
+		update(c);
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsWithUpdate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsWithUpdate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsWithUpdate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools.test;
+
+import org.drools.Person
+import org.drools.CheeseEqual;
+
+rule "assert"
+	salience 10
+	when
+		p : Person( name == "person" )
+	then
+		insertLogical( new CheeseEqual( p.getName(), p.getAge() ) );
+end
+
+rule "modify"
+	no-loop true
+	when
+		p : Person( name == "person" )	
+		c : CheeseEqual(price == 2)
+	then
+		update( p );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MVELCollect.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MVELCollect.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MVELCollect.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "test mvel collect"
+    dialect "mvel"
+when
+    $list : ArrayList() from collect( Cheese() )
+then
+    results.add( $list );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MapAccess.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MapAccess.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MapAccess.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+import java.util.Map;
+
+global java.util.List results;
+
+rule "map access"
+	when
+		$m : Map( this['name'] == "Edson", this.surname == "Tirelli", this.age == 28 )
+	then
+		results.add( $m );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MatchesNotMatches.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MatchesNotMatches.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MatchesNotMatches.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "Cheese matches stilton"
+	salience 10
+    when
+        stilton : Cheese( type matches "[Ss]tilto[^0-9]" )
+    then
+		list.add( stilton );
+end   
+
+rule "Cheese not matches"
+    when
+        brie : Cheese( type not matches "(stil.*|mu\w*|brie\d|aged.*)" )
+    then
+		list.add( brie );
+end   
+
+rule "Cheese matches with space"
+	salience -10
+    when
+        stilton : Cheese( type matches "aged stilton" )
+    then
+		list.add( stilton );
+end   
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ModifyRetractInsert.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ModifyRetractInsert.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ModifyRetractInsert.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test modify retract insert"
+when
+    $p: Person( status == "hungry" )
+    $c: Cheese( )
+then
+    results.add( $c );
+    retract( $c );
+    modifyRetract( $p );
+    $p.setStatus( "full" );
+    modifyInsert( $p );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MultiRestrictionFieldConstraint.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MultiRestrictionFieldConstraint.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_MultiRestrictionFieldConstraint.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+package org.drools
+
+import org.drools.Person;
+
+global java.util.List list1;
+global java.util.List list2;
+global java.util.List list3;
+global java.util.List list4;
+
+
+rule "1. && operator with number range"
+    when    	
+		$person : Person( age > 30 && < 40, hair == "red" )		    
+    then
+        list1.add( $person );
+end    
+
+rule "2. && operator with != and strings"
+    when    	
+		$person : Person( hair != "blue" && != "purple", age > 30 && < 40  )		    
+    then
+        list2.add( $person );
+end   
+
+rule "3. || operator with == and strings"
+    when    	
+		$person : Person( hair == "blue" ||  == "purple",   age < 30 )		    
+    then
+        list3.add( $person );
+end   
+
+
+rule "4. ||  and && operator with ==  and != and strings"
+    when    	
+		$person : Person( age > 30 && < 40 || > 10 && < 20, hair == "red" || == "blue" )	
+    then
+        list4.add( $person );
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedAccessors.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedAccessors.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedAccessors.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Test nested accessors 1"
+    salience 10
+when
+    $oi : OrderItem( seq == 1, order.status.active == true )
+then
+    results.add( $oi );
+end
+
+rule "Test nested accessors 2"
+when
+    $oi : OrderItem( seq == 2, this.order.status.active == true )
+then
+    results.add( $oi );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedConditionalElements.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedConditionalElements.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedConditionalElements.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results
+
+rule "test nested CEs"	
+	when
+	    not ( State( $state : state ) and
+	          not( Person( status == $state, $likes : likes ) and
+	               Cheese( type == $likes ) ) )
+	then 
+		results.add("OK");		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedCorrelatedRulesWithForall.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedCorrelatedRulesWithForall.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NestedCorrelatedRulesWithForall.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,45 @@
+package org.test
+
+import org.drools.SpecialString
+import java.util.List
+
+global List list1;
+global List list2;
+global List list3;
+global List list4;
+
+rule "Strange rule1"
+when
+    x : SpecialString() and
+    forall( y : SpecialString(this != x)
+                SpecialString(this == y, text == "World") )
+then
+    list1.add( x );
+end 
+
+rule "Strange rule2"
+when
+    exists(x : SpecialString() and
+                forall( y : SpecialString(this != x)
+                            SpecialString(this == y, text == "World") ) )
+then
+    list2.add( "true" );
+end 
+
+rule "Strange rule3"
+when
+    not( exists(x : SpecialString() and
+                forall( y : SpecialString(this != x)
+                            SpecialString(this == y, text == "Universe") ) ) )
+then
+    list3.add( "true" );
+end 
+
+rule "Strange rule4"
+when
+    not( exists(x : SpecialString() and
+                forall( y : SpecialString(this != x)
+                            SpecialString(this == y ) ) ) )
+then
+    list4.add( "true" );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NoPatterns.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NoPatterns.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NoPatterns.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.test
+
+global java.util.List list
+
+rule "no patterns1"
+    when
+    	eval(true);
+    then
+    	list.add("fired1");
+end    
+
+rule "no patterns2"
+    when
+    	eval(false);
+    then
+    	list.add("fired2");
+end 
+
+rule "no patterns3"
+    when
+    	eval(true);
+    	eval(1==1);
+    then
+    	list.add("fired3");
+end  
+
+ 
+rule "no patterns4"
+    when
+    	eval(false);
+    	eval(true);
+    	eval(1==1);    	
+    then
+    	list.add("fired4");
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NotInStatelessSession.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NotInStatelessSession.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NotInStatelessSession.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+global java.util.List list
+
+rule "new rule"
+	when
+		not Integer()
+	then
+		list.add( "not integer" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullFieldOnCompositeSink.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullFieldOnCompositeSink.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullFieldOnCompositeSink.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools
+ 
+import org.drools.Message;
+import org.drools.Attribute;
+
+global java.util.List list;
+ 
+rule "rule_1"
+
+when
+    Message()
+    Attribute(value == 1)
+then
+    System.err.println("case 1");
+end
+
+rule "rule_2"
+
+when
+    Message()
+    Attribute(value == 2)
+then
+System.err.println("case 2");
+end
+
+
+rule "rule_3"
+
+when
+    Message()
+    $a:Attribute(value == null)
+then
+    list.add( "X" );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHandling.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHandling.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHandling.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,27 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+import org.drools.Person;
+
+global java.util.List list;
+ 
+rule "simple rule"
+    when
+        Cheese( type == null )
+    then
+		list.add( new Integer(5) ); 
+end 
+
+rule "another rule"
+	when
+		Person( bigDecimal != null )
+    then 
+    	list.add( new Integer(6) );
+end   
+
+rule "number not null"
+    when
+     	Person( name== "whee", bigDecimal != 3 )
+    then
+    	list.add( new Integer(7) );
+end     	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHashing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHashing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullHashing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools;
+
+global java.util.List results
+
+rule "Hashing null"
+        salience 10
+	when
+		Cheese( type == null )
+	then
+		results.add( "OK1" );
+end
+
+rule "Hashing empty"
+        salience 5
+	when
+		Cheese( type == "" )
+	then
+		results.add( "OK2" );
+end
+
+rule "Hashing value"
+	when
+		Cheese( type == "stilton" )
+	then
+		results.add( "OK3" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullValuesIndexing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullValuesIndexing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NullValuesIndexing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Person;
+
+rule "Test Null Values"
+	when
+		person1: Person( $name:name )
+		person2: Person( name == $name )
+	then
+		person1.setStatus("OK"); 
+		person2.setStatus("OK");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NumberComparisons.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NumberComparisons.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_NumberComparisons.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+package org.drools;
+
+global java.util.List results;
+
+rule High
+   when 
+      RandomNumber(randomValue:value)
+      // literal constraint
+      Guess(guess: value > 10)
+   then 
+      results.add("LOWER");
+end
+
+rule Low
+   when 
+      RandomNumber(randomValue:value)
+      // return value constraint
+      Guess(guess: value < ( 10 ) )
+   then 
+      results.add("HIGHER");
+end
+
+rule Win
+   when 
+      RandomNumber(randomValue:value)
+      // variable constraint
+      Guess(value==randomValue)
+   then 
+      results.add("CORRECT");
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrCE.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrCE.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrCE.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test or CE"
+when
+    $c : Cheese( type == "stilton" )
+    or
+    (
+        $c2 : Cheese( type == "brie" )
+        and
+        (
+            $p : Person( likes == "stilton" )
+            or
+            $p : Person( name == "bob" )
+        )
+    ) 
+then
+    results.add(" OK " );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrNesting.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrNesting.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrNesting.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test or nesting"
+when
+    exists Person( name == "mark" )
+    $mark : Person( name == "mark", $likes : likes )
+    ( Cheese( type == $likes ) or not Cheese( price > 20 ) )
+then
+    results.add( $mark );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrWithBindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrWithBindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OrWithBindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package com.sample
+
+import org.drools.Person
+import org.drools.Cheese
+import org.drools.State
+
+global java.util.List results
+
+rule "MyRule"	
+	when
+		(State() || Cheese())
+		p: Person()
+	then 
+		results.add(p);		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemory.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemory.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemory.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+rule "Rule 1"
+        when
+                c: Cheese( type == "stilton" )
+        then
+                c.setPrice( c.getPrice() + 1 );
+                c.setType( "brie" );
+                update( c );
+end
+ 
+rule "Rule 2"
+        when
+                c: Cheese( type == "brie" )
+        then
+                c.setPrice( c.getPrice() + 1 );
+                c.setType( "stilton" );
+                update( c );
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemoryError.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemoryError.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_OutOfMemoryError.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+package org.drools
+
+rule "empty rule"
+when
+then
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PredicateException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PredicateException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PredicateException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+function boolean throwException(Object object) {
+	throw new Exception( "this should throw an exception" );
+}
+
+rule "Throw Predicate Exception"
+    when
+    	Cheese( type1:type -> ( throwException( type1 ) ) )
+    then
+
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PropertyChange.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PropertyChange.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_PropertyChange.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.State;
+
+global java.util.List list
+
+rule simple
+    when
+        State( )
+    then
+		list.add("fired");
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QualifiedFieldReference.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QualifiedFieldReference.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QualifiedFieldReference.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test qualified field reference"
+when
+	$p : Person( $p.name == "bob" );
+	$c : Cheese( $c.type == $p.likes )
+then
+    results.add( $p );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Query.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Query.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Query.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools.integrationtests;
+
+import org.drools.InsertedObject;
+import java.util.ArrayList;
+
+rule rule1
+  when
+  then
+    insert( new InsertedObject( "value1") );
+    insert( new InsertedObject( "value2") );
+end
+
+query "assertedobjquery"
+    assertedobj : InsertedObject( value=="value1" )
+end 
+
+query "collect objects"
+    $list : ArrayList() from collect( InsertedObject() )
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QueryWithParams.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QueryWithParams.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_QueryWithParams.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools.integrationtests;
+
+import org.drools.InsertedObject;
+
+rule rule1
+  when
+  then
+    insert( new InsertedObject( "value1") );
+    insert( new InsertedObject( "value2") );
+end
+
+query "assertedobjquery" ( $value )
+    assertedobj : InsertedObject( value == $value )
+end 
+
+query "assertedobjquery2" ( $value1, String $value2 )
+    assertedobj : InsertedObject( value == $value2 )
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RemovePackage.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RemovePackage.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RemovePackage.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+import org.drools.Precondition;
+import org.drools.InsertedObject;
+
+rule rule1
+    salience 10
+    when
+        p: Precondition ( code == "genericcode")
+    then
+        insert( new InsertedObject( "value1") );
+        insert( new InsertedObject( "value2") );
+end
+
+rule rule2
+    when
+        p: Precondition ( code == "genericcode", value=="genericvalue")
+    then
+        insert( new InsertedObject( "value3") );
+        insert( new InsertedObject( "value4") );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RetractModifyWithFunction.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RetractModifyWithFunction.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RetractModifyWithFunction.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+package org.drools;
+ 
+function Cheese getMin(Cheese c1, Cheese c2) {
+ if (c1.getPrice() < c2.getPrice()) return c1;
+ else return c2;
+}
+
+rule "test modify"
+    salience 10
+    no-loop
+when
+	$c1 : Cheese( type == "stilton" )
+    $c2 : Cheese( type == "muzzarella" )
+then
+ 	Cheese x = getMin( $c1, $c2 );
+ 	x.setPrice( $c1.getPrice() + $c2.getPrice() );
+	update( x );
+	// testing stuff after the ) ;
+end
+
+rule "test retract"
+when
+	$c1 : Cheese( type == "stilton" )
+	$c2 : Cheese( type == "muzzarella" )
+then
+    // stuff before the retract( getMin( $c1, $c2 ) );
+    retract( getMin( $c1, $c2 ) );
+    // stuff before the retract( getMin( $c1, $c2 ) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueAndGlobal.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueAndGlobal.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueAndGlobal.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools;
+
+global java.lang.String cheeseType;
+global java.util.List   matchingList;
+global java.util.List   nonMatchingList;
+
+
+rule "Match type"
+	when
+		$cheese : Cheese( type == (cheeseType) )
+	then
+		matchingList.add( $cheese );
+end
+
+rule "Non matching type"
+	when
+		$cheese : Cheese( type != (cheeseType) )
+	then
+		nonMatchingList.add( $cheese );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueException.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueException.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ReturnValueException.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+function String throwException( ) {
+	throw new Exception( "this should throw an exception" );
+}
+
+rule "Throw ReturnValue Exception"
+    when
+    	Cheese( type == ( throwException( ) ) )
+    then
+
+end  

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.package1
+
+import org.drools.Cheese
+
+global java.util.List results;
+
+rule "rule 1"
+when
+    Cheese( type == "brie" )
+then
+    results.add("p1.r1");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.package2
+
+import org.drools.Cheese
+
+global java.util.List results;
+
+rule "rule 1"
+when
+    Cheese( type == "stilton" )
+then
+    results.add("p2.r1");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes3.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes3.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuleNameClashes3.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.package1
+
+import org.drools.Cheese
+
+global java.util.List results;
+
+rule "rule 1"
+when
+    Cheese( type == "muzzarella" )
+then
+    results.add("p1.r3");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Testing coercion"
+    salience 100
+	when
+		PolymorphicFact( $value : data < 15 )
+	then
+		results.add( $value );	
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_RuntimeTypeCoercion2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "Test boolean coercion"
+    salience 100
+    when
+        Primitives( booleanPrimitive == "true" )
+    then
+        results.add( "boolean" );
+end
+
+rule "Test boolean wrapper coercion"
+    salience 95
+    when
+        Primitives( booleanWrapper == "true" )
+    then
+        results.add( "boolean wrapper" );
+end
+
+rule "Test boolean object coercion"
+    salience 92
+    when
+        Primitives( object == "true" )
+    then
+        results.add( "boolean object" );
+end
+
+rule "Test char coercion"
+    salience 90
+    when
+        Primitives( charPrimitive == "X" )
+    then
+        results.add( "char" );
+end
+
+
+rule "Test object char coercion"
+    salience 85
+    when
+        Primitives( object == "X" )
+    then
+        results.add( "char object" );
+end
+
+
+rule "Test object null coercion"
+    salience 82
+    when
+        Primitives( object == null )
+    then
+        results.add( "null object" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "reversed references"
+when
+    $item : OrderItem( $order : order )
+    Order( this == $order )
+then
+    results.add( $item );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SelfReference2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "reversed references"
+when
+    $cheese : Cheese( )
+    Cheese( this != $cheese )
+then
+    results.add( $cheese );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Serializable.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Serializable.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_Serializable.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,53 @@
+package org.drools.test;
+
+import org.drools.Person;
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import java.util.List
+
+global List list
+
+rule "match Person 1"
+	salience 10
+	dialect "mvel"
+    when
+        $person : Person()
+    then
+		list.add( $person );
+        $person.setStatus("match Person ok");		
+end    
+
+rule "match Person 2"
+	agenda-group "xxx"	
+	salience ($age2 - $age1)
+    when
+       $person : Person(name=="mark", $age1 : age )
+       cheesery : Cheesery( cheeses contains $person )     
+       cheeses : List() from cheesery.getCheeses()           
+       Person( age < ( $age1 ) )
+       Person( $age2 : age -> ( $age1 == $age2 ) )      
+       eval( $age1 == $age2 )
+    then
+		list.add( $person );
+        $person.setStatus("match Person ok");		
+end   
+
+rule "match Person 3"
+	agenda-group "xxx"	
+	dialect "mvel"
+    when
+       not Person( name == "mark" )
+       exists Person( name == "mark" )       
+    then
+end 
+
+
+rule "match Integer"
+	agenda-group "yyy"	
+	auto-focus true
+    when
+		Person( name ==  "bob" )
+    then
+        insertLogical ( new Person( "help" ) );
+        list.add( new Integer( 4 ) );
+end 

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyInHirarchies.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyInHirarchies.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyInHirarchies.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools;
+
+rule "grand parent"
+	when
+		GrandParent( name == "gp" )
+	then
+		// do something
+end
+
+rule "parent"
+	when
+		Parent( name == "p" )
+	then
+		// do something
+end
+
+rule "child"
+	when
+		Child( name == "c" )
+	then
+		// do something
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyOnCollections.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyOnCollections.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ShadowProxyOnCollections.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools;
+
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "shadow proxy on collections"
+	when
+		$list : ArrayList() from collect( Cheesery() )
+	then
+	    Cheesery $c = (Cheesery) $list.get( 0 );
+	    Cheese cheese = new Cheese( "stilton", 10 );
+		$c.getCheeses().add( cheese );
+		results.add( cheese );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_StaticField.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_StaticField.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_StaticField.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.test
+
+import org.drools.Person
+import org.drools.Cheesery
+import org.drools.Cheesery.Maturity
+
+global java.util.List list
+
+rule "status, int based enum"
+	salience 10
+    when
+       	p : Cheesery(status == Cheesery.SELLING_CHEESE, maturity == Maturity.OLD)
+    then
+    	list.add( p );
+
+end   
+
+rule "maturity, object based enum"
+    when
+       	p : Cheesery(status == Cheesery.MAKING_CHEESE, maturity == Maturity.YOUNG)
+    then
+    	list.add( p );
+end  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SubNetworks.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SubNetworks.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_SubNetworks.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+import java.awt.*;
+
+rule "A"
+    when
+      exists(x : Dimension(x_height : height) and
+             y : Dimension(this!=x, height!=x_height))
+           
+    then
+      System.out.println("A");
+end
+
+rule "B"
+    when
+      not(exists(x : Dimension(x_height : height) and
+                 y : Dimension(this!=x, height!=x_height)))
+           
+    then
+      System.out.println("B");
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_TwoQuerries.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_TwoQuerries.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_TwoQuerries.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+query "find stinky cheeses"
+        Cheese(type == "stinky")
+end 
+
+query "find pensioners"
+        Person(age > 65)
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UnbalancedTrees.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UnbalancedTrees.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UnbalancedTrees.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+rule "test unbalanced tree"
+when
+    a: Cheese( type == "a" )
+    ( Cheese( type == "b" ) or
+      ( Cheese( type == "c" ) and Cheese( type == "d" ) ) 
+    ) 
+    e : Cheese( type == "e" )
+then
+    // this shall not throw any exception
+    e.setPrice( e.getPrice() + 10 );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateActivationCreationNoLoop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateActivationCreationNoLoop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateActivationCreationNoLoop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+rule "test1"
+	no-loop true
+	when
+        cheese : Cheese( price == 15 )
+        $p : Person( cheese == cheese )
+    then
+
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateNoloop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateNoloop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_UpdateNoloop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "test1"
+	salience 10
+	no-loop true
+	when
+        cheese : Cheese( price == 15 )
+    then
+    	update(cheese);
+end
+
+
+rule "test2"
+	salience 0
+	no-loop true
+	when
+        cheese : Cheese( price == 15 )
+    then
+    	cheese.setPrice( 14 );
+		update(cheese);
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_alphaNodeSharing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_alphaNodeSharing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_alphaNodeSharing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "First"
+salience 10
+ when
+  c: Person(age <= 10)
+ then
+  results.add("1");
+end
+ 
+rule "Second"
+salience 5
+ when
+     c: Person(age <= 10)
+ then
+  results.add("2");
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_bindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_bindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_bindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "bindings"
+when
+    Cheese( $t : type == "stilton" || $p : price == 10 )
+then
+    results.add( $t );
+    results.add( new Integer( $p ) );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_castsInsideEval.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_castsInsideEval.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_castsInsideEval.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools;
+
+global java.lang.Integer value;
+
+function boolean isEqual( Integer v1, Integer v2 ) {
+    return v1.equals( v2 );
+}
+
+rule "test casts"
+when
+    eval( isEqual((Integer) value, (Integer)value ) )
+then
+    // rule fired
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_charComparisons.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_charComparisons.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_charComparisons.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test chars 1"
+	salience 100
+when
+    Primitives( charPrimitive == 'a' ) 
+then
+    results.add( "1" );
+end
+
+rule "test chars 2"
+	salience 90
+when
+    Primitives( $c1: charPrimitive == 'a' ) 
+    Primitives( charPrimitive != $c1 )
+then
+    results.add( "2" );
+end
+
+rule "test chars 3"
+	salience 80
+when
+    Primitives( $c1: stringAttribute == 'a' ) 
+    Primitives( charPrimitive == $c1 )
+then
+    results.add( "3" );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_collectNodeSharing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_collectNodeSharing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_collectNodeSharing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+package org.drools;
+
+import java.util.ArrayList;
+
+global java.util.List results;
+
+rule "A"
+when
+    $a : ArrayList( size:size == 2 ) from collect (Cheese())
+then
+    results.add( $a );
+end
+
+rule "B"
+when
+    $b : ArrayList( size:size == 3 ) from collect (Cheese())
+then
+    results.add( $b );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_contains_in_array.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_contains_in_array.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_contains_in_array.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools;
+
+global java.util.List list;
+
+rule "contains in array"
+    salience 10
+	when
+		Primitives( stringArray contains "test1" )
+	then
+	    list.add( "ok1" );
+end
+
+rule "excludes in array"
+	when
+		Primitives( stringArray excludes "test2" )
+	then
+	    list.add( "ok2" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,2 @@
+[when] There is a {type} named {name} = {name} : {type}()
+[when] - {prop} is {val} = {prop} == {val}

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_dslWithIndividualConstraints.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools
+
+global java.util.List results
+
+expander test_dslWithIndividualConstraints.dsl
+
+rule "Bug with dot reduction"
+when
+    There is a Cheese named cs
+    - type is Cheese.STILTON
+then
+    >results.add( cs );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBinding.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBinding.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBinding.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+package org.drools;
+
+global java.util.Map results;
+
+rule "Duplicate Variable testing"
+ when
+   // there should be no problem since each variable 
+   // is in a different logical branch
+   Cheese( $type : type == "stilton", $price : price ) or
+   Cheese( $type : type == "brie", $price : price )
+ then
+   results.put( $type, new Integer( $price ) );
+end
+
+rule "Duplicate Variable testing 2"
+ when
+   // there should be no problem since each variable 
+   // is in a different logical branch
+   $cheese : Cheese( type == "stilton", $price : price ) or
+   $cheese : Cheese( type == "brie", $price : price )
+ then
+   results.put( $cheese, new Integer( $price ) );
+end
+
+rule "Duplicate Variable testing 3"
+ when
+   // there should be no problem since each variable 
+   // is in a different logical branch
+   Cheese( $type : type == "stilton", $price : price ) or
+   ( Cheese( $type : type == "brie", $price : price ) and Person( name == "bob", likes == $type ) )
+ then
+   results.put( "test3"+$type, new Integer( $price ) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBindingError.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBindingError.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_duplicateVariableBindingError.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package org.drools;
+
+global java.util.Map results;
+
+rule "Duplicate Variable testing"
+ when
+   // this must raise an error as the variables are in the same branch
+   Cheese( $type : type == "stilton", $price : price )
+   Cheese( $type : type == "brie", $price : price )
+ then
+   results.put( $type, new Integer( $price ) );
+end
+
+rule "Duplicate Variable testing 2"
+ when
+   // this must raise an error as the variables are in the same branch
+   $cheese : Cheese( type == "stilton", $price : price )
+   $cheese : Cheese( type == "brie", $price : price )
+ then
+   results.put( $cheese, new Integer( $price ) );
+end
+
+rule "Duplicate Variable testing 3"
+ when
+   // this must raise an error as the variables are in the same branch
+   Cheese( $type : type == "stilton", $price : price ) 
+   Cheese( $type : type == "brie", $price : price ) and Person( name == "bob", likes == $type )
+ then
+   results.put( "test3"+$type, new Integer( $price ) );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_emptyIdentifier.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_emptyIdentifier.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_emptyIdentifier.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+package org.drools
+
+global java.util.List results;
+
+rule "Or condition followed by fact"
+  when
+    Cheese( type == "stilton" ) or Cheese( type == "brie" )
+    Person( )
+  then
+    results.add("Or condition followed by fact is ok");
+end
+
+rule "Fact followed by or condition"
+  when
+    Person( )
+    Cheese( type == "stilton" ) or Cheese( type == "brie" )
+  then
+    results.add("Fact followed by or condition is ok");
+end
+
+rule "Single fact"
+  when
+    Person( )
+  then
+    results.add("Single fact is ok");
+end
+
+rule "Single or"
+  when
+    Cheese( type == "stilton" ) or Cheese( type == "brie" )
+  then
+    results.add("Single or is ok");
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_equalitySupport.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_equalitySupport.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_equalitySupport.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test equality support"
+	salience 10
+when
+    $p : PersonWithEquals( name == "bob" )
+then
+    $p.setName( "mark" );
+    results.add( $p.getName() );
+    update( $p );
+end
+
+rule "test 2"
+when
+    $p : PersonWithEquals( name == "bob" )
+then
+    results.add( "This rule should NEVER fire" );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_exists.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_exists.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_exists.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.examples;
+
+import org.drools.Person;
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "Buy cheese"
+when
+  $cheese: Cheese($type : type)
+  exists Person(likes == $type);
+then
+  list.add($cheese);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_expander.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_expander.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_expander.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+#some description
+[when]There is a person with the name of {name} who likes {cheese}=Person(name=="{name}", likes=={cheese})
+[when]There is some {cheese} cheese available=Cheese(type=="{cheese}")
+[then]Add the message {message}=messages.add({message});
+[when]person with eval=p : Person() eval(p.getName().equals("fire"))

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_fireLimit.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_fireLimit.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_fireLimit.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "fire"
+when
+    $old : Number( $val : intValue )
+then
+    results.add( $old );
+    insert( new Integer( $val + 1 ) );
+    retract( $old );
+end
+
+rule "stop"
+	salience 10
+when
+	$old : Number( intValue == 20 )
+then
+    retract( $old );
+    drools.halt();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_functionCallingFunction.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_functionCallingFunction.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_functionCallingFunction.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,50 @@
+package org.drools;
+
+global java.util.List results;
+
+function int f1(int i) {
+    return f2(i+1);
+}
+
+function int f2(int i) {
+    return f3(i+1);
+}
+
+function int f3(int i) {
+    return f4(i+1);
+}
+
+function int f4(int i) {
+    return f5(i+1);
+}
+
+function int f5(int i) {
+    return f6(i+1);
+}
+
+function int f6(int i) {
+    return f7(i+1);
+}
+
+function int f7(int i) {
+    return f8(i+1);
+}
+
+function int f8(int i) {
+    return f9(i+1);
+}
+
+function int f9(int i) {
+    return f10(i+1);
+}
+
+function int f10(int i) {
+    return i+1;
+}
+
+rule "X"
+when
+    eval( f1(0) == 10 )
+then
+    results.add( new Integer( f1(0) ) );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalCustomResolver.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalCustomResolver.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalCustomResolver.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list
+global java.lang.String string
+
+
+rule "global rule test"
+    salience 10
+    when
+        eval( "stilton".equals( string ) )
+    then
+		list.add( new Integer(5) );
+end    
+
+rule "global rule test with cheese"
+    when
+    	Cheese( price == 100 );
+        eval( "stilton".equals( string ) )
+    then
+		list.add( new Integer(6) );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalsAsConstraints.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalsAsConstraints.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_globalsAsConstraints.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools;
+
+global java.util.List cheeseTypes;
+global java.util.List results;
+
+rule "member of cheese types"
+when
+	Cheese( type memberOf cheeseTypes )
+then
+    results.add( "memberOf" );
+end
+
+rule "not member of cheese types"
+when
+    Cheese( type not memberOf cheeseTypes )
+then
+    results.add( "not memberOf" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_halt.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_halt.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_halt.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "fire"
+when
+    $old : Number( $val : intValue )
+then
+    results.add( $old );
+    insert( new Integer( $val + 1 ) );
+    retract( $old );
+end
+
+rule "stop"
+	salience 10
+when
+	Number( intValue == 10 )
+then
+    drools.halt();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_implicitDeclarations.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_implicitDeclarations.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_implicitDeclarations.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+global java.util.List results;
+
+global java.lang.Double factor;
+
+rule "test implicit declarations"
+	when
+ 	    // implicit binding
+		Cheese( type == "stilton", eval( price < 20*factor ) ) 
+		// late declaration
+		Cheese( price < ( price * factor ), eval( price < price * factor ), price : price  ) 
+	then
+		results.add( "Rule Fired" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_logicalInsertions3.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_logicalInsertions3.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_logicalInsertions3.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+package org.drools
+
+global java.util.List events;
+
+rule "#1: hot"
+when
+    $s : Sensor( temperature > 100 )
+then
+    events.add( "It is hot: " + $s );
+    insertLogical(new Alarm("FIRE"));
+end
+
+rule "#2: print out"
+when
+    Alarm( message == "FIRE" )
+then
+    events.add( "Fire alarm is ON" );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_memberOf.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_memberOf.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_memberOf.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Cheesery;
+
+global java.util.List list;
+
+rule "Stilton is memberOf Cheesery"
+    salience 10
+    when
+        Cheesery( $cheeses : cheeses )
+        cheese : Cheese( type memberOf $cheeses )
+    then
+		list.add( cheese );
+end   
+
+rule "Muzzarela is not memberOf Cheesery"
+    when
+        Cheesery( $cheeses : cheeses )
+        cheese : Cheese( type not memberOf $cheeses )
+    then
+		list.add( cheese );
+end   
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_missing_import.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_missing_import.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_missing_import.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package foo;
+
+rule "Generates NPE"
+  when
+    $count : Thing( size > 0 ) from collect( Gizmo( length == 1 ) )
+  then
+    System.out.println("boo");
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_multipleFroms.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_multipleFroms.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_multipleFroms.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+package org.drools
+
+import java.util.ArrayList;
+
+global org.drools.Cheesery cheesery;
+global java.util.List results;
+
+rule MyRule
+    dialect "java"
+when
+	$i : ArrayList() from collect(Cheese() from cheesery.getCheeses())
+    $k : ArrayList() from collect(Cheese() from cheesery.getCheeses())
+then
+    results.add( $i );
+    results.add( $k );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_mvel.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_mvel.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_mvel.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.util.List list2;
+
+function String someFunction() {
+    return "hello world";
+}
+
+rule "mvel1"
+	dialect "mvel"
+    when
+        $c : Cheese(type == "stilton", price == (new Integer( 5 ) + 5 ), eval(price == (new Integer( 5 ) + 5 ) ) )
+        eval( $c.price == 10 && list == empty)
+    then
+        Cheese cheese = new Cheese("cheddar", 35);
+
+        a = new java.math.BigInteger( "10" );
+        b = new java.math.BigInteger( "10" );
+        c = a + b;
+        list.add( c + $c.price);
+
+        modify ( $c ) { price = c }
+end
+
+
+rule "mvel2"
+	dialect "mvel"
+    when
+        $c : Cheese(type == "stilton", price == 20 )
+    then
+        list.add( $c.price + 2);
+        list2.add( someFunction() );
+        $c.usedBy = "10-Jul-1974"
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nodeSharingNotExists.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nodeSharingNotExists.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nodeSharingNotExists.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools;
+
+global java.util.List results;
+
+rule rule1
+when
+       not Cheese( type == Cheese.STILTON )
+then
+       results.add( "rule1" );
+end
+
+rule rule2
+when
+       exists Cheese( type == Cheese.STILTON )
+then
+       results.add( "rule2" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nullBindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nullBindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_nullBindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "null binding"
+when
+	bob : Person( name == "bob" )
+    a: Person( $name : name, eval($name != bob.getName()) )
+then
+    results.add("OK");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_primitiveArray.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_primitiveArray.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_primitiveArray.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools;
+
+global java.util.List result;
+
+function boolean testNonEmptyArray(int[] array) {
+   return array != null && array.length > 0;
+}
+
+function boolean isNonEmptyObjectArray(Object[] array) {
+   return array != null && array.length > 0;
+}
+
+rule "Primitive array in function" salience 20
+  when
+    Primitives( $array : primitiveArrayAttribute )
+    eval( testNonEmptyArray($array) )
+  then
+     result.add( new Integer( $array.length ) );
+end
+
+rule "Primitive Array with Object in function" salience 10
+ when
+   Primitives( $sArray : arrayAttribute )
+   eval( isNonEmptyObjectArray($sArray) )
+ then
+     result.add( new Integer( $sArray.length ) );
+end
+
+rule "Test Array" salience 0
+  when
+    Primitives( $array : primitiveArrayAttribute -> (($array != null) && ($array.length > 0)))
+  then
+    result.add( new Integer( $array.length ) );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_removeIdentitiesSubNetwork.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_removeIdentitiesSubNetwork.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_removeIdentitiesSubNetwork.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "multiple not's"
+when
+    $bob : Person( name == "bob", $likes : likes )
+    not Cheese( type == $likes )
+    not Cheese( type == $likes )
+then
+    results.add( $bob );
+end
+
+rule "subnetwork not's"
+when
+    $mark : Person( name == "mark", $likes : likes )
+    not ( Cheese( type == $likes ) and Cheese( type == $likes ) )
+then
+    results.add( $mark );
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+package com.sample
+ 
+import java.util.List;
+
+global List list
+
+rule "Rule1" ruleflow-group "flowgroup-1"
+	when
+		eval(true)
+	then
+		list.add("Rule1");
+end
+
+rule "Rule2" ruleflow-group "flowgroup-1"
+	when
+		eval(true)
+	then
+		list.add("Rule2");
+end
+
+rule "Rule3" ruleflow-group "flowgroup-1" salience 10
+	when
+		eval(true)
+	then
+		list.add("Rule3");
+end
+
+rule "Rule4" ruleflow-group "flowgroup-1" salience 20
+	when
+		eval(true)
+	then
+		list.add("Rule4");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,183 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>3-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>151</x>
+                  <y>98</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.workflow.core.node.RuleSetNode" id="5">
+                  <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+                  <id>3</id>
+                  <name>flowgroup-1</name>
+                  <incomingConnections id="6">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="7">
+                        <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                          <from class="org.drools.workflow.core.node.StartNode" id="9">
+                            <id>1</id>
+                            <name>Start</name>
+                            <incomingConnections id="10"/>
+                            <outgoingConnections id="11">
+                              <entry>
+                                <string>DROOLS_DEFAULT</string>
+                                <list id="12">
+                                  <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                                </list>
+                              </entry>
+                            </outgoingConnections>
+                            <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="13">
+                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="14">
+                                <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+                                <nodes id="15">
+                                  <entry>
+                                    <long>1</long>
+                                    <org.drools.workflow.core.node.StartNode reference="9"/>
+                                  </entry>
+                                  <entry>
+                                    <long>2</long>
+                                    <org.drools.workflow.core.node.EndNode id="16">
+                                      <id>2</id>
+                                      <name>End</name>
+                                      <incomingConnections id="17">
+                                        <entry>
+                                          <string>DROOLS_DEFAULT</string>
+                                          <list id="18">
+                                            <org.drools.workflow.core.impl.ConnectionImpl id="19">
+                                              <from class="org.drools.workflow.core.node.RuleSetNode" reference="5"/>
+                                              <to class="org.drools.workflow.core.node.EndNode" reference="16"/>
+                                              <fromType>DROOLS_DEFAULT</fromType>
+                                              <toType>DROOLS_DEFAULT</toType>
+                                            </org.drools.workflow.core.impl.ConnectionImpl>
+                                          </list>
+                                        </entry>
+                                      </incomingConnections>
+                                      <outgoingConnections id="20"/>
+                                      <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+                                    </org.drools.workflow.core.node.EndNode>
+                                  </entry>
+                                  <entry>
+                                    <long>3</long>
+                                    <org.drools.workflow.core.node.RuleSetNode reference="5"/>
+                                  </entry>
+                                </nodes>
+                                <lastNodeId>3</lastNodeId>
+                              </nodeContainer>
+                              <id>ruleFlowClear</id>
+                              <name>test_ruleflowClear</name>
+                              <type>RuleFlow</type>
+                              <packageName>com.sample</packageName>
+                              <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="21">
+                                <variables id="22"/>
+                              </variableScope>
+                            </nodeContainer>
+                          </from>
+                          <to class="org.drools.workflow.core.node.RuleSetNode" reference="5"/>
+                          <fromType>DROOLS_DEFAULT</fromType>
+                          <toType>DROOLS_DEFAULT</toType>
+                        </org.drools.workflow.core.impl.ConnectionImpl>
+                      </list>
+                    </entry>
+                  </incomingConnections>
+                  <outgoingConnections id="23">
+                    <entry>
+                      <string>DROOLS_DEFAULT</string>
+                      <list id="24">
+                        <org.drools.workflow.core.impl.ConnectionImpl reference="19"/>
+                      </list>
+                    </entry>
+                  </outgoingConnections>
+                  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+                </element>
+                <incomingConnections id="25">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="26" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="27"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="28" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="29">
+                                <x>32</x>
+                                <y>99</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.StartNode" reference="9"/>
+                              <incomingConnections id="30"/>
+                              <outgoingConnections id="31">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="26"/>
+                              </outgoingConnections>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="8"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="32">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="33" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <bendpoints id="34"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="3"/>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="35" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="36">
+                                <x>260</x>
+                                <y>98</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.workflow.core.node.EndNode" reference="16"/>
+                              <incomingConnections id="37">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="33"/>
+                              </incomingConnections>
+                              <outgoingConnections id="38"/>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </target>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection reference="19"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </outgoingConnections>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper>
+        </entry>
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="35"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="28"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,84 @@
+<org.drools.ruleflow.core.RuleFlowProcess id="1">
+  <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
+    <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+    <nodes id="3">
+      <entry>
+        <long>1</long>
+        <org.drools.workflow.core.node.StartNode id="4">
+          <id>1</id>
+          <name>Start</name>
+          <incomingConnections id="5"/>
+          <outgoingConnections id="6">
+            <entry>
+              <string>DROOLS_DEFAULT</string>
+              <list id="7">
+                <org.drools.workflow.core.impl.ConnectionImpl id="8">
+                  <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
+                  <to class="org.drools.workflow.core.node.RuleSetNode" id="9">
+                    <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+                    <id>3</id>
+                    <name>flowgroup-1</name>
+                    <incomingConnections id="10">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="11">
+                          <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
+                        </list>
+                      </entry>
+                    </incomingConnections>
+                    <outgoingConnections id="12">
+                      <entry>
+                        <string>DROOLS_DEFAULT</string>
+                        <list id="13">
+                          <org.drools.workflow.core.impl.ConnectionImpl id="14">
+                            <from class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
+                            <to class="org.drools.workflow.core.node.EndNode" id="15">
+                              <id>2</id>
+                              <name>End</name>
+                              <incomingConnections id="16">
+                                <entry>
+                                  <string>DROOLS_DEFAULT</string>
+                                  <list id="17">
+                                    <org.drools.workflow.core.impl.ConnectionImpl reference="14"/>
+                                  </list>
+                                </entry>
+                              </incomingConnections>
+                              <outgoingConnections id="18"/>
+                              <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                            </to>
+                            <fromType>DROOLS_DEFAULT</fromType>
+                            <toType>DROOLS_DEFAULT</toType>
+                          </org.drools.workflow.core.impl.ConnectionImpl>
+                        </list>
+                      </entry>
+                    </outgoingConnections>
+                    <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+                  </to>
+                  <fromType>DROOLS_DEFAULT</fromType>
+                  <toType>DROOLS_DEFAULT</toType>
+                </org.drools.workflow.core.impl.ConnectionImpl>
+              </list>
+            </entry>
+          </outgoingConnections>
+          <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
+        </org.drools.workflow.core.node.StartNode>
+      </entry>
+      <entry>
+        <long>2</long>
+        <org.drools.workflow.core.node.EndNode reference="15"/>
+      </entry>
+      <entry>
+        <long>3</long>
+        <org.drools.workflow.core.node.RuleSetNode reference="9"/>
+      </entry>
+    </nodes>
+    <lastNodeId>3</lastNodeId>
+  </nodeContainer>
+  <id>ruleFlowClear</id>
+  <name>test_ruleflowClear</name>
+  <type>RuleFlow</type>
+  <packageName>com.sample</packageName>
+  <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="19">
+    <variables id="20"/>
+  </variableScope>
+</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,154 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+  <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+    <default>
+      <elements id="2">
+        <entry>
+          <string>2-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
+            <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+              <default>
+                <constraint id="4">
+                  <x>530</x>
+                  <y>111</y>
+                  <width>80</width>
+                  <height>40</height>
+                </constraint>
+                <element class="org.drools.ruleflow.core.impl.EndNodeImpl" id="5">
+                  <id>2</id>
+                  <name>End</name>
+                  <incomingConnections id="6">
+                    <org.drools.ruleflow.core.impl.ConnectionImpl id="7">
+                      <type>1</type>
+                      <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="8">
+                        <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+                        <id>3</id>
+                        <name>flowgroup-1</name>
+                        <incomingConnections id="9">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl id="10">
+                            <type>1</type>
+                            <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="11">
+                              <id>1</id>
+                              <name>Start</name>
+                              <incomingConnections id="12"/>
+                              <outgoingConnections id="13">
+                                <org.drools.ruleflow.core.impl.ConnectionImpl reference="10"/>
+                              </outgoingConnections>
+                            </from>
+                            <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="8"/>
+                          </org.drools.ruleflow.core.impl.ConnectionImpl>
+                        </incomingConnections>
+                        <outgoingConnections id="14">
+                          <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
+                        </outgoingConnections>
+                      </from>
+                      <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="5"/>
+                    </org.drools.ruleflow.core.impl.ConnectionImpl>
+                  </incomingConnections>
+                  <outgoingConnections id="15"/>
+                </element>
+                <incomingConnections id="16">
+                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="17" serialization="custom">
+                    <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                      <default>
+                        <type>1</type>
+                        <bendpoints id="18"/>
+                        <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="19" serialization="custom">
+                          <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                            <default>
+                              <constraint id="20">
+                                <x>297</x>
+                                <y>112</y>
+                                <width>80</width>
+                                <height>40</height>
+                              </constraint>
+                              <element class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="8"/>
+                              <incomingConnections id="21">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="22" serialization="custom">
+                                  <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                    <default>
+                                      <type>1</type>
+                                      <bendpoints id="23"/>
+                                      <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="24" serialization="custom">
+                                        <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                          <default>
+                                            <constraint id="25">
+                                              <x>100</x>
+                                              <y>100</y>
+                                              <width>80</width>
+                                              <height>40</height>
+                                            </constraint>
+                                            <element class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="11"/>
+                                            <incomingConnections id="26"/>
+                                            <outgoingConnections id="27">
+                                              <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="22"/>
+                                            </outgoingConnections>
+                                          </default>
+                                        </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                                      </source>
+                                      <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="19"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                                  <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                    <default>
+                                      <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="10"/>
+                                    </default>
+                                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                                </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                              </incomingConnections>
+                              <outgoingConnections id="28">
+                                <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="17"/>
+                              </outgoingConnections>
+                              <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+                            </default>
+                          </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+                        </source>
+                        <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
+                      </default>
+                    </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+                    <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                      <default>
+                        <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="7"/>
+                      </default>
+                    </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                  </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+                </incomingConnections>
+                <outgoingConnections id="29"/>
+                <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+              </default>
+            </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+          </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
+        </entry>
+        <entry>
+          <string>3-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="19"/>
+        </entry>
+        <entry>
+          <string>1-Wrapper</string>
+          <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="24"/>
+        </entry>
+      </elements>
+      <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" id="30">
+        <nodes id="31">
+          <entry>
+            <long>2</long>
+            <org.drools.ruleflow.core.impl.EndNodeImpl reference="5"/>
+          </entry>
+          <entry>
+            <long>1</long>
+            <org.drools.ruleflow.core.impl.StartNodeImpl reference="11"/>
+          </entry>
+          <entry>
+            <long>3</long>
+            <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="8"/>
+          </entry>
+        </nodes>
+        <variables id="32"/>
+        <lastNodeId>3</lastNodeId>
+        <id>ruleFlowClear</id>
+        <name>test_ruleflowClear</name>
+        <type>RuleFlow</type>
+      </process>
+      <routerLayout>2</routerLayout>
+    </default>
+  </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,54 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+  <nodes id="2">
+    <entry>
+      <long>2</long>
+      <org.drools.ruleflow.core.impl.EndNodeImpl id="3">
+        <id>2</id>
+        <name>End</name>
+        <incomingConnections id="4">
+          <org.drools.ruleflow.core.impl.ConnectionImpl id="5">
+            <type>1</type>
+            <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="6">
+              <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
+              <id>3</id>
+              <name>flowgroup-1</name>
+              <incomingConnections id="7">
+                <org.drools.ruleflow.core.impl.ConnectionImpl id="8">
+                  <type>1</type>
+                  <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="9">
+                    <id>1</id>
+                    <name>Start</name>
+                    <incomingConnections id="10"/>
+                    <outgoingConnections id="11">
+                      <org.drools.ruleflow.core.impl.ConnectionImpl reference="8"/>
+                    </outgoingConnections>
+                  </from>
+                  <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="6"/>
+                </org.drools.ruleflow.core.impl.ConnectionImpl>
+              </incomingConnections>
+              <outgoingConnections id="12">
+                <org.drools.ruleflow.core.impl.ConnectionImpl reference="5"/>
+              </outgoingConnections>
+            </from>
+            <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="3"/>
+          </org.drools.ruleflow.core.impl.ConnectionImpl>
+        </incomingConnections>
+        <outgoingConnections id="13"/>
+      </org.drools.ruleflow.core.impl.EndNodeImpl>
+    </entry>
+    <entry>
+      <long>1</long>
+      <org.drools.ruleflow.core.impl.StartNodeImpl reference="9"/>
+    </entry>
+    <entry>
+      <long>3</long>
+      <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="6"/>
+    </entry>
+  </nodes>
+  <variables id="14"/>
+  <lastNodeId>3</lastNodeId>
+  <id>ruleFlowClear</id>
+  <name>test_ruleflowClear</name>
+  <type>RuleFlow</type>
+  <packageName>com.sample</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceExpressionRule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceExpressionRule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceExpressionRule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,35 @@
+package org.drools.test
+
+import org.drools.Person
+
+global java.util.List list
+
+# this rule shall never fire, since person will be retracted
+# by rule 2 that has a higher salience and will fire before rule 1
+rule "Salience rule 1" 
+    when
+        Person( )
+    then
+		list.add( "Rule 1" );
+end    
+
+# this rule shall fire second, since rule 3 has higher salience
+rule "Salience rule 2" 
+    salience (p.age * 2)
+    when
+        p : Person( name == "bob" )
+    then
+		list.add( "Rule 2" );
+		retract( p );
+end    
+
+# this rule shall fire first since it has the higher salience
+rule "Salience rule 3" 
+    salience (p.age * 2)
+    when
+        p : Person( name == "mic")
+    then
+		list.add( "Rule 3" );
+	    retract( p );
+end    
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceIntegerRule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceIntegerRule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_salienceIntegerRule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+package org.drools.test
+
+import org.drools.Person
+
+global java.util.List list
+
+# this rule shall never fire, since person will be retracted
+# by rule 2 that has a higher salience and will fire before rule 1
+rule "Salience rule 1" 
+    when
+        Person( )
+    then
+		list.add( "Rule 1" );
+end    
+
+# this rule shall fire second, since rule 3 has higher salience
+rule "Salience rule 2" 
+    salience 10
+    when
+        person: Person( )
+    then
+		list.add( "Rule 2" );
+		retract(person);
+end    
+
+# this rule shall fire first since it has the higher salience
+rule "Salience rule 3" 
+    salience 20
+    when
+        Person( )
+    then
+		list.add( "Rule 3" );
+end    
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_skipModify.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_skipModify.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/test_skipModify.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools;
+
+global java.util.List results;
+
+rule testSkipModify
+   when 
+       Cheese( $type : type )
+       Person( )
+       Person( likes == $type )
+       Person( $likes : likes, eval( $likes.equals( $type ) ) )
+       eval( $likes.equals( $type ) )
+   then
+       results.add( "FIRED" );
+end
+
+rule testSkipModify2
+   when 
+       Cheese( )
+       Person( )
+       Person( likes == "stilton" )
+       Person( $likes : likes, eval( $likes.equals( "stilton" ) ) )
+       eval( $likes.equals( "stilton" ) )
+   then
+       results.add( "FIRED" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/thread_class_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/thread_class_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/thread_class_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package nesting;
+
+#dialect "mvel"
+
+import org.drools.Person
+import org.drools.Address
+
+
+
+rule "test something"
+	
+	when
+		p: Person( name=="Michael", addresses != null)
+	then
+		p.setName("goo");
+		System.out.println(p.getName());	
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,511 @@
+#created on: 25/03/2006
+package org.benchmarks.waltz
+
+import org.drools.integrationtests.waltz.Stage
+import org.drools.integrationtests.waltz.Line
+import org.drools.integrationtests.waltz.Edge
+import org.drools.integrationtests.waltz.Junction
+import org.drools.integrationtests.waltz.WaltzUtil
+
+global java.io.PrintStream sysout;
+
+# the starting rule
+rule "begin waltz"
+	when
+		$stage : Stage(value == Stage.START)
+	then 
+	    insert (new Line( 122,  107));
+	    insert (new Line( 107, 2207));
+    	insert (new Line(2207, 3204));
+    	insert (new Line(3204, 6404));
+    	insert (new Line(2216, 2207));
+    	insert (new Line(3213, 3204));
+    	insert (new Line(2216, 3213));
+    	insert (new Line( 107, 2601));
+    	insert (new Line(2601, 7401));
+    	insert (new Line(6404, 7401));
+    	insert (new Line(3213, 6413));
+    	insert (new Line(6413, 6404));
+    	insert (new Line(7416, 7401));
+    	insert (new Line(5216, 6413));
+    	insert (new Line(2216, 5216));
+    	insert (new Line( 122, 5222));
+    	insert (new Line(5222, 7416));
+    	insert (new Line(5222, 5216));
+    	$stage.setValue(Stage.DUPLICATE);
+    	update ( $stage );
+    	//sysout.println("Waltz started");
+    	//sysout.println("Stage: duplicate");
+end
+
+#If the duplicate flag is set, and there is still a line in WM, delete the line
+#and add two edges. One edge runs from p1 to p2 and the other runs from p2 to
+#p1.  We then plot the edge.
+rule "reverse edges"
+	when
+		Stage(value == Stage.DUPLICATE)
+		$line : Line ( $p1:p1, $p2:p2 )
+	then 
+		//sysout.println("Draw "+$p1+" "+$p2);
+		insert( new Edge ( $p1, $p2, false, Edge.NIL, false ) );
+		insert( new Edge ( $p2, $p1, false, Edge.NIL, false ) );
+		retract( $line ); 
+end
+
+#If the duplicating flag is set, and there are no more lines, then remove the
+#duplicating flag and set the make junctions flag.
+rule "reversing done" salience -10
+	when
+        $stage: Stage ( value == Stage.DUPLICATE )
+        not ( Line() )
+	then
+	    modifyRetract( $stage );
+        $stage.setValue ( Stage.DETECT_JUNCTIONS );
+        modifyInsert( $stage );
+    	//sysout.println("reversing done");
+end
+
+#If three edges meet at a point and none of them have already been joined in
+#a junction, then make the corresponding type of junction and label the
+#edges joined.  This production calls make-3_junction to determine
+#what type of junction it is based on the angles inscribed by the
+#intersecting edges
+rule "make 3 junction" salience 10
+	when
+        Stage ( value == Stage.DETECT_JUNCTIONS )
+        $edge1: Edge( $basePoint:p1, $edge1P2:p2, joined==false )
+        $edge2: Edge( p1==$basePoint, $edge2P2:p2 != $edge1P2, joined == false )
+        $edge3: Edge( p1==$basePoint, $edge3P2:p2 != $edge1P2, p2 != $edge2P2, joined == false )
+	then
+	    Junction junction = WaltzUtil.make_3_junction( $basePoint, $edge1P2, $edge2P2, $edge3P2 );
+	    insert( junction );
+	    $edge1.setJoined(true);
+	    $edge2.setJoined(true);
+	    $edge3.setJoined(true);
+	    update( $edge1 );
+	    update( $edge2 );
+	    update( $edge3 );
+	    //sysout.println("make 3 junction");
+end
+
+#If two, and only two, edges meet that have not already been joined, then
+#the junction is an "L"
+rule "make L"
+	when
+        Stage ( value == Stage.DETECT_JUNCTIONS )
+        $edge1: Edge( $basePoint:p1, $edge1P2:p2, joined==false )
+        $edge2: Edge( p1==$basePoint, $edge2P2:p2 != $edge1P2, joined == false )
+        not Edge( p1==$basePoint, p2 != $edge1P2, p2 != $edge2P2 )
+	then
+	    insert( new Junction($edge1P2, $edge2P2, 0, $basePoint, Junction.L) );
+	    $edge1.setJoined(true);
+	    $edge2.setJoined(true);
+	    update( $edge1 );
+	    update( $edge2 );
+	    //sysout.println("make L");
+end
+
+#If the detect junctions flag is set, and there are no more un_joined edges,
+#set the find_initial_boundary flag
+rule "detecting done" salience -10
+    when
+        $stage : Stage ( value == Stage.DETECT_JUNCTIONS )
+ 	then
+ 	    $stage.setValue( Stage.FIND_INITIAL_BOUNDARY );
+ 	    update( $stage );
+    	//sysout.println("detecting done");
+end
+
+#If the initial boundary junction is an L, then we know it's labelling
+rule "initial boundary junction L"
+	when
+	    $stage : Stage ( value == Stage.FIND_INITIAL_BOUNDARY )
+	             Junction( type == Junction.L, $basePoint:basePoint, $p1:p1, $p2:p2 )
+	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
+	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
+        not Junction( basePoint > $basePoint )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.B );
+	    $stage.setValue( Stage.FIND_SECOND_BOUNDARY );
+	    update( $edge1 );
+	    update( $edge2 );
+	    update( $stage );
+    	//sysout.println("\n\ninitial boundary junction L\n\n");
+end
+
+# Ditto for an arrow
+rule "initial boundary junction arrow"
+	when
+	    $stage : Stage ( value == Stage.FIND_INITIAL_BOUNDARY )
+	             Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
+	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
+	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
+        not Junction( basePoint > $basePoint )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.PLUS );
+	    $edge3.setLabel( Edge.B );
+	    $stage.setValue( Stage.FIND_SECOND_BOUNDARY );
+	    update( $edge1 );
+	    update( $edge2 );
+	    update( $edge3 );
+	    update( $stage );
+    	//sysout.println("initial boundary junction arrow");
+end
+
+# If we have already found the first boundary point, then find the second
+# boundary point, and label it.
+rule "second boundary junction L"
+	when
+	    $stage : Stage ( value == Stage.FIND_SECOND_BOUNDARY )
+	             Junction( type == Junction.L, $basePoint:basePoint, $p1:p1, $p2:p2 )
+	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
+	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
+        not Junction( basePoint < $basePoint )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.B );
+	    $stage.setValue( Stage.LABELING );
+	    update( $edge1 );
+	    update( $edge2 );
+	    update( $stage );
+    	//sysout.println("second boundary junction L");
+end
+
+# Ditto for arrow
+rule "second boundary junction arrow"
+	when
+	    $stage : Stage ( value == Stage.FIND_SECOND_BOUNDARY )
+	             Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
+	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
+	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
+        not Junction( basePoint < $basePoint )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.PLUS );
+	    $edge3.setLabel( Edge.B );
+	    $stage.setValue( Stage.LABELING );
+	    update( $edge1 );
+	    update( $edge2 );
+	    update( $edge3 );
+	    update( $stage );
+    	//sysout.println("\n\nsecond boundary junction arrow\n\n");
+end
+ 
+# If we have an edge whose label we already know definitely, then
+# label the corresponding edge in the other direction
+rule "match edge"
+	when
+	    Stage( value == Stage.LABELING )
+        $edge1: Edge( $p1:p1, $p2:p2, $label:label == Edge.PLUS || == Edge.MINUS || == Edge.B )
+        $edge2: Edge( p1 == $p2, p2 == $p1, label == Edge.NIL )
+	then
+	    $edge1.setPlotted( true );
+	    $edge2.setLabel( $label );
+	    $edge2.setPlotted( true );
+	    update( $edge1 );
+	    update( $edge2 );
+	    //sysout.println("match edge - Plot "+$label+" "+$p1+" "+$p2);
+end
+
+# The following productions propogate the possible labellings of the edges
+# based on the labellings of edges incident on adjacent junctions.  Since
+# from the initial boundary productions, we have determined the labellings of
+# of atleast two junctions, this propogation will label all of the junctions
+# with the possible labellings.  The search space is pruned due to filtering,
+# i.e.(not only label a junction in the ways physically possible based on the
+# labellings of adjacent junctions.
+rule "label L"
+	when
+	    Stage( value == Stage.LABELING )
+	    Junction( type == Junction.L, $basePoint:basePoint )
+	    Edge( p1 == $basePoint, $Edge1P2 : p2, label == Edge.PLUS || == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $Edge1P2, label == Edge.NIL )
+	then
+	    $edge.setLabel( Edge.B );
+	    update( $edge );
+  	    //sysout.println("Label L");
+end 
+ 
+rule "label tee A" salience 5
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.TEE, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.B );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("Label tee A");	    
+end 
+
+
+rule "label tee B"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.TEE, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.B );
+	    $edge2.setLabel( Edge.B );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("Label tee B");	    	    
+end
+
+rule "label fork 1"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+                Edge( p1 == $basePoint, $p1:p2, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2 )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label fork 1");	    	    
+end
+
+rule "label fork 2"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.B )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
+	then
+	    $edge.setLabel( Edge.B );
+	    update( $edge );
+  	    //sysout.println("label fork 2");	   	    
+end
+
+rule "label fork 3"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.B )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.B )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
+	then
+	    $edge.setLabel( Edge.MINUS );
+	    update( $edge );
+  	    //sysout.println("label fork 3");	   	    
+end
+
+rule "label fork 4"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.MINUS )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
+	then
+	    $edge.setLabel( Edge.MINUS );
+	    update( $edge );
+  	    //sysout.println("label fork 4");	   	    
+end
+ 
+rule "label arrow 1A" salience 5
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, $label:label == Edge.B || == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( $label );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 1A");	   	    
+end
+ 
+rule "label arrow 1B" 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, $label:label == Edge.B || == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( $label );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 1B");	  
+end
+ 
+rule "label arrow 2A" salience 5 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, $label:label == Edge.B || == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1 )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( $label );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 2A");	  	    
+end
+ 
+rule "label arrow 2B"
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3,  $label:label == Edge.B || == Edge.MINUS  )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( $label );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 2B");	  	    	    
+end
+ 
+rule "label arrow 3A" salience 5 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
+	then
+	    $edge1.setLabel( Edge.MINUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 3A");	  	    	    
+end
+ 
+rule "label arrow 3B" 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.MINUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 3B");	  	    	    
+end
+ 
+rule "label arrow 4A" salience 5 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1 )
+	then
+	    $edge1.setLabel( Edge.MINUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 4A");	  	    	    
+end
+ 
+rule "label arrow 4B" 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.MINUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 4B");	  	    	    
+end
+ 
+rule "label arrow 5A" salience 5 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p2, label == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 5A");	  	    	    
+end
+
+rule "label arrow 5B" 
+	when
+        Stage( value == Stage.LABELING )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p2, label == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
+	then
+	    $edge1.setLabel( Edge.PLUS );
+	    $edge2.setLabel( Edge.PLUS );
+	    update( $edge1 );
+	    update( $edge2 );
+  	    //sysout.println("label arrow 5B");	  	    	    
+end
+ 
+# The conflict resolution mechanism will only execute a production if no
+# productions that are more complicated are satisfied.  This production is
+# simple, so all of the above dictionary productions will fire before this
+# change of state production
+rule "done labeling" salience -10
+	when
+        $stage: Stage( value == Stage.LABELING )
+	then
+        $stage.setValue( Stage.PLOT_REMAINING_EDGES );
+        update( $stage );
+    	//sysout.println("done labeling");
+end
+
+# At this point, some labellings may have not been plotted, so plot them
+rule "plot remaining"
+	when
+	    Stage( value == Stage.PLOT_REMAINING_EDGES )
+	    $edge: Edge( plotted == false, $label:label != Edge.NIL, $p1:p1, $p2:p2 )
+	then
+	    //sysout.println("Plot "+$label+" "+$p1+" "+$p2);
+	    $edge.setPlotted( true );
+	    update( $edge );
+end
+
+# If we have been un able to label an edge, assume that it is a boundary.
+# This is a total Kludge, but what the hell. (if we assume only valid drawings
+# will be given for labeling, this assumption generally is true!)
+rule "plot boundaries"
+    when
+	    Stage( value == Stage.PLOT_REMAINING_EDGES )
+	    $edge: Edge( plotted == false, label == Edge.NIL, $p1:p1, $p2:p2 )
+	then
+	    //sysout.println("Plot B "+$p1+" "+$p2);
+	    $edge.setPlotted( true );
+	    update( $edge );
+end
+
+# If there is no more work to do, then we are done and flag it.
+rule "done plotting" salience -10
+	when
+	    $stage: Stage( value == Stage.PLOT_REMAINING_EDGES )
+	then
+	    $stage.setValue( Stage.DONE );
+	    update( $stage );
+    	//sysout.println("Stage: done");
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz50.dat
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz50.dat	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/integrationtests/waltz/waltz50.dat	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3873 @@
+(make line ^p1 50003 ^p2 60003)
+(make line ^p1 30005 ^p2 30006)
+(make line ^p1 80005 ^p2 80006)
+(make line ^p1 50008 ^p2 60008)
+(make line ^p1 0 ^p2 20000)
+(make line ^p1 20000 ^p2 30000)
+(make line ^p1 30000 ^p2 40000)
+(make line ^p1 0 ^p2 2)
+(make line ^p1 2 ^p2 3)
+(make line ^p1 3 ^p2 4)
+(make line ^p1 4 ^p2 40004)
+(make line ^p1 40004 ^p2 40000)
+(make line ^p1 40000 ^p2 50001)
+(make line ^p1 50001 ^p2 50002)
+(make line ^p1 50002 ^p2 50003)
+(make line ^p1 50003 ^p2 50005)
+(make line ^p1 50005 ^p2 40004)
+(make line ^p1 50005 ^p2 30005)
+(make line ^p1 30005 ^p2 20005)
+(make line ^p1 20005 ^p2 10005)
+(make line ^p1 10005 ^p2 4)
+(make line ^p1 60000 ^p2 80000)
+(make line ^p1 80000 ^p2 90000)
+(make line ^p1 90000 ^p2 100000)
+(make line ^p1 60000 ^p2 60002)
+(make line ^p1 60002 ^p2 60003)
+(make line ^p1 60003 ^p2 60004)
+(make line ^p1 60004 ^p2 100004)
+(make line ^p1 100004 ^p2 100000)
+(make line ^p1 100000 ^p2 110001)
+(make line ^p1 110001 ^p2 110002)
+(make line ^p1 110002 ^p2 110003)
+(make line ^p1 110003 ^p2 110005)
+(make line ^p1 110005 ^p2 100004)
+(make line ^p1 110005 ^p2 90005)
+(make line ^p1 90005 ^p2 80005)
+(make line ^p1 80005 ^p2 70005)
+(make line ^p1 70005 ^p2 60004)
+(make line ^p1 6 ^p2 20006)
+(make line ^p1 20006 ^p2 30006)
+(make line ^p1 30006 ^p2 40006)
+(make line ^p1 6 ^p2 8)
+(make line ^p1 8 ^p2 9)
+(make line ^p1 9 ^p2 10)
+(make line ^p1 10 ^p2 40010)
+(make line ^p1 40010 ^p2 40006)
+(make line ^p1 40006 ^p2 50007)
+(make line ^p1 50007 ^p2 50008)
+(make line ^p1 50008 ^p2 50009)
+(make line ^p1 50009 ^p2 50011)
+(make line ^p1 50011 ^p2 40010)
+(make line ^p1 50011 ^p2 30011)
+(make line ^p1 30011 ^p2 20011)
+(make line ^p1 20011 ^p2 10011)
+(make line ^p1 10011 ^p2 10)
+(make line ^p1 60006 ^p2 80006)
+(make line ^p1 80006 ^p2 90006)
+(make line ^p1 90006 ^p2 100006)
+(make line ^p1 60006 ^p2 60008)
+(make line ^p1 60008 ^p2 60009)
+(make line ^p1 60009 ^p2 60010)
+(make line ^p1 60010 ^p2 100010)
+(make line ^p1 100010 ^p2 100006)
+(make line ^p1 100006 ^p2 110007)
+(make line ^p1 110007 ^p2 110008)
+(make line ^p1 110008 ^p2 110009)
+(make line ^p1 110009 ^p2 110011)
+(make line ^p1 110011 ^p2 100010)
+(make line ^p1 110011 ^p2 90011)
+(make line ^p1 90011 ^p2 80011)
+(make line ^p1 80011 ^p2 70011)
+(make line ^p1 70011 ^p2 60010)
+(make line ^p1 170003 ^p2 180003)
+(make line ^p1 150005 ^p2 150006)
+(make line ^p1 200005 ^p2 200006)
+(make line ^p1 170008 ^p2 180008)
+(make line ^p1 120000 ^p2 140000)
+(make line ^p1 140000 ^p2 150000)
+(make line ^p1 150000 ^p2 160000)
+(make line ^p1 120000 ^p2 120002)
+(make line ^p1 120002 ^p2 120003)
+(make line ^p1 120003 ^p2 120004)
+(make line ^p1 120004 ^p2 160004)
+(make line ^p1 160004 ^p2 160000)
+(make line ^p1 160000 ^p2 170001)
+(make line ^p1 170001 ^p2 170002)
+(make line ^p1 170002 ^p2 170003)
+(make line ^p1 170003 ^p2 170005)
+(make line ^p1 170005 ^p2 160004)
+(make line ^p1 170005 ^p2 150005)
+(make line ^p1 150005 ^p2 140005)
+(make line ^p1 140005 ^p2 130005)
+(make line ^p1 130005 ^p2 120004)
+(make line ^p1 180000 ^p2 200000)
+(make line ^p1 200000 ^p2 210000)
+(make line ^p1 210000 ^p2 220000)
+(make line ^p1 180000 ^p2 180002)
+(make line ^p1 180002 ^p2 180003)
+(make line ^p1 180003 ^p2 180004)
+(make line ^p1 180004 ^p2 220004)
+(make line ^p1 220004 ^p2 220000)
+(make line ^p1 220000 ^p2 230001)
+(make line ^p1 230001 ^p2 230002)
+(make line ^p1 230002 ^p2 230003)
+(make line ^p1 230003 ^p2 230005)
+(make line ^p1 230005 ^p2 220004)
+(make line ^p1 230005 ^p2 210005)
+(make line ^p1 210005 ^p2 200005)
+(make line ^p1 200005 ^p2 190005)
+(make line ^p1 190005 ^p2 180004)
+(make line ^p1 120006 ^p2 140006)
+(make line ^p1 140006 ^p2 150006)
+(make line ^p1 150006 ^p2 160006)
+(make line ^p1 120006 ^p2 120008)
+(make line ^p1 120008 ^p2 120009)
+(make line ^p1 120009 ^p2 120010)
+(make line ^p1 120010 ^p2 160010)
+(make line ^p1 160010 ^p2 160006)
+(make line ^p1 160006 ^p2 170007)
+(make line ^p1 170007 ^p2 170008)
+(make line ^p1 170008 ^p2 170009)
+(make line ^p1 170009 ^p2 170011)
+(make line ^p1 170011 ^p2 160010)
+(make line ^p1 170011 ^p2 150011)
+(make line ^p1 150011 ^p2 140011)
+(make line ^p1 140011 ^p2 130011)
+(make line ^p1 130011 ^p2 120010)
+(make line ^p1 180006 ^p2 200006)
+(make line ^p1 200006 ^p2 210006)
+(make line ^p1 210006 ^p2 220006)
+(make line ^p1 180006 ^p2 180008)
+(make line ^p1 180008 ^p2 180009)
+(make line ^p1 180009 ^p2 180010)
+(make line ^p1 180010 ^p2 220010)
+(make line ^p1 220010 ^p2 220006)
+(make line ^p1 220006 ^p2 230007)
+(make line ^p1 230007 ^p2 230008)
+(make line ^p1 230008 ^p2 230009)
+(make line ^p1 230009 ^p2 230011)
+(make line ^p1 230011 ^p2 220010)
+(make line ^p1 230011 ^p2 210011)
+(make line ^p1 210011 ^p2 200011)
+(make line ^p1 200011 ^p2 190011)
+(make line ^p1 190011 ^p2 180010)
+(make line ^p1 110003 ^p2 120003)
+(make line ^p1 90005 ^p2 90006)
+(make line ^p1 140005 ^p2 140006)
+(make line ^p1 110008 ^p2 120008)
+(make line ^p1 290003 ^p2 300003)
+(make line ^p1 270005 ^p2 270006)
+(make line ^p1 320005 ^p2 320006)
+(make line ^p1 290008 ^p2 300008)
+(make line ^p1 240000 ^p2 260000)
+(make line ^p1 260000 ^p2 270000)
+(make line ^p1 270000 ^p2 280000)
+(make line ^p1 240000 ^p2 240002)
+(make line ^p1 240002 ^p2 240003)
+(make line ^p1 240003 ^p2 240004)
+(make line ^p1 240004 ^p2 280004)
+(make line ^p1 280004 ^p2 280000)
+(make line ^p1 280000 ^p2 290001)
+(make line ^p1 290001 ^p2 290002)
+(make line ^p1 290002 ^p2 290003)
+(make line ^p1 290003 ^p2 290005)
+(make line ^p1 290005 ^p2 280004)
+(make line ^p1 290005 ^p2 270005)
+(make line ^p1 270005 ^p2 260005)
+(make line ^p1 260005 ^p2 250005)
+(make line ^p1 250005 ^p2 240004)
+(make line ^p1 300000 ^p2 320000)
+(make line ^p1 320000 ^p2 330000)
+(make line ^p1 330000 ^p2 340000)
+(make line ^p1 300000 ^p2 300002)
+(make line ^p1 300002 ^p2 300003)
+(make line ^p1 300003 ^p2 300004)
+(make line ^p1 300004 ^p2 340004)
+(make line ^p1 340004 ^p2 340000)
+(make line ^p1 340000 ^p2 350001)
+(make line ^p1 350001 ^p2 350002)
+(make line ^p1 350002 ^p2 350003)
+(make line ^p1 350003 ^p2 350005)
+(make line ^p1 350005 ^p2 340004)
+(make line ^p1 350005 ^p2 330005)
+(make line ^p1 330005 ^p2 320005)
+(make line ^p1 320005 ^p2 310005)
+(make line ^p1 310005 ^p2 300004)
+(make line ^p1 240006 ^p2 260006)
+(make line ^p1 260006 ^p2 270006)
+(make line ^p1 270006 ^p2 280006)
+(make line ^p1 240006 ^p2 240008)
+(make line ^p1 240008 ^p2 240009)
+(make line ^p1 240009 ^p2 240010)
+(make line ^p1 240010 ^p2 280010)
+(make line ^p1 280010 ^p2 280006)
+(make line ^p1 280006 ^p2 290007)
+(make line ^p1 290007 ^p2 290008)
+(make line ^p1 290008 ^p2 290009)
+(make line ^p1 290009 ^p2 290011)
+(make line ^p1 290011 ^p2 280010)
+(make line ^p1 290011 ^p2 270011)
+(make line ^p1 270011 ^p2 260011)
+(make line ^p1 260011 ^p2 250011)
+(make line ^p1 250011 ^p2 240010)
+(make line ^p1 300006 ^p2 320006)
+(make line ^p1 320006 ^p2 330006)
+(make line ^p1 330006 ^p2 340006)
+(make line ^p1 300006 ^p2 300008)
+(make line ^p1 300008 ^p2 300009)
+(make line ^p1 300009 ^p2 300010)
+(make line ^p1 300010 ^p2 340010)
+(make line ^p1 340010 ^p2 340006)
+(make line ^p1 340006 ^p2 350007)
+(make line ^p1 350007 ^p2 350008)
+(make line ^p1 350008 ^p2 350009)
+(make line ^p1 350009 ^p2 350011)
+(make line ^p1 350011 ^p2 340010)
+(make line ^p1 350011 ^p2 330011)
+(make line ^p1 330011 ^p2 320011)
+(make line ^p1 320011 ^p2 310011)
+(make line ^p1 310011 ^p2 300010)
+(make line ^p1 230003 ^p2 240003)
+(make line ^p1 210005 ^p2 210006)
+(make line ^p1 260005 ^p2 260006)
+(make line ^p1 230008 ^p2 240008)
+(make line ^p1 410003 ^p2 420003)
+(make line ^p1 390005 ^p2 390006)
+(make line ^p1 440005 ^p2 440006)
+(make line ^p1 410008 ^p2 420008)
+(make line ^p1 360000 ^p2 380000)
+(make line ^p1 380000 ^p2 390000)
+(make line ^p1 390000 ^p2 400000)
+(make line ^p1 360000 ^p2 360002)
+(make line ^p1 360002 ^p2 360003)
+(make line ^p1 360003 ^p2 360004)
+(make line ^p1 360004 ^p2 400004)
+(make line ^p1 400004 ^p2 400000)
+(make line ^p1 400000 ^p2 410001)
+(make line ^p1 410001 ^p2 410002)
+(make line ^p1 410002 ^p2 410003)
+(make line ^p1 410003 ^p2 410005)
+(make line ^p1 410005 ^p2 400004)
+(make line ^p1 410005 ^p2 390005)
+(make line ^p1 390005 ^p2 380005)
+(make line ^p1 380005 ^p2 370005)
+(make line ^p1 370005 ^p2 360004)
+(make line ^p1 420000 ^p2 440000)
+(make line ^p1 440000 ^p2 450000)
+(make line ^p1 450000 ^p2 460000)
+(make line ^p1 420000 ^p2 420002)
+(make line ^p1 420002 ^p2 420003)
+(make line ^p1 420003 ^p2 420004)
+(make line ^p1 420004 ^p2 460004)
+(make line ^p1 460004 ^p2 460000)
+(make line ^p1 460000 ^p2 470001)
+(make line ^p1 470001 ^p2 470002)
+(make line ^p1 470002 ^p2 470003)
+(make line ^p1 470003 ^p2 470005)
+(make line ^p1 470005 ^p2 460004)
+(make line ^p1 470005 ^p2 450005)
+(make line ^p1 450005 ^p2 440005)
+(make line ^p1 440005 ^p2 430005)
+(make line ^p1 430005 ^p2 420004)
+(make line ^p1 360006 ^p2 380006)
+(make line ^p1 380006 ^p2 390006)
+(make line ^p1 390006 ^p2 400006)
+(make line ^p1 360006 ^p2 360008)
+(make line ^p1 360008 ^p2 360009)
+(make line ^p1 360009 ^p2 360010)
+(make line ^p1 360010 ^p2 400010)
+(make line ^p1 400010 ^p2 400006)
+(make line ^p1 400006 ^p2 410007)
+(make line ^p1 410007 ^p2 410008)
+(make line ^p1 410008 ^p2 410009)
+(make line ^p1 410009 ^p2 410011)
+(make line ^p1 410011 ^p2 400010)
+(make line ^p1 410011 ^p2 390011)
+(make line ^p1 390011 ^p2 380011)
+(make line ^p1 380011 ^p2 370011)
+(make line ^p1 370011 ^p2 360010)
+(make line ^p1 420006 ^p2 440006)
+(make line ^p1 440006 ^p2 450006)
+(make line ^p1 450006 ^p2 460006)
+(make line ^p1 420006 ^p2 420008)
+(make line ^p1 420008 ^p2 420009)
+(make line ^p1 420009 ^p2 420010)
+(make line ^p1 420010 ^p2 460010)
+(make line ^p1 460010 ^p2 460006)
+(make line ^p1 460006 ^p2 470007)
+(make line ^p1 470007 ^p2 470008)
+(make line ^p1 470008 ^p2 470009)
+(make line ^p1 470009 ^p2 470011)
+(make line ^p1 470011 ^p2 460010)
+(make line ^p1 470011 ^p2 450011)
+(make line ^p1 450011 ^p2 440011)
+(make line ^p1 440011 ^p2 430011)
+(make line ^p1 430011 ^p2 420010)
+(make line ^p1 350003 ^p2 360003)
+(make line ^p1 330005 ^p2 330006)
+(make line ^p1 380005 ^p2 380006)
+(make line ^p1 350008 ^p2 360008)
+(make line ^p1 530003 ^p2 540003)
+(make line ^p1 510005 ^p2 510006)
+(make line ^p1 560005 ^p2 560006)
+(make line ^p1 530008 ^p2 540008)
+(make line ^p1 480000 ^p2 500000)
+(make line ^p1 500000 ^p2 510000)
+(make line ^p1 510000 ^p2 520000)
+(make line ^p1 480000 ^p2 480002)
+(make line ^p1 480002 ^p2 480003)
+(make line ^p1 480003 ^p2 480004)
+(make line ^p1 480004 ^p2 520004)
+(make line ^p1 520004 ^p2 520000)
+(make line ^p1 520000 ^p2 530001)
+(make line ^p1 530001 ^p2 530002)
+(make line ^p1 530002 ^p2 530003)
+(make line ^p1 530003 ^p2 530005)
+(make line ^p1 530005 ^p2 520004)
+(make line ^p1 530005 ^p2 510005)
+(make line ^p1 510005 ^p2 500005)
+(make line ^p1 500005 ^p2 490005)
+(make line ^p1 490005 ^p2 480004)
+(make line ^p1 540000 ^p2 560000)
+(make line ^p1 560000 ^p2 570000)
+(make line ^p1 570000 ^p2 580000)
+(make line ^p1 540000 ^p2 540002)
+(make line ^p1 540002 ^p2 540003)
+(make line ^p1 540003 ^p2 540004)
+(make line ^p1 540004 ^p2 580004)
+(make line ^p1 580004 ^p2 580000)
+(make line ^p1 580000 ^p2 590001)
+(make line ^p1 590001 ^p2 590002)
+(make line ^p1 590002 ^p2 590003)
+(make line ^p1 590003 ^p2 590005)
+(make line ^p1 590005 ^p2 580004)
+(make line ^p1 590005 ^p2 570005)
+(make line ^p1 570005 ^p2 560005)
+(make line ^p1 560005 ^p2 550005)
+(make line ^p1 550005 ^p2 540004)
+(make line ^p1 480006 ^p2 500006)
+(make line ^p1 500006 ^p2 510006)
+(make line ^p1 510006 ^p2 520006)
+(make line ^p1 480006 ^p2 480008)
+(make line ^p1 480008 ^p2 480009)
+(make line ^p1 480009 ^p2 480010)
+(make line ^p1 480010 ^p2 520010)
+(make line ^p1 520010 ^p2 520006)
+(make line ^p1 520006 ^p2 530007)
+(make line ^p1 530007 ^p2 530008)
+(make line ^p1 530008 ^p2 530009)
+(make line ^p1 530009 ^p2 530011)
+(make line ^p1 530011 ^p2 520010)
+(make line ^p1 530011 ^p2 510011)
+(make line ^p1 510011 ^p2 500011)
+(make line ^p1 500011 ^p2 490011)
+(make line ^p1 490011 ^p2 480010)
+(make line ^p1 540006 ^p2 560006)
+(make line ^p1 560006 ^p2 570006)
+(make line ^p1 570006 ^p2 580006)
+(make line ^p1 540006 ^p2 540008)
+(make line ^p1 540008 ^p2 540009)
+(make line ^p1 540009 ^p2 540010)
+(make line ^p1 540010 ^p2 580010)
+(make line ^p1 580010 ^p2 580006)
+(make line ^p1 580006 ^p2 590007)
+(make line ^p1 590007 ^p2 590008)
+(make line ^p1 590008 ^p2 590009)
+(make line ^p1 590009 ^p2 590011)
+(make line ^p1 590011 ^p2 580010)
+(make line ^p1 590011 ^p2 570011)
+(make line ^p1 570011 ^p2 560011)
+(make line ^p1 560011 ^p2 550011)
+(make line ^p1 550011 ^p2 540010)
+(make line ^p1 470003 ^p2 480003)
+(make line ^p1 450005 ^p2 450006)
+(make line ^p1 500005 ^p2 500006)
+(make line ^p1 470008 ^p2 480008)
+(make line ^p1 650003 ^p2 660003)
+(make line ^p1 630005 ^p2 630006)
+(make line ^p1 680005 ^p2 680006)
+(make line ^p1 650008 ^p2 660008)
+(make line ^p1 600000 ^p2 620000)
+(make line ^p1 620000 ^p2 630000)
+(make line ^p1 630000 ^p2 640000)
+(make line ^p1 600000 ^p2 600002)
+(make line ^p1 600002 ^p2 600003)
+(make line ^p1 600003 ^p2 600004)
+(make line ^p1 600004 ^p2 640004)
+(make line ^p1 640004 ^p2 640000)
+(make line ^p1 640000 ^p2 650001)
+(make line ^p1 650001 ^p2 650002)
+(make line ^p1 650002 ^p2 650003)
+(make line ^p1 650003 ^p2 650005)
+(make line ^p1 650005 ^p2 640004)
+(make line ^p1 650005 ^p2 630005)
+(make line ^p1 630005 ^p2 620005)
+(make line ^p1 620005 ^p2 610005)
+(make line ^p1 610005 ^p2 600004)
+(make line ^p1 660000 ^p2 680000)
+(make line ^p1 680000 ^p2 690000)
+(make line ^p1 690000 ^p2 700000)
+(make line ^p1 660000 ^p2 660002)
+(make line ^p1 660002 ^p2 660003)
+(make line ^p1 660003 ^p2 660004)
+(make line ^p1 660004 ^p2 700004)
+(make line ^p1 700004 ^p2 700000)
+(make line ^p1 700000 ^p2 710001)
+(make line ^p1 710001 ^p2 710002)
+(make line ^p1 710002 ^p2 710003)
+(make line ^p1 710003 ^p2 710005)
+(make line ^p1 710005 ^p2 700004)
+(make line ^p1 710005 ^p2 690005)
+(make line ^p1 690005 ^p2 680005)
+(make line ^p1 680005 ^p2 670005)
+(make line ^p1 670005 ^p2 660004)
+(make line ^p1 600006 ^p2 620006)
+(make line ^p1 620006 ^p2 630006)
+(make line ^p1 630006 ^p2 640006)
+(make line ^p1 600006 ^p2 600008)
+(make line ^p1 600008 ^p2 600009)
+(make line ^p1 600009 ^p2 600010)
+(make line ^p1 600010 ^p2 640010)
+(make line ^p1 640010 ^p2 640006)
+(make line ^p1 640006 ^p2 650007)
+(make line ^p1 650007 ^p2 650008)
+(make line ^p1 650008 ^p2 650009)
+(make line ^p1 650009 ^p2 650011)
+(make line ^p1 650011 ^p2 640010)
+(make line ^p1 650011 ^p2 630011)
+(make line ^p1 630011 ^p2 620011)
+(make line ^p1 620011 ^p2 610011)
+(make line ^p1 610011 ^p2 600010)
+(make line ^p1 660006 ^p2 680006)
+(make line ^p1 680006 ^p2 690006)
+(make line ^p1 690006 ^p2 700006)
+(make line ^p1 660006 ^p2 660008)
+(make line ^p1 660008 ^p2 660009)
+(make line ^p1 660009 ^p2 660010)
+(make line ^p1 660010 ^p2 700010)
+(make line ^p1 700010 ^p2 700006)
+(make line ^p1 700006 ^p2 710007)
+(make line ^p1 710007 ^p2 710008)
+(make line ^p1 710008 ^p2 710009)
+(make line ^p1 710009 ^p2 710011)
+(make line ^p1 710011 ^p2 700010)
+(make line ^p1 710011 ^p2 690011)
+(make line ^p1 690011 ^p2 680011)
+(make line ^p1 680011 ^p2 670011)
+(make line ^p1 670011 ^p2 660010)
+(make line ^p1 590003 ^p2 600003)
+(make line ^p1 570005 ^p2 570006)
+(make line ^p1 620005 ^p2 620006)
+(make line ^p1 590008 ^p2 600008)
+(make line ^p1 770003 ^p2 780003)
+(make line ^p1 750005 ^p2 750006)
+(make line ^p1 800005 ^p2 800006)
+(make line ^p1 770008 ^p2 780008)
+(make line ^p1 720000 ^p2 740000)
+(make line ^p1 740000 ^p2 750000)
+(make line ^p1 750000 ^p2 760000)
+(make line ^p1 720000 ^p2 720002)
+(make line ^p1 720002 ^p2 720003)
+(make line ^p1 720003 ^p2 720004)
+(make line ^p1 720004 ^p2 760004)
+(make line ^p1 760004 ^p2 760000)
+(make line ^p1 760000 ^p2 770001)
+(make line ^p1 770001 ^p2 770002)
+(make line ^p1 770002 ^p2 770003)
+(make line ^p1 770003 ^p2 770005)
+(make line ^p1 770005 ^p2 760004)
+(make line ^p1 770005 ^p2 750005)
+(make line ^p1 750005 ^p2 740005)
+(make line ^p1 740005 ^p2 730005)
+(make line ^p1 730005 ^p2 720004)
+(make line ^p1 780000 ^p2 800000)
+(make line ^p1 800000 ^p2 810000)
+(make line ^p1 810000 ^p2 820000)
+(make line ^p1 780000 ^p2 780002)
+(make line ^p1 780002 ^p2 780003)
+(make line ^p1 780003 ^p2 780004)
+(make line ^p1 780004 ^p2 820004)
+(make line ^p1 820004 ^p2 820000)
+(make line ^p1 820000 ^p2 830001)
+(make line ^p1 830001 ^p2 830002)
+(make line ^p1 830002 ^p2 830003)
+(make line ^p1 830003 ^p2 830005)
+(make line ^p1 830005 ^p2 820004)
+(make line ^p1 830005 ^p2 810005)
+(make line ^p1 810005 ^p2 800005)
+(make line ^p1 800005 ^p2 790005)
+(make line ^p1 790005 ^p2 780004)
+(make line ^p1 720006 ^p2 740006)
+(make line ^p1 740006 ^p2 750006)
+(make line ^p1 750006 ^p2 760006)
+(make line ^p1 720006 ^p2 720008)
+(make line ^p1 720008 ^p2 720009)
+(make line ^p1 720009 ^p2 720010)
+(make line ^p1 720010 ^p2 760010)
+(make line ^p1 760010 ^p2 760006)
+(make line ^p1 760006 ^p2 770007)
+(make line ^p1 770007 ^p2 770008)
+(make line ^p1 770008 ^p2 770009)
+(make line ^p1 770009 ^p2 770011)
+(make line ^p1 770011 ^p2 760010)
+(make line ^p1 770011 ^p2 750011)
+(make line ^p1 750011 ^p2 740011)
+(make line ^p1 740011 ^p2 730011)
+(make line ^p1 730011 ^p2 720010)
+(make line ^p1 780006 ^p2 800006)
+(make line ^p1 800006 ^p2 810006)
+(make line ^p1 810006 ^p2 820006)
+(make line ^p1 780006 ^p2 780008)
+(make line ^p1 780008 ^p2 780009)
+(make line ^p1 780009 ^p2 780010)
+(make line ^p1 780010 ^p2 820010)
+(make line ^p1 820010 ^p2 820006)
+(make line ^p1 820006 ^p2 830007)
+(make line ^p1 830007 ^p2 830008)
+(make line ^p1 830008 ^p2 830009)
+(make line ^p1 830009 ^p2 830011)
+(make line ^p1 830011 ^p2 820010)
+(make line ^p1 830011 ^p2 810011)
+(make line ^p1 810011 ^p2 800011)
+(make line ^p1 800011 ^p2 790011)
+(make line ^p1 790011 ^p2 780010)
+(make line ^p1 710003 ^p2 720003)
+(make line ^p1 690005 ^p2 690006)
+(make line ^p1 740005 ^p2 740006)
+(make line ^p1 710008 ^p2 720008)
+(make line ^p1 890003 ^p2 900003)
+(make line ^p1 870005 ^p2 870006)
+(make line ^p1 920005 ^p2 920006)
+(make line ^p1 890008 ^p2 900008)
+(make line ^p1 840000 ^p2 860000)
+(make line ^p1 860000 ^p2 870000)
+(make line ^p1 870000 ^p2 880000)
+(make line ^p1 840000 ^p2 840002)
+(make line ^p1 840002 ^p2 840003)
+(make line ^p1 840003 ^p2 840004)
+(make line ^p1 840004 ^p2 880004)
+(make line ^p1 880004 ^p2 880000)
+(make line ^p1 880000 ^p2 890001)
+(make line ^p1 890001 ^p2 890002)
+(make line ^p1 890002 ^p2 890003)
+(make line ^p1 890003 ^p2 890005)
+(make line ^p1 890005 ^p2 880004)
+(make line ^p1 890005 ^p2 870005)
+(make line ^p1 870005 ^p2 860005)
+(make line ^p1 860005 ^p2 850005)
+(make line ^p1 850005 ^p2 840004)
+(make line ^p1 900000 ^p2 920000)
+(make line ^p1 920000 ^p2 930000)
+(make line ^p1 930000 ^p2 940000)
+(make line ^p1 900000 ^p2 900002)
+(make line ^p1 900002 ^p2 900003)
+(make line ^p1 900003 ^p2 900004)
+(make line ^p1 900004 ^p2 940004)
+(make line ^p1 940004 ^p2 940000)
+(make line ^p1 940000 ^p2 950001)
+(make line ^p1 950001 ^p2 950002)
+(make line ^p1 950002 ^p2 950003)
+(make line ^p1 950003 ^p2 950005)
+(make line ^p1 950005 ^p2 940004)
+(make line ^p1 950005 ^p2 930005)
+(make line ^p1 930005 ^p2 920005)
+(make line ^p1 920005 ^p2 910005)
+(make line ^p1 910005 ^p2 900004)
+(make line ^p1 840006 ^p2 860006)
+(make line ^p1 860006 ^p2 870006)
+(make line ^p1 870006 ^p2 880006)
+(make line ^p1 840006 ^p2 840008)
+(make line ^p1 840008 ^p2 840009)
+(make line ^p1 840009 ^p2 840010)
+(make line ^p1 840010 ^p2 880010)
+(make line ^p1 880010 ^p2 880006)
+(make line ^p1 880006 ^p2 890007)
+(make line ^p1 890007 ^p2 890008)
+(make line ^p1 890008 ^p2 890009)
+(make line ^p1 890009 ^p2 890011)
+(make line ^p1 890011 ^p2 880010)
+(make line ^p1 890011 ^p2 870011)
+(make line ^p1 870011 ^p2 860011)
+(make line ^p1 860011 ^p2 850011)
+(make line ^p1 850011 ^p2 840010)
+(make line ^p1 900006 ^p2 920006)
+(make line ^p1 920006 ^p2 930006)
+(make line ^p1 930006 ^p2 940006)
+(make line ^p1 900006 ^p2 900008)
+(make line ^p1 900008 ^p2 900009)
+(make line ^p1 900009 ^p2 900010)
+(make line ^p1 900010 ^p2 940010)
+(make line ^p1 940010 ^p2 940006)
+(make line ^p1 940006 ^p2 950007)
+(make line ^p1 950007 ^p2 950008)
+(make line ^p1 950008 ^p2 950009)
+(make line ^p1 950009 ^p2 950011)
+(make line ^p1 950011 ^p2 940010)
+(make line ^p1 950011 ^p2 930011)
+(make line ^p1 930011 ^p2 920011)
+(make line ^p1 920011 ^p2 910011)
+(make line ^p1 910011 ^p2 900010)
+(make line ^p1 830003 ^p2 840003)
+(make line ^p1 810005 ^p2 810006)
+(make line ^p1 860005 ^p2 860006)
+(make line ^p1 830008 ^p2 840008)
+(make line ^p1 1010003 ^p2 1020003)
+(make line ^p1 990005 ^p2 990006)
+(make line ^p1 1040005 ^p2 1040006)
+(make line ^p1 1010008 ^p2 1020008)
+(make line ^p1 960000 ^p2 980000)
+(make line ^p1 980000 ^p2 990000)
+(make line ^p1 990000 ^p2 1000000)
+(make line ^p1 960000 ^p2 960002)
+(make line ^p1 960002 ^p2 960003)
+(make line ^p1 960003 ^p2 960004)
+(make line ^p1 960004 ^p2 1000004)
+(make line ^p1 1000004 ^p2 1000000)
+(make line ^p1 1000000 ^p2 1010001)
+(make line ^p1 1010001 ^p2 1010002)
+(make line ^p1 1010002 ^p2 1010003)
+(make line ^p1 1010003 ^p2 1010005)
+(make line ^p1 1010005 ^p2 1000004)
+(make line ^p1 1010005 ^p2 990005)
+(make line ^p1 990005 ^p2 980005)
+(make line ^p1 980005 ^p2 970005)
+(make line ^p1 970005 ^p2 960004)
+(make line ^p1 1020000 ^p2 1040000)
+(make line ^p1 1040000 ^p2 1050000)
+(make line ^p1 1050000 ^p2 1060000)
+(make line ^p1 1020000 ^p2 1020002)
+(make line ^p1 1020002 ^p2 1020003)
+(make line ^p1 1020003 ^p2 1020004)
+(make line ^p1 1020004 ^p2 1060004)
+(make line ^p1 1060004 ^p2 1060000)
+(make line ^p1 1060000 ^p2 1070001)
+(make line ^p1 1070001 ^p2 1070002)
+(make line ^p1 1070002 ^p2 1070003)
+(make line ^p1 1070003 ^p2 1070005)
+(make line ^p1 1070005 ^p2 1060004)
+(make line ^p1 1070005 ^p2 1050005)
+(make line ^p1 1050005 ^p2 1040005)
+(make line ^p1 1040005 ^p2 1030005)
+(make line ^p1 1030005 ^p2 1020004)
+(make line ^p1 960006 ^p2 980006)
+(make line ^p1 980006 ^p2 990006)
+(make line ^p1 990006 ^p2 1000006)
+(make line ^p1 960006 ^p2 960008)
+(make line ^p1 960008 ^p2 960009)
+(make line ^p1 960009 ^p2 960010)
+(make line ^p1 960010 ^p2 1000010)
+(make line ^p1 1000010 ^p2 1000006)
+(make line ^p1 1000006 ^p2 1010007)
+(make line ^p1 1010007 ^p2 1010008)
+(make line ^p1 1010008 ^p2 1010009)
+(make line ^p1 1010009 ^p2 1010011)
+(make line ^p1 1010011 ^p2 1000010)
+(make line ^p1 1010011 ^p2 990011)
+(make line ^p1 990011 ^p2 980011)
+(make line ^p1 980011 ^p2 970011)
+(make line ^p1 970011 ^p2 960010)
+(make line ^p1 1020006 ^p2 1040006)
+(make line ^p1 1040006 ^p2 1050006)
+(make line ^p1 1050006 ^p2 1060006)
+(make line ^p1 1020006 ^p2 1020008)
+(make line ^p1 1020008 ^p2 1020009)
+(make line ^p1 1020009 ^p2 1020010)
+(make line ^p1 1020010 ^p2 1060010)
+(make line ^p1 1060010 ^p2 1060006)
+(make line ^p1 1060006 ^p2 1070007)
+(make line ^p1 1070007 ^p2 1070008)
+(make line ^p1 1070008 ^p2 1070009)
+(make line ^p1 1070009 ^p2 1070011)
+(make line ^p1 1070011 ^p2 1060010)
+(make line ^p1 1070011 ^p2 1050011)
+(make line ^p1 1050011 ^p2 1040011)
+(make line ^p1 1040011 ^p2 1030011)
+(make line ^p1 1030011 ^p2 1020010)
+(make line ^p1 950003 ^p2 960003)
+(make line ^p1 930005 ^p2 930006)
+(make line ^p1 980005 ^p2 980006)
+(make line ^p1 950008 ^p2 960008)
+(make line ^p1 1130003 ^p2 1140003)
+(make line ^p1 1110005 ^p2 1110006)
+(make line ^p1 1160005 ^p2 1160006)
+(make line ^p1 1130008 ^p2 1140008)
+(make line ^p1 1080000 ^p2 1100000)
+(make line ^p1 1100000 ^p2 1110000)
+(make line ^p1 1110000 ^p2 1120000)
+(make line ^p1 1080000 ^p2 1080002)
+(make line ^p1 1080002 ^p2 1080003)
+(make line ^p1 1080003 ^p2 1080004)
+(make line ^p1 1080004 ^p2 1120004)
+(make line ^p1 1120004 ^p2 1120000)
+(make line ^p1 1120000 ^p2 1130001)
+(make line ^p1 1130001 ^p2 1130002)
+(make line ^p1 1130002 ^p2 1130003)
+(make line ^p1 1130003 ^p2 1130005)
+(make line ^p1 1130005 ^p2 1120004)
+(make line ^p1 1130005 ^p2 1110005)
+(make line ^p1 1110005 ^p2 1100005)
+(make line ^p1 1100005 ^p2 1090005)
+(make line ^p1 1090005 ^p2 1080004)
+(make line ^p1 1140000 ^p2 1160000)
+(make line ^p1 1160000 ^p2 1170000)
+(make line ^p1 1170000 ^p2 1180000)
+(make line ^p1 1140000 ^p2 1140002)
+(make line ^p1 1140002 ^p2 1140003)
+(make line ^p1 1140003 ^p2 1140004)
+(make line ^p1 1140004 ^p2 1180004)
+(make line ^p1 1180004 ^p2 1180000)
+(make line ^p1 1180000 ^p2 1190001)
+(make line ^p1 1190001 ^p2 1190002)
+(make line ^p1 1190002 ^p2 1190003)
+(make line ^p1 1190003 ^p2 1190005)
+(make line ^p1 1190005 ^p2 1180004)
+(make line ^p1 1190005 ^p2 1170005)
+(make line ^p1 1170005 ^p2 1160005)
+(make line ^p1 1160005 ^p2 1150005)
+(make line ^p1 1150005 ^p2 1140004)
+(make line ^p1 1080006 ^p2 1100006)
+(make line ^p1 1100006 ^p2 1110006)
+(make line ^p1 1110006 ^p2 1120006)
+(make line ^p1 1080006 ^p2 1080008)
+(make line ^p1 1080008 ^p2 1080009)
+(make line ^p1 1080009 ^p2 1080010)
+(make line ^p1 1080010 ^p2 1120010)
+(make line ^p1 1120010 ^p2 1120006)
+(make line ^p1 1120006 ^p2 1130007)
+(make line ^p1 1130007 ^p2 1130008)
+(make line ^p1 1130008 ^p2 1130009)
+(make line ^p1 1130009 ^p2 1130011)
+(make line ^p1 1130011 ^p2 1120010)
+(make line ^p1 1130011 ^p2 1110011)
+(make line ^p1 1110011 ^p2 1100011)
+(make line ^p1 1100011 ^p2 1090011)
+(make line ^p1 1090011 ^p2 1080010)
+(make line ^p1 1140006 ^p2 1160006)
+(make line ^p1 1160006 ^p2 1170006)
+(make line ^p1 1170006 ^p2 1180006)
+(make line ^p1 1140006 ^p2 1140008)
+(make line ^p1 1140008 ^p2 1140009)
+(make line ^p1 1140009 ^p2 1140010)
+(make line ^p1 1140010 ^p2 1180010)
+(make line ^p1 1180010 ^p2 1180006)
+(make line ^p1 1180006 ^p2 1190007)
+(make line ^p1 1190007 ^p2 1190008)
+(make line ^p1 1190008 ^p2 1190009)
+(make line ^p1 1190009 ^p2 1190011)
+(make line ^p1 1190011 ^p2 1180010)
+(make line ^p1 1190011 ^p2 1170011)
+(make line ^p1 1170011 ^p2 1160011)
+(make line ^p1 1160011 ^p2 1150011)
+(make line ^p1 1150011 ^p2 1140010)
+(make line ^p1 1070003 ^p2 1080003)
+(make line ^p1 1050005 ^p2 1050006)
+(make line ^p1 1100005 ^p2 1100006)
+(make line ^p1 1070008 ^p2 1080008)
+(make line ^p1 1250003 ^p2 1260003)
+(make line ^p1 1230005 ^p2 1230006)
+(make line ^p1 1280005 ^p2 1280006)
+(make line ^p1 1250008 ^p2 1260008)
+(make line ^p1 1200000 ^p2 1220000)
+(make line ^p1 1220000 ^p2 1230000)
+(make line ^p1 1230000 ^p2 1240000)
+(make line ^p1 1200000 ^p2 1200002)
+(make line ^p1 1200002 ^p2 1200003)
+(make line ^p1 1200003 ^p2 1200004)
+(make line ^p1 1200004 ^p2 1240004)
+(make line ^p1 1240004 ^p2 1240000)
+(make line ^p1 1240000 ^p2 1250001)
+(make line ^p1 1250001 ^p2 1250002)
+(make line ^p1 1250002 ^p2 1250003)
+(make line ^p1 1250003 ^p2 1250005)
+(make line ^p1 1250005 ^p2 1240004)
+(make line ^p1 1250005 ^p2 1230005)
+(make line ^p1 1230005 ^p2 1220005)
+(make line ^p1 1220005 ^p2 1210005)
+(make line ^p1 1210005 ^p2 1200004)
+(make line ^p1 1260000 ^p2 1280000)
+(make line ^p1 1280000 ^p2 1290000)
+(make line ^p1 1290000 ^p2 1300000)
+(make line ^p1 1260000 ^p2 1260002)
+(make line ^p1 1260002 ^p2 1260003)
+(make line ^p1 1260003 ^p2 1260004)
+(make line ^p1 1260004 ^p2 1300004)
+(make line ^p1 1300004 ^p2 1300000)
+(make line ^p1 1300000 ^p2 1310001)
+(make line ^p1 1310001 ^p2 1310002)
+(make line ^p1 1310002 ^p2 1310003)
+(make line ^p1 1310003 ^p2 1310005)
+(make line ^p1 1310005 ^p2 1300004)
+(make line ^p1 1310005 ^p2 1290005)
+(make line ^p1 1290005 ^p2 1280005)
+(make line ^p1 1280005 ^p2 1270005)
+(make line ^p1 1270005 ^p2 1260004)
+(make line ^p1 1200006 ^p2 1220006)
+(make line ^p1 1220006 ^p2 1230006)
+(make line ^p1 1230006 ^p2 1240006)
+(make line ^p1 1200006 ^p2 1200008)
+(make line ^p1 1200008 ^p2 1200009)
+(make line ^p1 1200009 ^p2 1200010)
+(make line ^p1 1200010 ^p2 1240010)
+(make line ^p1 1240010 ^p2 1240006)
+(make line ^p1 1240006 ^p2 1250007)
+(make line ^p1 1250007 ^p2 1250008)
+(make line ^p1 1250008 ^p2 1250009)
+(make line ^p1 1250009 ^p2 1250011)
+(make line ^p1 1250011 ^p2 1240010)
+(make line ^p1 1250011 ^p2 1230011)
+(make line ^p1 1230011 ^p2 1220011)
+(make line ^p1 1220011 ^p2 1210011)
+(make line ^p1 1210011 ^p2 1200010)
+(make line ^p1 1260006 ^p2 1280006)
+(make line ^p1 1280006 ^p2 1290006)
+(make line ^p1 1290006 ^p2 1300006)
+(make line ^p1 1260006 ^p2 1260008)
+(make line ^p1 1260008 ^p2 1260009)
+(make line ^p1 1260009 ^p2 1260010)
+(make line ^p1 1260010 ^p2 1300010)
+(make line ^p1 1300010 ^p2 1300006)
+(make line ^p1 1300006 ^p2 1310007)
+(make line ^p1 1310007 ^p2 1310008)
+(make line ^p1 1310008 ^p2 1310009)
+(make line ^p1 1310009 ^p2 1310011)
+(make line ^p1 1310011 ^p2 1300010)
+(make line ^p1 1310011 ^p2 1290011)
+(make line ^p1 1290011 ^p2 1280011)
+(make line ^p1 1280011 ^p2 1270011)
+(make line ^p1 1270011 ^p2 1260010)
+(make line ^p1 1190003 ^p2 1200003)
+(make line ^p1 1170005 ^p2 1170006)
+(make line ^p1 1220005 ^p2 1220006)
+(make line ^p1 1190008 ^p2 1200008)
+(make line ^p1 1370003 ^p2 1380003)
+(make line ^p1 1350005 ^p2 1350006)
+(make line ^p1 1400005 ^p2 1400006)
+(make line ^p1 1370008 ^p2 1380008)
+(make line ^p1 1320000 ^p2 1340000)
+(make line ^p1 1340000 ^p2 1350000)
+(make line ^p1 1350000 ^p2 1360000)
+(make line ^p1 1320000 ^p2 1320002)
+(make line ^p1 1320002 ^p2 1320003)
+(make line ^p1 1320003 ^p2 1320004)
+(make line ^p1 1320004 ^p2 1360004)
+(make line ^p1 1360004 ^p2 1360000)
+(make line ^p1 1360000 ^p2 1370001)
+(make line ^p1 1370001 ^p2 1370002)
+(make line ^p1 1370002 ^p2 1370003)
+(make line ^p1 1370003 ^p2 1370005)
+(make line ^p1 1370005 ^p2 1360004)
+(make line ^p1 1370005 ^p2 1350005)
+(make line ^p1 1350005 ^p2 1340005)
+(make line ^p1 1340005 ^p2 1330005)
+(make line ^p1 1330005 ^p2 1320004)
+(make line ^p1 1380000 ^p2 1400000)
+(make line ^p1 1400000 ^p2 1410000)
+(make line ^p1 1410000 ^p2 1420000)
+(make line ^p1 1380000 ^p2 1380002)
+(make line ^p1 1380002 ^p2 1380003)
+(make line ^p1 1380003 ^p2 1380004)
+(make line ^p1 1380004 ^p2 1420004)
+(make line ^p1 1420004 ^p2 1420000)
+(make line ^p1 1420000 ^p2 1430001)
+(make line ^p1 1430001 ^p2 1430002)
+(make line ^p1 1430002 ^p2 1430003)
+(make line ^p1 1430003 ^p2 1430005)
+(make line ^p1 1430005 ^p2 1420004)
+(make line ^p1 1430005 ^p2 1410005)
+(make line ^p1 1410005 ^p2 1400005)
+(make line ^p1 1400005 ^p2 1390005)
+(make line ^p1 1390005 ^p2 1380004)
+(make line ^p1 1320006 ^p2 1340006)
+(make line ^p1 1340006 ^p2 1350006)
+(make line ^p1 1350006 ^p2 1360006)
+(make line ^p1 1320006 ^p2 1320008)
+(make line ^p1 1320008 ^p2 1320009)
+(make line ^p1 1320009 ^p2 1320010)
+(make line ^p1 1320010 ^p2 1360010)
+(make line ^p1 1360010 ^p2 1360006)
+(make line ^p1 1360006 ^p2 1370007)
+(make line ^p1 1370007 ^p2 1370008)
+(make line ^p1 1370008 ^p2 1370009)
+(make line ^p1 1370009 ^p2 1370011)
+(make line ^p1 1370011 ^p2 1360010)
+(make line ^p1 1370011 ^p2 1350011)
+(make line ^p1 1350011 ^p2 1340011)
+(make line ^p1 1340011 ^p2 1330011)
+(make line ^p1 1330011 ^p2 1320010)
+(make line ^p1 1380006 ^p2 1400006)
+(make line ^p1 1400006 ^p2 1410006)
+(make line ^p1 1410006 ^p2 1420006)
+(make line ^p1 1380006 ^p2 1380008)
+(make line ^p1 1380008 ^p2 1380009)
+(make line ^p1 1380009 ^p2 1380010)
+(make line ^p1 1380010 ^p2 1420010)
+(make line ^p1 1420010 ^p2 1420006)
+(make line ^p1 1420006 ^p2 1430007)
+(make line ^p1 1430007 ^p2 1430008)
+(make line ^p1 1430008 ^p2 1430009)
+(make line ^p1 1430009 ^p2 1430011)
+(make line ^p1 1430011 ^p2 1420010)
+(make line ^p1 1430011 ^p2 1410011)
+(make line ^p1 1410011 ^p2 1400011)
+(make line ^p1 1400011 ^p2 1390011)
+(make line ^p1 1390011 ^p2 1380010)
+(make line ^p1 1310003 ^p2 1320003)
+(make line ^p1 1290005 ^p2 1290006)
+(make line ^p1 1340005 ^p2 1340006)
+(make line ^p1 1310008 ^p2 1320008)
+(make line ^p1 1490003 ^p2 1500003)
+(make line ^p1 1470005 ^p2 1470006)
+(make line ^p1 1520005 ^p2 1520006)
+(make line ^p1 1490008 ^p2 1500008)
+(make line ^p1 1440000 ^p2 1460000)
+(make line ^p1 1460000 ^p2 1470000)
+(make line ^p1 1470000 ^p2 1480000)
+(make line ^p1 1440000 ^p2 1440002)
+(make line ^p1 1440002 ^p2 1440003)
+(make line ^p1 1440003 ^p2 1440004)
+(make line ^p1 1440004 ^p2 1480004)
+(make line ^p1 1480004 ^p2 1480000)
+(make line ^p1 1480000 ^p2 1490001)
+(make line ^p1 1490001 ^p2 1490002)
+(make line ^p1 1490002 ^p2 1490003)
+(make line ^p1 1490003 ^p2 1490005)
+(make line ^p1 1490005 ^p2 1480004)
+(make line ^p1 1490005 ^p2 1470005)
+(make line ^p1 1470005 ^p2 1460005)
+(make line ^p1 1460005 ^p2 1450005)
+(make line ^p1 1450005 ^p2 1440004)
+(make line ^p1 1500000 ^p2 1520000)
+(make line ^p1 1520000 ^p2 1530000)
+(make line ^p1 1530000 ^p2 1540000)
+(make line ^p1 1500000 ^p2 1500002)
+(make line ^p1 1500002 ^p2 1500003)
+(make line ^p1 1500003 ^p2 1500004)
+(make line ^p1 1500004 ^p2 1540004)
+(make line ^p1 1540004 ^p2 1540000)
+(make line ^p1 1540000 ^p2 1550001)
+(make line ^p1 1550001 ^p2 1550002)
+(make line ^p1 1550002 ^p2 1550003)
+(make line ^p1 1550003 ^p2 1550005)
+(make line ^p1 1550005 ^p2 1540004)
+(make line ^p1 1550005 ^p2 1530005)
+(make line ^p1 1530005 ^p2 1520005)
+(make line ^p1 1520005 ^p2 1510005)
+(make line ^p1 1510005 ^p2 1500004)
+(make line ^p1 1440006 ^p2 1460006)
+(make line ^p1 1460006 ^p2 1470006)
+(make line ^p1 1470006 ^p2 1480006)
+(make line ^p1 1440006 ^p2 1440008)
+(make line ^p1 1440008 ^p2 1440009)
+(make line ^p1 1440009 ^p2 1440010)
+(make line ^p1 1440010 ^p2 1480010)
+(make line ^p1 1480010 ^p2 1480006)
+(make line ^p1 1480006 ^p2 1490007)
+(make line ^p1 1490007 ^p2 1490008)
+(make line ^p1 1490008 ^p2 1490009)
+(make line ^p1 1490009 ^p2 1490011)
+(make line ^p1 1490011 ^p2 1480010)
+(make line ^p1 1490011 ^p2 1470011)
+(make line ^p1 1470011 ^p2 1460011)
+(make line ^p1 1460011 ^p2 1450011)
+(make line ^p1 1450011 ^p2 1440010)
+(make line ^p1 1500006 ^p2 1520006)
+(make line ^p1 1520006 ^p2 1530006)
+(make line ^p1 1530006 ^p2 1540006)
+(make line ^p1 1500006 ^p2 1500008)
+(make line ^p1 1500008 ^p2 1500009)
+(make line ^p1 1500009 ^p2 1500010)
+(make line ^p1 1500010 ^p2 1540010)
+(make line ^p1 1540010 ^p2 1540006)
+(make line ^p1 1540006 ^p2 1550007)
+(make line ^p1 1550007 ^p2 1550008)
+(make line ^p1 1550008 ^p2 1550009)
+(make line ^p1 1550009 ^p2 1550011)
+(make line ^p1 1550011 ^p2 1540010)
+(make line ^p1 1550011 ^p2 1530011)
+(make line ^p1 1530011 ^p2 1520011)
+(make line ^p1 1520011 ^p2 1510011)
+(make line ^p1 1510011 ^p2 1500010)
+(make line ^p1 1430003 ^p2 1440003)
+(make line ^p1 1410005 ^p2 1410006)
+(make line ^p1 1460005 ^p2 1460006)
+(make line ^p1 1430008 ^p2 1440008)
+(make line ^p1 1610003 ^p2 1620003)
+(make line ^p1 1590005 ^p2 1590006)
+(make line ^p1 1640005 ^p2 1640006)
+(make line ^p1 1610008 ^p2 1620008)
+(make line ^p1 1560000 ^p2 1580000)
+(make line ^p1 1580000 ^p2 1590000)
+(make line ^p1 1590000 ^p2 1600000)
+(make line ^p1 1560000 ^p2 1560002)
+(make line ^p1 1560002 ^p2 1560003)
+(make line ^p1 1560003 ^p2 1560004)
+(make line ^p1 1560004 ^p2 1600004)
+(make line ^p1 1600004 ^p2 1600000)
+(make line ^p1 1600000 ^p2 1610001)
+(make line ^p1 1610001 ^p2 1610002)
+(make line ^p1 1610002 ^p2 1610003)
+(make line ^p1 1610003 ^p2 1610005)
+(make line ^p1 1610005 ^p2 1600004)
+(make line ^p1 1610005 ^p2 1590005)
+(make line ^p1 1590005 ^p2 1580005)
+(make line ^p1 1580005 ^p2 1570005)
+(make line ^p1 1570005 ^p2 1560004)
+(make line ^p1 1620000 ^p2 1640000)
+(make line ^p1 1640000 ^p2 1650000)
+(make line ^p1 1650000 ^p2 1660000)
+(make line ^p1 1620000 ^p2 1620002)
+(make line ^p1 1620002 ^p2 1620003)
+(make line ^p1 1620003 ^p2 1620004)
+(make line ^p1 1620004 ^p2 1660004)
+(make line ^p1 1660004 ^p2 1660000)
+(make line ^p1 1660000 ^p2 1670001)
+(make line ^p1 1670001 ^p2 1670002)
+(make line ^p1 1670002 ^p2 1670003)
+(make line ^p1 1670003 ^p2 1670005)
+(make line ^p1 1670005 ^p2 1660004)
+(make line ^p1 1670005 ^p2 1650005)
+(make line ^p1 1650005 ^p2 1640005)
+(make line ^p1 1640005 ^p2 1630005)
+(make line ^p1 1630005 ^p2 1620004)
+(make line ^p1 1560006 ^p2 1580006)
+(make line ^p1 1580006 ^p2 1590006)
+(make line ^p1 1590006 ^p2 1600006)
+(make line ^p1 1560006 ^p2 1560008)
+(make line ^p1 1560008 ^p2 1560009)
+(make line ^p1 1560009 ^p2 1560010)
+(make line ^p1 1560010 ^p2 1600010)
+(make line ^p1 1600010 ^p2 1600006)
+(make line ^p1 1600006 ^p2 1610007)
+(make line ^p1 1610007 ^p2 1610008)
+(make line ^p1 1610008 ^p2 1610009)
+(make line ^p1 1610009 ^p2 1610011)
+(make line ^p1 1610011 ^p2 1600010)
+(make line ^p1 1610011 ^p2 1590011)
+(make line ^p1 1590011 ^p2 1580011)
+(make line ^p1 1580011 ^p2 1570011)
+(make line ^p1 1570011 ^p2 1560010)
+(make line ^p1 1620006 ^p2 1640006)
+(make line ^p1 1640006 ^p2 1650006)
+(make line ^p1 1650006 ^p2 1660006)
+(make line ^p1 1620006 ^p2 1620008)
+(make line ^p1 1620008 ^p2 1620009)
+(make line ^p1 1620009 ^p2 1620010)
+(make line ^p1 1620010 ^p2 1660010)
+(make line ^p1 1660010 ^p2 1660006)
+(make line ^p1 1660006 ^p2 1670007)
+(make line ^p1 1670007 ^p2 1670008)
+(make line ^p1 1670008 ^p2 1670009)
+(make line ^p1 1670009 ^p2 1670011)
+(make line ^p1 1670011 ^p2 1660010)
+(make line ^p1 1670011 ^p2 1650011)
+(make line ^p1 1650011 ^p2 1640011)
+(make line ^p1 1640011 ^p2 1630011)
+(make line ^p1 1630011 ^p2 1620010)
+(make line ^p1 1550003 ^p2 1560003)
+(make line ^p1 1530005 ^p2 1530006)
+(make line ^p1 1580005 ^p2 1580006)
+(make line ^p1 1550008 ^p2 1560008)
+(make line ^p1 1730003 ^p2 1740003)
+(make line ^p1 1710005 ^p2 1710006)
+(make line ^p1 1760005 ^p2 1760006)
+(make line ^p1 1730008 ^p2 1740008)
+(make line ^p1 1680000 ^p2 1700000)
+(make line ^p1 1700000 ^p2 1710000)
+(make line ^p1 1710000 ^p2 1720000)
+(make line ^p1 1680000 ^p2 1680002)
+(make line ^p1 1680002 ^p2 1680003)
+(make line ^p1 1680003 ^p2 1680004)
+(make line ^p1 1680004 ^p2 1720004)
+(make line ^p1 1720004 ^p2 1720000)
+(make line ^p1 1720000 ^p2 1730001)
+(make line ^p1 1730001 ^p2 1730002)
+(make line ^p1 1730002 ^p2 1730003)
+(make line ^p1 1730003 ^p2 1730005)
+(make line ^p1 1730005 ^p2 1720004)
+(make line ^p1 1730005 ^p2 1710005)
+(make line ^p1 1710005 ^p2 1700005)
+(make line ^p1 1700005 ^p2 1690005)
+(make line ^p1 1690005 ^p2 1680004)
+(make line ^p1 1740000 ^p2 1760000)
+(make line ^p1 1760000 ^p2 1770000)
+(make line ^p1 1770000 ^p2 1780000)
+(make line ^p1 1740000 ^p2 1740002)
+(make line ^p1 1740002 ^p2 1740003)
+(make line ^p1 1740003 ^p2 1740004)
+(make line ^p1 1740004 ^p2 1780004)
+(make line ^p1 1780004 ^p2 1780000)
+(make line ^p1 1780000 ^p2 1790001)
+(make line ^p1 1790001 ^p2 1790002)
+(make line ^p1 1790002 ^p2 1790003)
+(make line ^p1 1790003 ^p2 1790005)
+(make line ^p1 1790005 ^p2 1780004)
+(make line ^p1 1790005 ^p2 1770005)
+(make line ^p1 1770005 ^p2 1760005)
+(make line ^p1 1760005 ^p2 1750005)
+(make line ^p1 1750005 ^p2 1740004)
+(make line ^p1 1680006 ^p2 1700006)
+(make line ^p1 1700006 ^p2 1710006)
+(make line ^p1 1710006 ^p2 1720006)
+(make line ^p1 1680006 ^p2 1680008)
+(make line ^p1 1680008 ^p2 1680009)
+(make line ^p1 1680009 ^p2 1680010)
+(make line ^p1 1680010 ^p2 1720010)
+(make line ^p1 1720010 ^p2 1720006)
+(make line ^p1 1720006 ^p2 1730007)
+(make line ^p1 1730007 ^p2 1730008)
+(make line ^p1 1730008 ^p2 1730009)
+(make line ^p1 1730009 ^p2 1730011)
+(make line ^p1 1730011 ^p2 1720010)
+(make line ^p1 1730011 ^p2 1710011)
+(make line ^p1 1710011 ^p2 1700011)
+(make line ^p1 1700011 ^p2 1690011)
+(make line ^p1 1690011 ^p2 1680010)
+(make line ^p1 1740006 ^p2 1760006)
+(make line ^p1 1760006 ^p2 1770006)
+(make line ^p1 1770006 ^p2 1780006)
+(make line ^p1 1740006 ^p2 1740008)
+(make line ^p1 1740008 ^p2 1740009)
+(make line ^p1 1740009 ^p2 1740010)
+(make line ^p1 1740010 ^p2 1780010)
+(make line ^p1 1780010 ^p2 1780006)
+(make line ^p1 1780006 ^p2 1790007)
+(make line ^p1 1790007 ^p2 1790008)
+(make line ^p1 1790008 ^p2 1790009)
+(make line ^p1 1790009 ^p2 1790011)
+(make line ^p1 1790011 ^p2 1780010)
+(make line ^p1 1790011 ^p2 1770011)
+(make line ^p1 1770011 ^p2 1760011)
+(make line ^p1 1760011 ^p2 1750011)
+(make line ^p1 1750011 ^p2 1740010)
+(make line ^p1 1670003 ^p2 1680003)
+(make line ^p1 1650005 ^p2 1650006)
+(make line ^p1 1700005 ^p2 1700006)
+(make line ^p1 1670008 ^p2 1680008)
+(make line ^p1 1850003 ^p2 1860003)
+(make line ^p1 1830005 ^p2 1830006)
+(make line ^p1 1880005 ^p2 1880006)
+(make line ^p1 1850008 ^p2 1860008)
+(make line ^p1 1800000 ^p2 1820000)
+(make line ^p1 1820000 ^p2 1830000)
+(make line ^p1 1830000 ^p2 1840000)
+(make line ^p1 1800000 ^p2 1800002)
+(make line ^p1 1800002 ^p2 1800003)
+(make line ^p1 1800003 ^p2 1800004)
+(make line ^p1 1800004 ^p2 1840004)
+(make line ^p1 1840004 ^p2 1840000)
+(make line ^p1 1840000 ^p2 1850001)
+(make line ^p1 1850001 ^p2 1850002)
+(make line ^p1 1850002 ^p2 1850003)
+(make line ^p1 1850003 ^p2 1850005)
+(make line ^p1 1850005 ^p2 1840004)
+(make line ^p1 1850005 ^p2 1830005)
+(make line ^p1 1830005 ^p2 1820005)
+(make line ^p1 1820005 ^p2 1810005)
+(make line ^p1 1810005 ^p2 1800004)
+(make line ^p1 1860000 ^p2 1880000)
+(make line ^p1 1880000 ^p2 1890000)
+(make line ^p1 1890000 ^p2 1900000)
+(make line ^p1 1860000 ^p2 1860002)
+(make line ^p1 1860002 ^p2 1860003)
+(make line ^p1 1860003 ^p2 1860004)
+(make line ^p1 1860004 ^p2 1900004)
+(make line ^p1 1900004 ^p2 1900000)
+(make line ^p1 1900000 ^p2 1910001)
+(make line ^p1 1910001 ^p2 1910002)
+(make line ^p1 1910002 ^p2 1910003)
+(make line ^p1 1910003 ^p2 1910005)
+(make line ^p1 1910005 ^p2 1900004)
+(make line ^p1 1910005 ^p2 1890005)
+(make line ^p1 1890005 ^p2 1880005)
+(make line ^p1 1880005 ^p2 1870005)
+(make line ^p1 1870005 ^p2 1860004)
+(make line ^p1 1800006 ^p2 1820006)
+(make line ^p1 1820006 ^p2 1830006)
+(make line ^p1 1830006 ^p2 1840006)
+(make line ^p1 1800006 ^p2 1800008)
+(make line ^p1 1800008 ^p2 1800009)
+(make line ^p1 1800009 ^p2 1800010)
+(make line ^p1 1800010 ^p2 1840010)
+(make line ^p1 1840010 ^p2 1840006)
+(make line ^p1 1840006 ^p2 1850007)
+(make line ^p1 1850007 ^p2 1850008)
+(make line ^p1 1850008 ^p2 1850009)
+(make line ^p1 1850009 ^p2 1850011)
+(make line ^p1 1850011 ^p2 1840010)
+(make line ^p1 1850011 ^p2 1830011)
+(make line ^p1 1830011 ^p2 1820011)
+(make line ^p1 1820011 ^p2 1810011)
+(make line ^p1 1810011 ^p2 1800010)
+(make line ^p1 1860006 ^p2 1880006)
+(make line ^p1 1880006 ^p2 1890006)
+(make line ^p1 1890006 ^p2 1900006)
+(make line ^p1 1860006 ^p2 1860008)
+(make line ^p1 1860008 ^p2 1860009)
+(make line ^p1 1860009 ^p2 1860010)
+(make line ^p1 1860010 ^p2 1900010)
+(make line ^p1 1900010 ^p2 1900006)
+(make line ^p1 1900006 ^p2 1910007)
+(make line ^p1 1910007 ^p2 1910008)
+(make line ^p1 1910008 ^p2 1910009)
+(make line ^p1 1910009 ^p2 1910011)
+(make line ^p1 1910011 ^p2 1900010)
+(make line ^p1 1910011 ^p2 1890011)
+(make line ^p1 1890011 ^p2 1880011)
+(make line ^p1 1880011 ^p2 1870011)
+(make line ^p1 1870011 ^p2 1860010)
+(make line ^p1 1790003 ^p2 1800003)
+(make line ^p1 1770005 ^p2 1770006)
+(make line ^p1 1820005 ^p2 1820006)
+(make line ^p1 1790008 ^p2 1800008)
+(make line ^p1 1970003 ^p2 1980003)
+(make line ^p1 1950005 ^p2 1950006)
+(make line ^p1 2000005 ^p2 2000006)
+(make line ^p1 1970008 ^p2 1980008)
+(make line ^p1 1920000 ^p2 1940000)
+(make line ^p1 1940000 ^p2 1950000)
+(make line ^p1 1950000 ^p2 1960000)
+(make line ^p1 1920000 ^p2 1920002)
+(make line ^p1 1920002 ^p2 1920003)
+(make line ^p1 1920003 ^p2 1920004)
+(make line ^p1 1920004 ^p2 1960004)
+(make line ^p1 1960004 ^p2 1960000)
+(make line ^p1 1960000 ^p2 1970001)
+(make line ^p1 1970001 ^p2 1970002)
+(make line ^p1 1970002 ^p2 1970003)
+(make line ^p1 1970003 ^p2 1970005)
+(make line ^p1 1970005 ^p2 1960004)
+(make line ^p1 1970005 ^p2 1950005)
+(make line ^p1 1950005 ^p2 1940005)
+(make line ^p1 1940005 ^p2 1930005)
+(make line ^p1 1930005 ^p2 1920004)
+(make line ^p1 1980000 ^p2 2000000)
+(make line ^p1 2000000 ^p2 2010000)
+(make line ^p1 2010000 ^p2 2020000)
+(make line ^p1 1980000 ^p2 1980002)
+(make line ^p1 1980002 ^p2 1980003)
+(make line ^p1 1980003 ^p2 1980004)
+(make line ^p1 1980004 ^p2 2020004)
+(make line ^p1 2020004 ^p2 2020000)
+(make line ^p1 2020000 ^p2 2030001)
+(make line ^p1 2030001 ^p2 2030002)
+(make line ^p1 2030002 ^p2 2030003)
+(make line ^p1 2030003 ^p2 2030005)
+(make line ^p1 2030005 ^p2 2020004)
+(make line ^p1 2030005 ^p2 2010005)
+(make line ^p1 2010005 ^p2 2000005)
+(make line ^p1 2000005 ^p2 1990005)
+(make line ^p1 1990005 ^p2 1980004)
+(make line ^p1 1920006 ^p2 1940006)
+(make line ^p1 1940006 ^p2 1950006)
+(make line ^p1 1950006 ^p2 1960006)
+(make line ^p1 1920006 ^p2 1920008)
+(make line ^p1 1920008 ^p2 1920009)
+(make line ^p1 1920009 ^p2 1920010)
+(make line ^p1 1920010 ^p2 1960010)
+(make line ^p1 1960010 ^p2 1960006)
+(make line ^p1 1960006 ^p2 1970007)
+(make line ^p1 1970007 ^p2 1970008)
+(make line ^p1 1970008 ^p2 1970009)
+(make line ^p1 1970009 ^p2 1970011)
+(make line ^p1 1970011 ^p2 1960010)
+(make line ^p1 1970011 ^p2 1950011)
+(make line ^p1 1950011 ^p2 1940011)
+(make line ^p1 1940011 ^p2 1930011)
+(make line ^p1 1930011 ^p2 1920010)
+(make line ^p1 1980006 ^p2 2000006)
+(make line ^p1 2000006 ^p2 2010006)
+(make line ^p1 2010006 ^p2 2020006)
+(make line ^p1 1980006 ^p2 1980008)
+(make line ^p1 1980008 ^p2 1980009)
+(make line ^p1 1980009 ^p2 1980010)
+(make line ^p1 1980010 ^p2 2020010)
+(make line ^p1 2020010 ^p2 2020006)
+(make line ^p1 2020006 ^p2 2030007)
+(make line ^p1 2030007 ^p2 2030008)
+(make line ^p1 2030008 ^p2 2030009)
+(make line ^p1 2030009 ^p2 2030011)
+(make line ^p1 2030011 ^p2 2020010)
+(make line ^p1 2030011 ^p2 2010011)
+(make line ^p1 2010011 ^p2 2000011)
+(make line ^p1 2000011 ^p2 1990011)
+(make line ^p1 1990011 ^p2 1980010)
+(make line ^p1 1910003 ^p2 1920003)
+(make line ^p1 1890005 ^p2 1890006)
+(make line ^p1 1940005 ^p2 1940006)
+(make line ^p1 1910008 ^p2 1920008)
+(make line ^p1 2090003 ^p2 2100003)
+(make line ^p1 2070005 ^p2 2070006)
+(make line ^p1 2120005 ^p2 2120006)
+(make line ^p1 2090008 ^p2 2100008)
+(make line ^p1 2040000 ^p2 2060000)
+(make line ^p1 2060000 ^p2 2070000)
+(make line ^p1 2070000 ^p2 2080000)
+(make line ^p1 2040000 ^p2 2040002)
+(make line ^p1 2040002 ^p2 2040003)
+(make line ^p1 2040003 ^p2 2040004)
+(make line ^p1 2040004 ^p2 2080004)
+(make line ^p1 2080004 ^p2 2080000)
+(make line ^p1 2080000 ^p2 2090001)
+(make line ^p1 2090001 ^p2 2090002)
+(make line ^p1 2090002 ^p2 2090003)
+(make line ^p1 2090003 ^p2 2090005)
+(make line ^p1 2090005 ^p2 2080004)
+(make line ^p1 2090005 ^p2 2070005)
+(make line ^p1 2070005 ^p2 2060005)
+(make line ^p1 2060005 ^p2 2050005)
+(make line ^p1 2050005 ^p2 2040004)
+(make line ^p1 2100000 ^p2 2120000)
+(make line ^p1 2120000 ^p2 2130000)
+(make line ^p1 2130000 ^p2 2140000)
+(make line ^p1 2100000 ^p2 2100002)
+(make line ^p1 2100002 ^p2 2100003)
+(make line ^p1 2100003 ^p2 2100004)
+(make line ^p1 2100004 ^p2 2140004)
+(make line ^p1 2140004 ^p2 2140000)
+(make line ^p1 2140000 ^p2 2150001)
+(make line ^p1 2150001 ^p2 2150002)
+(make line ^p1 2150002 ^p2 2150003)
+(make line ^p1 2150003 ^p2 2150005)
+(make line ^p1 2150005 ^p2 2140004)
+(make line ^p1 2150005 ^p2 2130005)
+(make line ^p1 2130005 ^p2 2120005)
+(make line ^p1 2120005 ^p2 2110005)
+(make line ^p1 2110005 ^p2 2100004)
+(make line ^p1 2040006 ^p2 2060006)
+(make line ^p1 2060006 ^p2 2070006)
+(make line ^p1 2070006 ^p2 2080006)
+(make line ^p1 2040006 ^p2 2040008)
+(make line ^p1 2040008 ^p2 2040009)
+(make line ^p1 2040009 ^p2 2040010)
+(make line ^p1 2040010 ^p2 2080010)
+(make line ^p1 2080010 ^p2 2080006)
+(make line ^p1 2080006 ^p2 2090007)
+(make line ^p1 2090007 ^p2 2090008)
+(make line ^p1 2090008 ^p2 2090009)
+(make line ^p1 2090009 ^p2 2090011)
+(make line ^p1 2090011 ^p2 2080010)
+(make line ^p1 2090011 ^p2 2070011)
+(make line ^p1 2070011 ^p2 2060011)
+(make line ^p1 2060011 ^p2 2050011)
+(make line ^p1 2050011 ^p2 2040010)
+(make line ^p1 2100006 ^p2 2120006)
+(make line ^p1 2120006 ^p2 2130006)
+(make line ^p1 2130006 ^p2 2140006)
+(make line ^p1 2100006 ^p2 2100008)
+(make line ^p1 2100008 ^p2 2100009)
+(make line ^p1 2100009 ^p2 2100010)
+(make line ^p1 2100010 ^p2 2140010)
+(make line ^p1 2140010 ^p2 2140006)
+(make line ^p1 2140006 ^p2 2150007)
+(make line ^p1 2150007 ^p2 2150008)
+(make line ^p1 2150008 ^p2 2150009)
+(make line ^p1 2150009 ^p2 2150011)
+(make line ^p1 2150011 ^p2 2140010)
+(make line ^p1 2150011 ^p2 2130011)
+(make line ^p1 2130011 ^p2 2120011)
+(make line ^p1 2120011 ^p2 2110011)
+(make line ^p1 2110011 ^p2 2100010)
+(make line ^p1 2030003 ^p2 2040003)
+(make line ^p1 2010005 ^p2 2010006)
+(make line ^p1 2060005 ^p2 2060006)
+(make line ^p1 2030008 ^p2 2040008)
+(make line ^p1 2210003 ^p2 2220003)
+(make line ^p1 2190005 ^p2 2190006)
+(make line ^p1 2240005 ^p2 2240006)
+(make line ^p1 2210008 ^p2 2220008)
+(make line ^p1 2160000 ^p2 2180000)
+(make line ^p1 2180000 ^p2 2190000)
+(make line ^p1 2190000 ^p2 2200000)
+(make line ^p1 2160000 ^p2 2160002)
+(make line ^p1 2160002 ^p2 2160003)
+(make line ^p1 2160003 ^p2 2160004)
+(make line ^p1 2160004 ^p2 2200004)
+(make line ^p1 2200004 ^p2 2200000)
+(make line ^p1 2200000 ^p2 2210001)
+(make line ^p1 2210001 ^p2 2210002)
+(make line ^p1 2210002 ^p2 2210003)
+(make line ^p1 2210003 ^p2 2210005)
+(make line ^p1 2210005 ^p2 2200004)
+(make line ^p1 2210005 ^p2 2190005)
+(make line ^p1 2190005 ^p2 2180005)
+(make line ^p1 2180005 ^p2 2170005)
+(make line ^p1 2170005 ^p2 2160004)
+(make line ^p1 2220000 ^p2 2240000)
+(make line ^p1 2240000 ^p2 2250000)
+(make line ^p1 2250000 ^p2 2260000)
+(make line ^p1 2220000 ^p2 2220002)
+(make line ^p1 2220002 ^p2 2220003)
+(make line ^p1 2220003 ^p2 2220004)
+(make line ^p1 2220004 ^p2 2260004)
+(make line ^p1 2260004 ^p2 2260000)
+(make line ^p1 2260000 ^p2 2270001)
+(make line ^p1 2270001 ^p2 2270002)
+(make line ^p1 2270002 ^p2 2270003)
+(make line ^p1 2270003 ^p2 2270005)
+(make line ^p1 2270005 ^p2 2260004)
+(make line ^p1 2270005 ^p2 2250005)
+(make line ^p1 2250005 ^p2 2240005)
+(make line ^p1 2240005 ^p2 2230005)
+(make line ^p1 2230005 ^p2 2220004)
+(make line ^p1 2160006 ^p2 2180006)
+(make line ^p1 2180006 ^p2 2190006)
+(make line ^p1 2190006 ^p2 2200006)
+(make line ^p1 2160006 ^p2 2160008)
+(make line ^p1 2160008 ^p2 2160009)
+(make line ^p1 2160009 ^p2 2160010)
+(make line ^p1 2160010 ^p2 2200010)
+(make line ^p1 2200010 ^p2 2200006)
+(make line ^p1 2200006 ^p2 2210007)
+(make line ^p1 2210007 ^p2 2210008)
+(make line ^p1 2210008 ^p2 2210009)
+(make line ^p1 2210009 ^p2 2210011)
+(make line ^p1 2210011 ^p2 2200010)
+(make line ^p1 2210011 ^p2 2190011)
+(make line ^p1 2190011 ^p2 2180011)
+(make line ^p1 2180011 ^p2 2170011)
+(make line ^p1 2170011 ^p2 2160010)
+(make line ^p1 2220006 ^p2 2240006)
+(make line ^p1 2240006 ^p2 2250006)
+(make line ^p1 2250006 ^p2 2260006)
+(make line ^p1 2220006 ^p2 2220008)
+(make line ^p1 2220008 ^p2 2220009)
+(make line ^p1 2220009 ^p2 2220010)
+(make line ^p1 2220010 ^p2 2260010)
+(make line ^p1 2260010 ^p2 2260006)
+(make line ^p1 2260006 ^p2 2270007)
+(make line ^p1 2270007 ^p2 2270008)
+(make line ^p1 2270008 ^p2 2270009)
+(make line ^p1 2270009 ^p2 2270011)
+(make line ^p1 2270011 ^p2 2260010)
+(make line ^p1 2270011 ^p2 2250011)
+(make line ^p1 2250011 ^p2 2240011)
+(make line ^p1 2240011 ^p2 2230011)
+(make line ^p1 2230011 ^p2 2220010)
+(make line ^p1 2150003 ^p2 2160003)
+(make line ^p1 2130005 ^p2 2130006)
+(make line ^p1 2180005 ^p2 2180006)
+(make line ^p1 2150008 ^p2 2160008)
+(make line ^p1 2330003 ^p2 2340003)
+(make line ^p1 2310005 ^p2 2310006)
+(make line ^p1 2360005 ^p2 2360006)
+(make line ^p1 2330008 ^p2 2340008)
+(make line ^p1 2280000 ^p2 2300000)
+(make line ^p1 2300000 ^p2 2310000)
+(make line ^p1 2310000 ^p2 2320000)
+(make line ^p1 2280000 ^p2 2280002)
+(make line ^p1 2280002 ^p2 2280003)
+(make line ^p1 2280003 ^p2 2280004)
+(make line ^p1 2280004 ^p2 2320004)
+(make line ^p1 2320004 ^p2 2320000)
+(make line ^p1 2320000 ^p2 2330001)
+(make line ^p1 2330001 ^p2 2330002)
+(make line ^p1 2330002 ^p2 2330003)
+(make line ^p1 2330003 ^p2 2330005)
+(make line ^p1 2330005 ^p2 2320004)
+(make line ^p1 2330005 ^p2 2310005)
+(make line ^p1 2310005 ^p2 2300005)
+(make line ^p1 2300005 ^p2 2290005)
+(make line ^p1 2290005 ^p2 2280004)
+(make line ^p1 2340000 ^p2 2360000)
+(make line ^p1 2360000 ^p2 2370000)
+(make line ^p1 2370000 ^p2 2380000)
+(make line ^p1 2340000 ^p2 2340002)
+(make line ^p1 2340002 ^p2 2340003)
+(make line ^p1 2340003 ^p2 2340004)
+(make line ^p1 2340004 ^p2 2380004)
+(make line ^p1 2380004 ^p2 2380000)
+(make line ^p1 2380000 ^p2 2390001)
+(make line ^p1 2390001 ^p2 2390002)
+(make line ^p1 2390002 ^p2 2390003)
+(make line ^p1 2390003 ^p2 2390005)
+(make line ^p1 2390005 ^p2 2380004)
+(make line ^p1 2390005 ^p2 2370005)
+(make line ^p1 2370005 ^p2 2360005)
+(make line ^p1 2360005 ^p2 2350005)
+(make line ^p1 2350005 ^p2 2340004)
+(make line ^p1 2280006 ^p2 2300006)
+(make line ^p1 2300006 ^p2 2310006)
+(make line ^p1 2310006 ^p2 2320006)
+(make line ^p1 2280006 ^p2 2280008)
+(make line ^p1 2280008 ^p2 2280009)
+(make line ^p1 2280009 ^p2 2280010)
+(make line ^p1 2280010 ^p2 2320010)
+(make line ^p1 2320010 ^p2 2320006)
+(make line ^p1 2320006 ^p2 2330007)
+(make line ^p1 2330007 ^p2 2330008)
+(make line ^p1 2330008 ^p2 2330009)
+(make line ^p1 2330009 ^p2 2330011)
+(make line ^p1 2330011 ^p2 2320010)
+(make line ^p1 2330011 ^p2 2310011)
+(make line ^p1 2310011 ^p2 2300011)
+(make line ^p1 2300011 ^p2 2290011)
+(make line ^p1 2290011 ^p2 2280010)
+(make line ^p1 2340006 ^p2 2360006)
+(make line ^p1 2360006 ^p2 2370006)
+(make line ^p1 2370006 ^p2 2380006)
+(make line ^p1 2340006 ^p2 2340008)
+(make line ^p1 2340008 ^p2 2340009)
+(make line ^p1 2340009 ^p2 2340010)
+(make line ^p1 2340010 ^p2 2380010)
+(make line ^p1 2380010 ^p2 2380006)
+(make line ^p1 2380006 ^p2 2390007)
+(make line ^p1 2390007 ^p2 2390008)
+(make line ^p1 2390008 ^p2 2390009)
+(make line ^p1 2390009 ^p2 2390011)
+(make line ^p1 2390011 ^p2 2380010)
+(make line ^p1 2390011 ^p2 2370011)
+(make line ^p1 2370011 ^p2 2360011)
+(make line ^p1 2360011 ^p2 2350011)
+(make line ^p1 2350011 ^p2 2340010)
+(make line ^p1 2270003 ^p2 2280003)
+(make line ^p1 2250005 ^p2 2250006)
+(make line ^p1 2300005 ^p2 2300006)
+(make line ^p1 2270008 ^p2 2280008)
+(make line ^p1 2450003 ^p2 2460003)
+(make line ^p1 2430005 ^p2 2430006)
+(make line ^p1 2480005 ^p2 2480006)
+(make line ^p1 2450008 ^p2 2460008)
+(make line ^p1 2400000 ^p2 2420000)
+(make line ^p1 2420000 ^p2 2430000)
+(make line ^p1 2430000 ^p2 2440000)
+(make line ^p1 2400000 ^p2 2400002)
+(make line ^p1 2400002 ^p2 2400003)
+(make line ^p1 2400003 ^p2 2400004)
+(make line ^p1 2400004 ^p2 2440004)
+(make line ^p1 2440004 ^p2 2440000)
+(make line ^p1 2440000 ^p2 2450001)
+(make line ^p1 2450001 ^p2 2450002)
+(make line ^p1 2450002 ^p2 2450003)
+(make line ^p1 2450003 ^p2 2450005)
+(make line ^p1 2450005 ^p2 2440004)
+(make line ^p1 2450005 ^p2 2430005)
+(make line ^p1 2430005 ^p2 2420005)
+(make line ^p1 2420005 ^p2 2410005)
+(make line ^p1 2410005 ^p2 2400004)
+(make line ^p1 2460000 ^p2 2480000)
+(make line ^p1 2480000 ^p2 2490000)
+(make line ^p1 2490000 ^p2 2500000)
+(make line ^p1 2460000 ^p2 2460002)
+(make line ^p1 2460002 ^p2 2460003)
+(make line ^p1 2460003 ^p2 2460004)
+(make line ^p1 2460004 ^p2 2500004)
+(make line ^p1 2500004 ^p2 2500000)
+(make line ^p1 2500000 ^p2 2510001)
+(make line ^p1 2510001 ^p2 2510002)
+(make line ^p1 2510002 ^p2 2510003)
+(make line ^p1 2510003 ^p2 2510005)
+(make line ^p1 2510005 ^p2 2500004)
+(make line ^p1 2510005 ^p2 2490005)
+(make line ^p1 2490005 ^p2 2480005)
+(make line ^p1 2480005 ^p2 2470005)
+(make line ^p1 2470005 ^p2 2460004)
+(make line ^p1 2400006 ^p2 2420006)
+(make line ^p1 2420006 ^p2 2430006)
+(make line ^p1 2430006 ^p2 2440006)
+(make line ^p1 2400006 ^p2 2400008)
+(make line ^p1 2400008 ^p2 2400009)
+(make line ^p1 2400009 ^p2 2400010)
+(make line ^p1 2400010 ^p2 2440010)
+(make line ^p1 2440010 ^p2 2440006)
+(make line ^p1 2440006 ^p2 2450007)
+(make line ^p1 2450007 ^p2 2450008)
+(make line ^p1 2450008 ^p2 2450009)
+(make line ^p1 2450009 ^p2 2450011)
+(make line ^p1 2450011 ^p2 2440010)
+(make line ^p1 2450011 ^p2 2430011)
+(make line ^p1 2430011 ^p2 2420011)
+(make line ^p1 2420011 ^p2 2410011)
+(make line ^p1 2410011 ^p2 2400010)
+(make line ^p1 2460006 ^p2 2480006)
+(make line ^p1 2480006 ^p2 2490006)
+(make line ^p1 2490006 ^p2 2500006)
+(make line ^p1 2460006 ^p2 2460008)
+(make line ^p1 2460008 ^p2 2460009)
+(make line ^p1 2460009 ^p2 2460010)
+(make line ^p1 2460010 ^p2 2500010)
+(make line ^p1 2500010 ^p2 2500006)
+(make line ^p1 2500006 ^p2 2510007)
+(make line ^p1 2510007 ^p2 2510008)
+(make line ^p1 2510008 ^p2 2510009)
+(make line ^p1 2510009 ^p2 2510011)
+(make line ^p1 2510011 ^p2 2500010)
+(make line ^p1 2510011 ^p2 2490011)
+(make line ^p1 2490011 ^p2 2480011)
+(make line ^p1 2480011 ^p2 2470011)
+(make line ^p1 2470011 ^p2 2460010)
+(make line ^p1 2390003 ^p2 2400003)
+(make line ^p1 2370005 ^p2 2370006)
+(make line ^p1 2420005 ^p2 2420006)
+(make line ^p1 2390008 ^p2 2400008)
+(make line ^p1 2570003 ^p2 2580003)
+(make line ^p1 2550005 ^p2 2550006)
+(make line ^p1 2600005 ^p2 2600006)
+(make line ^p1 2570008 ^p2 2580008)
+(make line ^p1 2520000 ^p2 2540000)
+(make line ^p1 2540000 ^p2 2550000)
+(make line ^p1 2550000 ^p2 2560000)
+(make line ^p1 2520000 ^p2 2520002)
+(make line ^p1 2520002 ^p2 2520003)
+(make line ^p1 2520003 ^p2 2520004)
+(make line ^p1 2520004 ^p2 2560004)
+(make line ^p1 2560004 ^p2 2560000)
+(make line ^p1 2560000 ^p2 2570001)
+(make line ^p1 2570001 ^p2 2570002)
+(make line ^p1 2570002 ^p2 2570003)
+(make line ^p1 2570003 ^p2 2570005)
+(make line ^p1 2570005 ^p2 2560004)
+(make line ^p1 2570005 ^p2 2550005)
+(make line ^p1 2550005 ^p2 2540005)
+(make line ^p1 2540005 ^p2 2530005)
+(make line ^p1 2530005 ^p2 2520004)
+(make line ^p1 2580000 ^p2 2600000)
+(make line ^p1 2600000 ^p2 2610000)
+(make line ^p1 2610000 ^p2 2620000)
+(make line ^p1 2580000 ^p2 2580002)
+(make line ^p1 2580002 ^p2 2580003)
+(make line ^p1 2580003 ^p2 2580004)
+(make line ^p1 2580004 ^p2 2620004)
+(make line ^p1 2620004 ^p2 2620000)
+(make line ^p1 2620000 ^p2 2630001)
+(make line ^p1 2630001 ^p2 2630002)
+(make line ^p1 2630002 ^p2 2630003)
+(make line ^p1 2630003 ^p2 2630005)
+(make line ^p1 2630005 ^p2 2620004)
+(make line ^p1 2630005 ^p2 2610005)
+(make line ^p1 2610005 ^p2 2600005)
+(make line ^p1 2600005 ^p2 2590005)
+(make line ^p1 2590005 ^p2 2580004)
+(make line ^p1 2520006 ^p2 2540006)
+(make line ^p1 2540006 ^p2 2550006)
+(make line ^p1 2550006 ^p2 2560006)
+(make line ^p1 2520006 ^p2 2520008)
+(make line ^p1 2520008 ^p2 2520009)
+(make line ^p1 2520009 ^p2 2520010)
+(make line ^p1 2520010 ^p2 2560010)
+(make line ^p1 2560010 ^p2 2560006)
+(make line ^p1 2560006 ^p2 2570007)
+(make line ^p1 2570007 ^p2 2570008)
+(make line ^p1 2570008 ^p2 2570009)
+(make line ^p1 2570009 ^p2 2570011)
+(make line ^p1 2570011 ^p2 2560010)
+(make line ^p1 2570011 ^p2 2550011)
+(make line ^p1 2550011 ^p2 2540011)
+(make line ^p1 2540011 ^p2 2530011)
+(make line ^p1 2530011 ^p2 2520010)
+(make line ^p1 2580006 ^p2 2600006)
+(make line ^p1 2600006 ^p2 2610006)
+(make line ^p1 2610006 ^p2 2620006)
+(make line ^p1 2580006 ^p2 2580008)
+(make line ^p1 2580008 ^p2 2580009)
+(make line ^p1 2580009 ^p2 2580010)
+(make line ^p1 2580010 ^p2 2620010)
+(make line ^p1 2620010 ^p2 2620006)
+(make line ^p1 2620006 ^p2 2630007)
+(make line ^p1 2630007 ^p2 2630008)
+(make line ^p1 2630008 ^p2 2630009)
+(make line ^p1 2630009 ^p2 2630011)
+(make line ^p1 2630011 ^p2 2620010)
+(make line ^p1 2630011 ^p2 2610011)
+(make line ^p1 2610011 ^p2 2600011)
+(make line ^p1 2600011 ^p2 2590011)
+(make line ^p1 2590011 ^p2 2580010)
+(make line ^p1 2510003 ^p2 2520003)
+(make line ^p1 2490005 ^p2 2490006)
+(make line ^p1 2540005 ^p2 2540006)
+(make line ^p1 2510008 ^p2 2520008)
+(make line ^p1 2690003 ^p2 2700003)
+(make line ^p1 2670005 ^p2 2670006)
+(make line ^p1 2720005 ^p2 2720006)
+(make line ^p1 2690008 ^p2 2700008)
+(make line ^p1 2640000 ^p2 2660000)
+(make line ^p1 2660000 ^p2 2670000)
+(make line ^p1 2670000 ^p2 2680000)
+(make line ^p1 2640000 ^p2 2640002)
+(make line ^p1 2640002 ^p2 2640003)
+(make line ^p1 2640003 ^p2 2640004)
+(make line ^p1 2640004 ^p2 2680004)
+(make line ^p1 2680004 ^p2 2680000)
+(make line ^p1 2680000 ^p2 2690001)
+(make line ^p1 2690001 ^p2 2690002)
+(make line ^p1 2690002 ^p2 2690003)
+(make line ^p1 2690003 ^p2 2690005)
+(make line ^p1 2690005 ^p2 2680004)
+(make line ^p1 2690005 ^p2 2670005)
+(make line ^p1 2670005 ^p2 2660005)
+(make line ^p1 2660005 ^p2 2650005)
+(make line ^p1 2650005 ^p2 2640004)
+(make line ^p1 2700000 ^p2 2720000)
+(make line ^p1 2720000 ^p2 2730000)
+(make line ^p1 2730000 ^p2 2740000)
+(make line ^p1 2700000 ^p2 2700002)
+(make line ^p1 2700002 ^p2 2700003)
+(make line ^p1 2700003 ^p2 2700004)
+(make line ^p1 2700004 ^p2 2740004)
+(make line ^p1 2740004 ^p2 2740000)
+(make line ^p1 2740000 ^p2 2750001)
+(make line ^p1 2750001 ^p2 2750002)
+(make line ^p1 2750002 ^p2 2750003)
+(make line ^p1 2750003 ^p2 2750005)
+(make line ^p1 2750005 ^p2 2740004)
+(make line ^p1 2750005 ^p2 2730005)
+(make line ^p1 2730005 ^p2 2720005)
+(make line ^p1 2720005 ^p2 2710005)
+(make line ^p1 2710005 ^p2 2700004)
+(make line ^p1 2640006 ^p2 2660006)
+(make line ^p1 2660006 ^p2 2670006)
+(make line ^p1 2670006 ^p2 2680006)
+(make line ^p1 2640006 ^p2 2640008)
+(make line ^p1 2640008 ^p2 2640009)
+(make line ^p1 2640009 ^p2 2640010)
+(make line ^p1 2640010 ^p2 2680010)
+(make line ^p1 2680010 ^p2 2680006)
+(make line ^p1 2680006 ^p2 2690007)
+(make line ^p1 2690007 ^p2 2690008)
+(make line ^p1 2690008 ^p2 2690009)
+(make line ^p1 2690009 ^p2 2690011)
+(make line ^p1 2690011 ^p2 2680010)
+(make line ^p1 2690011 ^p2 2670011)
+(make line ^p1 2670011 ^p2 2660011)
+(make line ^p1 2660011 ^p2 2650011)
+(make line ^p1 2650011 ^p2 2640010)
+(make line ^p1 2700006 ^p2 2720006)
+(make line ^p1 2720006 ^p2 2730006)
+(make line ^p1 2730006 ^p2 2740006)
+(make line ^p1 2700006 ^p2 2700008)
+(make line ^p1 2700008 ^p2 2700009)
+(make line ^p1 2700009 ^p2 2700010)
+(make line ^p1 2700010 ^p2 2740010)
+(make line ^p1 2740010 ^p2 2740006)
+(make line ^p1 2740006 ^p2 2750007)
+(make line ^p1 2750007 ^p2 2750008)
+(make line ^p1 2750008 ^p2 2750009)
+(make line ^p1 2750009 ^p2 2750011)
+(make line ^p1 2750011 ^p2 2740010)
+(make line ^p1 2750011 ^p2 2730011)
+(make line ^p1 2730011 ^p2 2720011)
+(make line ^p1 2720011 ^p2 2710011)
+(make line ^p1 2710011 ^p2 2700010)
+(make line ^p1 2630003 ^p2 2640003)
+(make line ^p1 2610005 ^p2 2610006)
+(make line ^p1 2660005 ^p2 2660006)
+(make line ^p1 2630008 ^p2 2640008)
+(make line ^p1 2810003 ^p2 2820003)
+(make line ^p1 2790005 ^p2 2790006)
+(make line ^p1 2840005 ^p2 2840006)
+(make line ^p1 2810008 ^p2 2820008)
+(make line ^p1 2760000 ^p2 2780000)
+(make line ^p1 2780000 ^p2 2790000)
+(make line ^p1 2790000 ^p2 2800000)
+(make line ^p1 2760000 ^p2 2760002)
+(make line ^p1 2760002 ^p2 2760003)
+(make line ^p1 2760003 ^p2 2760004)
+(make line ^p1 2760004 ^p2 2800004)
+(make line ^p1 2800004 ^p2 2800000)
+(make line ^p1 2800000 ^p2 2810001)
+(make line ^p1 2810001 ^p2 2810002)
+(make line ^p1 2810002 ^p2 2810003)
+(make line ^p1 2810003 ^p2 2810005)
+(make line ^p1 2810005 ^p2 2800004)
+(make line ^p1 2810005 ^p2 2790005)
+(make line ^p1 2790005 ^p2 2780005)
+(make line ^p1 2780005 ^p2 2770005)
+(make line ^p1 2770005 ^p2 2760004)
+(make line ^p1 2820000 ^p2 2840000)
+(make line ^p1 2840000 ^p2 2850000)
+(make line ^p1 2850000 ^p2 2860000)
+(make line ^p1 2820000 ^p2 2820002)
+(make line ^p1 2820002 ^p2 2820003)
+(make line ^p1 2820003 ^p2 2820004)
+(make line ^p1 2820004 ^p2 2860004)
+(make line ^p1 2860004 ^p2 2860000)
+(make line ^p1 2860000 ^p2 2870001)
+(make line ^p1 2870001 ^p2 2870002)
+(make line ^p1 2870002 ^p2 2870003)
+(make line ^p1 2870003 ^p2 2870005)
+(make line ^p1 2870005 ^p2 2860004)
+(make line ^p1 2870005 ^p2 2850005)
+(make line ^p1 2850005 ^p2 2840005)
+(make line ^p1 2840005 ^p2 2830005)
+(make line ^p1 2830005 ^p2 2820004)
+(make line ^p1 2760006 ^p2 2780006)
+(make line ^p1 2780006 ^p2 2790006)
+(make line ^p1 2790006 ^p2 2800006)
+(make line ^p1 2760006 ^p2 2760008)
+(make line ^p1 2760008 ^p2 2760009)
+(make line ^p1 2760009 ^p2 2760010)
+(make line ^p1 2760010 ^p2 2800010)
+(make line ^p1 2800010 ^p2 2800006)
+(make line ^p1 2800006 ^p2 2810007)
+(make line ^p1 2810007 ^p2 2810008)
+(make line ^p1 2810008 ^p2 2810009)
+(make line ^p1 2810009 ^p2 2810011)
+(make line ^p1 2810011 ^p2 2800010)
+(make line ^p1 2810011 ^p2 2790011)
+(make line ^p1 2790011 ^p2 2780011)
+(make line ^p1 2780011 ^p2 2770011)
+(make line ^p1 2770011 ^p2 2760010)
+(make line ^p1 2820006 ^p2 2840006)
+(make line ^p1 2840006 ^p2 2850006)
+(make line ^p1 2850006 ^p2 2860006)
+(make line ^p1 2820006 ^p2 2820008)
+(make line ^p1 2820008 ^p2 2820009)
+(make line ^p1 2820009 ^p2 2820010)
+(make line ^p1 2820010 ^p2 2860010)
+(make line ^p1 2860010 ^p2 2860006)
+(make line ^p1 2860006 ^p2 2870007)
+(make line ^p1 2870007 ^p2 2870008)
+(make line ^p1 2870008 ^p2 2870009)
+(make line ^p1 2870009 ^p2 2870011)
+(make line ^p1 2870011 ^p2 2860010)
+(make line ^p1 2870011 ^p2 2850011)
+(make line ^p1 2850011 ^p2 2840011)
+(make line ^p1 2840011 ^p2 2830011)
+(make line ^p1 2830011 ^p2 2820010)
+(make line ^p1 2750003 ^p2 2760003)
+(make line ^p1 2730005 ^p2 2730006)
+(make line ^p1 2780005 ^p2 2780006)
+(make line ^p1 2750008 ^p2 2760008)
+(make line ^p1 2930003 ^p2 2940003)
+(make line ^p1 2910005 ^p2 2910006)
+(make line ^p1 2960005 ^p2 2960006)
+(make line ^p1 2930008 ^p2 2940008)
+(make line ^p1 2880000 ^p2 2900000)
+(make line ^p1 2900000 ^p2 2910000)
+(make line ^p1 2910000 ^p2 2920000)
+(make line ^p1 2880000 ^p2 2880002)
+(make line ^p1 2880002 ^p2 2880003)
+(make line ^p1 2880003 ^p2 2880004)
+(make line ^p1 2880004 ^p2 2920004)
+(make line ^p1 2920004 ^p2 2920000)
+(make line ^p1 2920000 ^p2 2930001)
+(make line ^p1 2930001 ^p2 2930002)
+(make line ^p1 2930002 ^p2 2930003)
+(make line ^p1 2930003 ^p2 2930005)
+(make line ^p1 2930005 ^p2 2920004)
+(make line ^p1 2930005 ^p2 2910005)
+(make line ^p1 2910005 ^p2 2900005)
+(make line ^p1 2900005 ^p2 2890005)
+(make line ^p1 2890005 ^p2 2880004)
+(make line ^p1 2940000 ^p2 2960000)
+(make line ^p1 2960000 ^p2 2970000)
+(make line ^p1 2970000 ^p2 2980000)
+(make line ^p1 2940000 ^p2 2940002)
+(make line ^p1 2940002 ^p2 2940003)
+(make line ^p1 2940003 ^p2 2940004)
+(make line ^p1 2940004 ^p2 2980004)
+(make line ^p1 2980004 ^p2 2980000)
+(make line ^p1 2980000 ^p2 2990001)
+(make line ^p1 2990001 ^p2 2990002)
+(make line ^p1 2990002 ^p2 2990003)
+(make line ^p1 2990003 ^p2 2990005)
+(make line ^p1 2990005 ^p2 2980004)
+(make line ^p1 2990005 ^p2 2970005)
+(make line ^p1 2970005 ^p2 2960005)
+(make line ^p1 2960005 ^p2 2950005)
+(make line ^p1 2950005 ^p2 2940004)
+(make line ^p1 2880006 ^p2 2900006)
+(make line ^p1 2900006 ^p2 2910006)
+(make line ^p1 2910006 ^p2 2920006)
+(make line ^p1 2880006 ^p2 2880008)
+(make line ^p1 2880008 ^p2 2880009)
+(make line ^p1 2880009 ^p2 2880010)
+(make line ^p1 2880010 ^p2 2920010)
+(make line ^p1 2920010 ^p2 2920006)
+(make line ^p1 2920006 ^p2 2930007)
+(make line ^p1 2930007 ^p2 2930008)
+(make line ^p1 2930008 ^p2 2930009)
+(make line ^p1 2930009 ^p2 2930011)
+(make line ^p1 2930011 ^p2 2920010)
+(make line ^p1 2930011 ^p2 2910011)
+(make line ^p1 2910011 ^p2 2900011)
+(make line ^p1 2900011 ^p2 2890011)
+(make line ^p1 2890011 ^p2 2880010)
+(make line ^p1 2940006 ^p2 2960006)
+(make line ^p1 2960006 ^p2 2970006)
+(make line ^p1 2970006 ^p2 2980006)
+(make line ^p1 2940006 ^p2 2940008)
+(make line ^p1 2940008 ^p2 2940009)
+(make line ^p1 2940009 ^p2 2940010)
+(make line ^p1 2940010 ^p2 2980010)
+(make line ^p1 2980010 ^p2 2980006)
+(make line ^p1 2980006 ^p2 2990007)
+(make line ^p1 2990007 ^p2 2990008)
+(make line ^p1 2990008 ^p2 2990009)
+(make line ^p1 2990009 ^p2 2990011)
+(make line ^p1 2990011 ^p2 2980010)
+(make line ^p1 2990011 ^p2 2970011)
+(make line ^p1 2970011 ^p2 2960011)
+(make line ^p1 2960011 ^p2 2950011)
+(make line ^p1 2950011 ^p2 2940010)
+(make line ^p1 2870003 ^p2 2880003)
+(make line ^p1 2850005 ^p2 2850006)
+(make line ^p1 2900005 ^p2 2900006)
+(make line ^p1 2870008 ^p2 2880008)
+(make line ^p1 3050003 ^p2 3060003)
+(make line ^p1 3030005 ^p2 3030006)
+(make line ^p1 3080005 ^p2 3080006)
+(make line ^p1 3050008 ^p2 3060008)
+(make line ^p1 3000000 ^p2 3020000)
+(make line ^p1 3020000 ^p2 3030000)
+(make line ^p1 3030000 ^p2 3040000)
+(make line ^p1 3000000 ^p2 3000002)
+(make line ^p1 3000002 ^p2 3000003)
+(make line ^p1 3000003 ^p2 3000004)
+(make line ^p1 3000004 ^p2 3040004)
+(make line ^p1 3040004 ^p2 3040000)
+(make line ^p1 3040000 ^p2 3050001)
+(make line ^p1 3050001 ^p2 3050002)
+(make line ^p1 3050002 ^p2 3050003)
+(make line ^p1 3050003 ^p2 3050005)
+(make line ^p1 3050005 ^p2 3040004)
+(make line ^p1 3050005 ^p2 3030005)
+(make line ^p1 3030005 ^p2 3020005)
+(make line ^p1 3020005 ^p2 3010005)
+(make line ^p1 3010005 ^p2 3000004)
+(make line ^p1 3060000 ^p2 3080000)
+(make line ^p1 3080000 ^p2 3090000)
+(make line ^p1 3090000 ^p2 3100000)
+(make line ^p1 3060000 ^p2 3060002)
+(make line ^p1 3060002 ^p2 3060003)
+(make line ^p1 3060003 ^p2 3060004)
+(make line ^p1 3060004 ^p2 3100004)
+(make line ^p1 3100004 ^p2 3100000)
+(make line ^p1 3100000 ^p2 3110001)
+(make line ^p1 3110001 ^p2 3110002)
+(make line ^p1 3110002 ^p2 3110003)
+(make line ^p1 3110003 ^p2 3110005)
+(make line ^p1 3110005 ^p2 3100004)
+(make line ^p1 3110005 ^p2 3090005)
+(make line ^p1 3090005 ^p2 3080005)
+(make line ^p1 3080005 ^p2 3070005)
+(make line ^p1 3070005 ^p2 3060004)
+(make line ^p1 3000006 ^p2 3020006)
+(make line ^p1 3020006 ^p2 3030006)
+(make line ^p1 3030006 ^p2 3040006)
+(make line ^p1 3000006 ^p2 3000008)
+(make line ^p1 3000008 ^p2 3000009)
+(make line ^p1 3000009 ^p2 3000010)
+(make line ^p1 3000010 ^p2 3040010)
+(make line ^p1 3040010 ^p2 3040006)
+(make line ^p1 3040006 ^p2 3050007)
+(make line ^p1 3050007 ^p2 3050008)
+(make line ^p1 3050008 ^p2 3050009)
+(make line ^p1 3050009 ^p2 3050011)
+(make line ^p1 3050011 ^p2 3040010)
+(make line ^p1 3050011 ^p2 3030011)
+(make line ^p1 3030011 ^p2 3020011)
+(make line ^p1 3020011 ^p2 3010011)
+(make line ^p1 3010011 ^p2 3000010)
+(make line ^p1 3060006 ^p2 3080006)
+(make line ^p1 3080006 ^p2 3090006)
+(make line ^p1 3090006 ^p2 3100006)
+(make line ^p1 3060006 ^p2 3060008)
+(make line ^p1 3060008 ^p2 3060009)
+(make line ^p1 3060009 ^p2 3060010)
+(make line ^p1 3060010 ^p2 3100010)
+(make line ^p1 3100010 ^p2 3100006)
+(make line ^p1 3100006 ^p2 3110007)
+(make line ^p1 3110007 ^p2 3110008)
+(make line ^p1 3110008 ^p2 3110009)
+(make line ^p1 3110009 ^p2 3110011)
+(make line ^p1 3110011 ^p2 3100010)
+(make line ^p1 3110011 ^p2 3090011)
+(make line ^p1 3090011 ^p2 3080011)
+(make line ^p1 3080011 ^p2 3070011)
+(make line ^p1 3070011 ^p2 3060010)
+(make line ^p1 2990003 ^p2 3000003)
+(make line ^p1 2970005 ^p2 2970006)
+(make line ^p1 3020005 ^p2 3020006)
+(make line ^p1 2990008 ^p2 3000008)
+(make line ^p1 3170003 ^p2 3180003)
+(make line ^p1 3150005 ^p2 3150006)
+(make line ^p1 3200005 ^p2 3200006)
+(make line ^p1 3170008 ^p2 3180008)
+(make line ^p1 3120000 ^p2 3140000)
+(make line ^p1 3140000 ^p2 3150000)
+(make line ^p1 3150000 ^p2 3160000)
+(make line ^p1 3120000 ^p2 3120002)
+(make line ^p1 3120002 ^p2 3120003)
+(make line ^p1 3120003 ^p2 3120004)
+(make line ^p1 3120004 ^p2 3160004)
+(make line ^p1 3160004 ^p2 3160000)
+(make line ^p1 3160000 ^p2 3170001)
+(make line ^p1 3170001 ^p2 3170002)
+(make line ^p1 3170002 ^p2 3170003)
+(make line ^p1 3170003 ^p2 3170005)
+(make line ^p1 3170005 ^p2 3160004)
+(make line ^p1 3170005 ^p2 3150005)
+(make line ^p1 3150005 ^p2 3140005)
+(make line ^p1 3140005 ^p2 3130005)
+(make line ^p1 3130005 ^p2 3120004)
+(make line ^p1 3180000 ^p2 3200000)
+(make line ^p1 3200000 ^p2 3210000)
+(make line ^p1 3210000 ^p2 3220000)
+(make line ^p1 3180000 ^p2 3180002)
+(make line ^p1 3180002 ^p2 3180003)
+(make line ^p1 3180003 ^p2 3180004)
+(make line ^p1 3180004 ^p2 3220004)
+(make line ^p1 3220004 ^p2 3220000)
+(make line ^p1 3220000 ^p2 3230001)
+(make line ^p1 3230001 ^p2 3230002)
+(make line ^p1 3230002 ^p2 3230003)
+(make line ^p1 3230003 ^p2 3230005)
+(make line ^p1 3230005 ^p2 3220004)
+(make line ^p1 3230005 ^p2 3210005)
+(make line ^p1 3210005 ^p2 3200005)
+(make line ^p1 3200005 ^p2 3190005)
+(make line ^p1 3190005 ^p2 3180004)
+(make line ^p1 3120006 ^p2 3140006)
+(make line ^p1 3140006 ^p2 3150006)
+(make line ^p1 3150006 ^p2 3160006)
+(make line ^p1 3120006 ^p2 3120008)
+(make line ^p1 3120008 ^p2 3120009)
+(make line ^p1 3120009 ^p2 3120010)
+(make line ^p1 3120010 ^p2 3160010)
+(make line ^p1 3160010 ^p2 3160006)
+(make line ^p1 3160006 ^p2 3170007)
+(make line ^p1 3170007 ^p2 3170008)
+(make line ^p1 3170008 ^p2 3170009)
+(make line ^p1 3170009 ^p2 3170011)
+(make line ^p1 3170011 ^p2 3160010)
+(make line ^p1 3170011 ^p2 3150011)
+(make line ^p1 3150011 ^p2 3140011)
+(make line ^p1 3140011 ^p2 3130011)
+(make line ^p1 3130011 ^p2 3120010)
+(make line ^p1 3180006 ^p2 3200006)
+(make line ^p1 3200006 ^p2 3210006)
+(make line ^p1 3210006 ^p2 3220006)
+(make line ^p1 3180006 ^p2 3180008)
+(make line ^p1 3180008 ^p2 3180009)
+(make line ^p1 3180009 ^p2 3180010)
+(make line ^p1 3180010 ^p2 3220010)
+(make line ^p1 3220010 ^p2 3220006)
+(make line ^p1 3220006 ^p2 3230007)
+(make line ^p1 3230007 ^p2 3230008)
+(make line ^p1 3230008 ^p2 3230009)
+(make line ^p1 3230009 ^p2 3230011)
+(make line ^p1 3230011 ^p2 3220010)
+(make line ^p1 3230011 ^p2 3210011)
+(make line ^p1 3210011 ^p2 3200011)
+(make line ^p1 3200011 ^p2 3190011)
+(make line ^p1 3190011 ^p2 3180010)
+(make line ^p1 3110003 ^p2 3120003)
+(make line ^p1 3090005 ^p2 3090006)
+(make line ^p1 3140005 ^p2 3140006)
+(make line ^p1 3110008 ^p2 3120008)
+(make line ^p1 3290003 ^p2 3300003)
+(make line ^p1 3270005 ^p2 3270006)
+(make line ^p1 3320005 ^p2 3320006)
+(make line ^p1 3290008 ^p2 3300008)
+(make line ^p1 3240000 ^p2 3260000)
+(make line ^p1 3260000 ^p2 3270000)
+(make line ^p1 3270000 ^p2 3280000)
+(make line ^p1 3240000 ^p2 3240002)
+(make line ^p1 3240002 ^p2 3240003)
+(make line ^p1 3240003 ^p2 3240004)
+(make line ^p1 3240004 ^p2 3280004)
+(make line ^p1 3280004 ^p2 3280000)
+(make line ^p1 3280000 ^p2 3290001)
+(make line ^p1 3290001 ^p2 3290002)
+(make line ^p1 3290002 ^p2 3290003)
+(make line ^p1 3290003 ^p2 3290005)
+(make line ^p1 3290005 ^p2 3280004)
+(make line ^p1 3290005 ^p2 3270005)
+(make line ^p1 3270005 ^p2 3260005)
+(make line ^p1 3260005 ^p2 3250005)
+(make line ^p1 3250005 ^p2 3240004)
+(make line ^p1 3300000 ^p2 3320000)
+(make line ^p1 3320000 ^p2 3330000)
+(make line ^p1 3330000 ^p2 3340000)
+(make line ^p1 3300000 ^p2 3300002)
+(make line ^p1 3300002 ^p2 3300003)
+(make line ^p1 3300003 ^p2 3300004)
+(make line ^p1 3300004 ^p2 3340004)
+(make line ^p1 3340004 ^p2 3340000)
+(make line ^p1 3340000 ^p2 3350001)
+(make line ^p1 3350001 ^p2 3350002)
+(make line ^p1 3350002 ^p2 3350003)
+(make line ^p1 3350003 ^p2 3350005)
+(make line ^p1 3350005 ^p2 3340004)
+(make line ^p1 3350005 ^p2 3330005)
+(make line ^p1 3330005 ^p2 3320005)
+(make line ^p1 3320005 ^p2 3310005)
+(make line ^p1 3310005 ^p2 3300004)
+(make line ^p1 3240006 ^p2 3260006)
+(make line ^p1 3260006 ^p2 3270006)
+(make line ^p1 3270006 ^p2 3280006)
+(make line ^p1 3240006 ^p2 3240008)
+(make line ^p1 3240008 ^p2 3240009)
+(make line ^p1 3240009 ^p2 3240010)
+(make line ^p1 3240010 ^p2 3280010)
+(make line ^p1 3280010 ^p2 3280006)
+(make line ^p1 3280006 ^p2 3290007)
+(make line ^p1 3290007 ^p2 3290008)
+(make line ^p1 3290008 ^p2 3290009)
+(make line ^p1 3290009 ^p2 3290011)
+(make line ^p1 3290011 ^p2 3280010)
+(make line ^p1 3290011 ^p2 3270011)
+(make line ^p1 3270011 ^p2 3260011)
+(make line ^p1 3260011 ^p2 3250011)
+(make line ^p1 3250011 ^p2 3240010)
+(make line ^p1 3300006 ^p2 3320006)
+(make line ^p1 3320006 ^p2 3330006)
+(make line ^p1 3330006 ^p2 3340006)
+(make line ^p1 3300006 ^p2 3300008)
+(make line ^p1 3300008 ^p2 3300009)
+(make line ^p1 3300009 ^p2 3300010)
+(make line ^p1 3300010 ^p2 3340010)
+(make line ^p1 3340010 ^p2 3340006)
+(make line ^p1 3340006 ^p2 3350007)
+(make line ^p1 3350007 ^p2 3350008)
+(make line ^p1 3350008 ^p2 3350009)
+(make line ^p1 3350009 ^p2 3350011)
+(make line ^p1 3350011 ^p2 3340010)
+(make line ^p1 3350011 ^p2 3330011)
+(make line ^p1 3330011 ^p2 3320011)
+(make line ^p1 3320011 ^p2 3310011)
+(make line ^p1 3310011 ^p2 3300010)
+(make line ^p1 3230003 ^p2 3240003)
+(make line ^p1 3210005 ^p2 3210006)
+(make line ^p1 3260005 ^p2 3260006)
+(make line ^p1 3230008 ^p2 3240008)
+(make line ^p1 3410003 ^p2 3420003)
+(make line ^p1 3390005 ^p2 3390006)
+(make line ^p1 3440005 ^p2 3440006)
+(make line ^p1 3410008 ^p2 3420008)
+(make line ^p1 3360000 ^p2 3380000)
+(make line ^p1 3380000 ^p2 3390000)
+(make line ^p1 3390000 ^p2 3400000)
+(make line ^p1 3360000 ^p2 3360002)
+(make line ^p1 3360002 ^p2 3360003)
+(make line ^p1 3360003 ^p2 3360004)
+(make line ^p1 3360004 ^p2 3400004)
+(make line ^p1 3400004 ^p2 3400000)
+(make line ^p1 3400000 ^p2 3410001)
+(make line ^p1 3410001 ^p2 3410002)
+(make line ^p1 3410002 ^p2 3410003)
+(make line ^p1 3410003 ^p2 3410005)
+(make line ^p1 3410005 ^p2 3400004)
+(make line ^p1 3410005 ^p2 3390005)
+(make line ^p1 3390005 ^p2 3380005)
+(make line ^p1 3380005 ^p2 3370005)
+(make line ^p1 3370005 ^p2 3360004)
+(make line ^p1 3420000 ^p2 3440000)
+(make line ^p1 3440000 ^p2 3450000)
+(make line ^p1 3450000 ^p2 3460000)
+(make line ^p1 3420000 ^p2 3420002)
+(make line ^p1 3420002 ^p2 3420003)
+(make line ^p1 3420003 ^p2 3420004)
+(make line ^p1 3420004 ^p2 3460004)
+(make line ^p1 3460004 ^p2 3460000)
+(make line ^p1 3460000 ^p2 3470001)
+(make line ^p1 3470001 ^p2 3470002)
+(make line ^p1 3470002 ^p2 3470003)
+(make line ^p1 3470003 ^p2 3470005)
+(make line ^p1 3470005 ^p2 3460004)
+(make line ^p1 3470005 ^p2 3450005)
+(make line ^p1 3450005 ^p2 3440005)
+(make line ^p1 3440005 ^p2 3430005)
+(make line ^p1 3430005 ^p2 3420004)
+(make line ^p1 3360006 ^p2 3380006)
+(make line ^p1 3380006 ^p2 3390006)
+(make line ^p1 3390006 ^p2 3400006)
+(make line ^p1 3360006 ^p2 3360008)
+(make line ^p1 3360008 ^p2 3360009)
+(make line ^p1 3360009 ^p2 3360010)
+(make line ^p1 3360010 ^p2 3400010)
+(make line ^p1 3400010 ^p2 3400006)
+(make line ^p1 3400006 ^p2 3410007)
+(make line ^p1 3410007 ^p2 3410008)
+(make line ^p1 3410008 ^p2 3410009)
+(make line ^p1 3410009 ^p2 3410011)
+(make line ^p1 3410011 ^p2 3400010)
+(make line ^p1 3410011 ^p2 3390011)
+(make line ^p1 3390011 ^p2 3380011)
+(make line ^p1 3380011 ^p2 3370011)
+(make line ^p1 3370011 ^p2 3360010)
+(make line ^p1 3420006 ^p2 3440006)
+(make line ^p1 3440006 ^p2 3450006)
+(make line ^p1 3450006 ^p2 3460006)
+(make line ^p1 3420006 ^p2 3420008)
+(make line ^p1 3420008 ^p2 3420009)
+(make line ^p1 3420009 ^p2 3420010)
+(make line ^p1 3420010 ^p2 3460010)
+(make line ^p1 3460010 ^p2 3460006)
+(make line ^p1 3460006 ^p2 3470007)
+(make line ^p1 3470007 ^p2 3470008)
+(make line ^p1 3470008 ^p2 3470009)
+(make line ^p1 3470009 ^p2 3470011)
+(make line ^p1 3470011 ^p2 3460010)
+(make line ^p1 3470011 ^p2 3450011)
+(make line ^p1 3450011 ^p2 3440011)
+(make line ^p1 3440011 ^p2 3430011)
+(make line ^p1 3430011 ^p2 3420010)
+(make line ^p1 3350003 ^p2 3360003)
+(make line ^p1 3330005 ^p2 3330006)
+(make line ^p1 3380005 ^p2 3380006)
+(make line ^p1 3350008 ^p2 3360008)
+(make line ^p1 3530003 ^p2 3540003)
+(make line ^p1 3510005 ^p2 3510006)
+(make line ^p1 3560005 ^p2 3560006)
+(make line ^p1 3530008 ^p2 3540008)
+(make line ^p1 3480000 ^p2 3500000)
+(make line ^p1 3500000 ^p2 3510000)
+(make line ^p1 3510000 ^p2 3520000)
+(make line ^p1 3480000 ^p2 3480002)
+(make line ^p1 3480002 ^p2 3480003)
+(make line ^p1 3480003 ^p2 3480004)
+(make line ^p1 3480004 ^p2 3520004)
+(make line ^p1 3520004 ^p2 3520000)
+(make line ^p1 3520000 ^p2 3530001)
+(make line ^p1 3530001 ^p2 3530002)
+(make line ^p1 3530002 ^p2 3530003)
+(make line ^p1 3530003 ^p2 3530005)
+(make line ^p1 3530005 ^p2 3520004)
+(make line ^p1 3530005 ^p2 3510005)
+(make line ^p1 3510005 ^p2 3500005)
+(make line ^p1 3500005 ^p2 3490005)
+(make line ^p1 3490005 ^p2 3480004)
+(make line ^p1 3540000 ^p2 3560000)
+(make line ^p1 3560000 ^p2 3570000)
+(make line ^p1 3570000 ^p2 3580000)
+(make line ^p1 3540000 ^p2 3540002)
+(make line ^p1 3540002 ^p2 3540003)
+(make line ^p1 3540003 ^p2 3540004)
+(make line ^p1 3540004 ^p2 3580004)
+(make line ^p1 3580004 ^p2 3580000)
+(make line ^p1 3580000 ^p2 3590001)
+(make line ^p1 3590001 ^p2 3590002)
+(make line ^p1 3590002 ^p2 3590003)
+(make line ^p1 3590003 ^p2 3590005)
+(make line ^p1 3590005 ^p2 3580004)
+(make line ^p1 3590005 ^p2 3570005)
+(make line ^p1 3570005 ^p2 3560005)
+(make line ^p1 3560005 ^p2 3550005)
+(make line ^p1 3550005 ^p2 3540004)
+(make line ^p1 3480006 ^p2 3500006)
+(make line ^p1 3500006 ^p2 3510006)
+(make line ^p1 3510006 ^p2 3520006)
+(make line ^p1 3480006 ^p2 3480008)
+(make line ^p1 3480008 ^p2 3480009)
+(make line ^p1 3480009 ^p2 3480010)
+(make line ^p1 3480010 ^p2 3520010)
+(make line ^p1 3520010 ^p2 3520006)
+(make line ^p1 3520006 ^p2 3530007)
+(make line ^p1 3530007 ^p2 3530008)
+(make line ^p1 3530008 ^p2 3530009)
+(make line ^p1 3530009 ^p2 3530011)
+(make line ^p1 3530011 ^p2 3520010)
+(make line ^p1 3530011 ^p2 3510011)
+(make line ^p1 3510011 ^p2 3500011)
+(make line ^p1 3500011 ^p2 3490011)
+(make line ^p1 3490011 ^p2 3480010)
+(make line ^p1 3540006 ^p2 3560006)
+(make line ^p1 3560006 ^p2 3570006)
+(make line ^p1 3570006 ^p2 3580006)
+(make line ^p1 3540006 ^p2 3540008)
+(make line ^p1 3540008 ^p2 3540009)
+(make line ^p1 3540009 ^p2 3540010)
+(make line ^p1 3540010 ^p2 3580010)
+(make line ^p1 3580010 ^p2 3580006)
+(make line ^p1 3580006 ^p2 3590007)
+(make line ^p1 3590007 ^p2 3590008)
+(make line ^p1 3590008 ^p2 3590009)
+(make line ^p1 3590009 ^p2 3590011)
+(make line ^p1 3590011 ^p2 3580010)
+(make line ^p1 3590011 ^p2 3570011)
+(make line ^p1 3570011 ^p2 3560011)
+(make line ^p1 3560011 ^p2 3550011)
+(make line ^p1 3550011 ^p2 3540010)
+(make line ^p1 3470003 ^p2 3480003)
+(make line ^p1 3450005 ^p2 3450006)
+(make line ^p1 3500005 ^p2 3500006)
+(make line ^p1 3470008 ^p2 3480008)
+(make line ^p1 3650003 ^p2 3660003)
+(make line ^p1 3630005 ^p2 3630006)
+(make line ^p1 3680005 ^p2 3680006)
+(make line ^p1 3650008 ^p2 3660008)
+(make line ^p1 3600000 ^p2 3620000)
+(make line ^p1 3620000 ^p2 3630000)
+(make line ^p1 3630000 ^p2 3640000)
+(make line ^p1 3600000 ^p2 3600002)
+(make line ^p1 3600002 ^p2 3600003)
+(make line ^p1 3600003 ^p2 3600004)
+(make line ^p1 3600004 ^p2 3640004)
+(make line ^p1 3640004 ^p2 3640000)
+(make line ^p1 3640000 ^p2 3650001)
+(make line ^p1 3650001 ^p2 3650002)
+(make line ^p1 3650002 ^p2 3650003)
+(make line ^p1 3650003 ^p2 3650005)
+(make line ^p1 3650005 ^p2 3640004)
+(make line ^p1 3650005 ^p2 3630005)
+(make line ^p1 3630005 ^p2 3620005)
+(make line ^p1 3620005 ^p2 3610005)
+(make line ^p1 3610005 ^p2 3600004)
+(make line ^p1 3660000 ^p2 3680000)
+(make line ^p1 3680000 ^p2 3690000)
+(make line ^p1 3690000 ^p2 3700000)
+(make line ^p1 3660000 ^p2 3660002)
+(make line ^p1 3660002 ^p2 3660003)
+(make line ^p1 3660003 ^p2 3660004)
+(make line ^p1 3660004 ^p2 3700004)
+(make line ^p1 3700004 ^p2 3700000)
+(make line ^p1 3700000 ^p2 3710001)
+(make line ^p1 3710001 ^p2 3710002)
+(make line ^p1 3710002 ^p2 3710003)
+(make line ^p1 3710003 ^p2 3710005)
+(make line ^p1 3710005 ^p2 3700004)
+(make line ^p1 3710005 ^p2 3690005)
+(make line ^p1 3690005 ^p2 3680005)
+(make line ^p1 3680005 ^p2 3670005)
+(make line ^p1 3670005 ^p2 3660004)
+(make line ^p1 3600006 ^p2 3620006)
+(make line ^p1 3620006 ^p2 3630006)
+(make line ^p1 3630006 ^p2 3640006)
+(make line ^p1 3600006 ^p2 3600008)
+(make line ^p1 3600008 ^p2 3600009)
+(make line ^p1 3600009 ^p2 3600010)
+(make line ^p1 3600010 ^p2 3640010)
+(make line ^p1 3640010 ^p2 3640006)
+(make line ^p1 3640006 ^p2 3650007)
+(make line ^p1 3650007 ^p2 3650008)
+(make line ^p1 3650008 ^p2 3650009)
+(make line ^p1 3650009 ^p2 3650011)
+(make line ^p1 3650011 ^p2 3640010)
+(make line ^p1 3650011 ^p2 3630011)
+(make line ^p1 3630011 ^p2 3620011)
+(make line ^p1 3620011 ^p2 3610011)
+(make line ^p1 3610011 ^p2 3600010)
+(make line ^p1 3660006 ^p2 3680006)
+(make line ^p1 3680006 ^p2 3690006)
+(make line ^p1 3690006 ^p2 3700006)
+(make line ^p1 3660006 ^p2 3660008)
+(make line ^p1 3660008 ^p2 3660009)
+(make line ^p1 3660009 ^p2 3660010)
+(make line ^p1 3660010 ^p2 3700010)
+(make line ^p1 3700010 ^p2 3700006)
+(make line ^p1 3700006 ^p2 3710007)
+(make line ^p1 3710007 ^p2 3710008)
+(make line ^p1 3710008 ^p2 3710009)
+(make line ^p1 3710009 ^p2 3710011)
+(make line ^p1 3710011 ^p2 3700010)
+(make line ^p1 3710011 ^p2 3690011)
+(make line ^p1 3690011 ^p2 3680011)
+(make line ^p1 3680011 ^p2 3670011)
+(make line ^p1 3670011 ^p2 3660010)
+(make line ^p1 3590003 ^p2 3600003)
+(make line ^p1 3570005 ^p2 3570006)
+(make line ^p1 3620005 ^p2 3620006)
+(make line ^p1 3590008 ^p2 3600008)
+(make line ^p1 3770003 ^p2 3780003)
+(make line ^p1 3750005 ^p2 3750006)
+(make line ^p1 3800005 ^p2 3800006)
+(make line ^p1 3770008 ^p2 3780008)
+(make line ^p1 3720000 ^p2 3740000)
+(make line ^p1 3740000 ^p2 3750000)
+(make line ^p1 3750000 ^p2 3760000)
+(make line ^p1 3720000 ^p2 3720002)
+(make line ^p1 3720002 ^p2 3720003)
+(make line ^p1 3720003 ^p2 3720004)
+(make line ^p1 3720004 ^p2 3760004)
+(make line ^p1 3760004 ^p2 3760000)
+(make line ^p1 3760000 ^p2 3770001)
+(make line ^p1 3770001 ^p2 3770002)
+(make line ^p1 3770002 ^p2 3770003)
+(make line ^p1 3770003 ^p2 3770005)
+(make line ^p1 3770005 ^p2 3760004)
+(make line ^p1 3770005 ^p2 3750005)
+(make line ^p1 3750005 ^p2 3740005)
+(make line ^p1 3740005 ^p2 3730005)
+(make line ^p1 3730005 ^p2 3720004)
+(make line ^p1 3780000 ^p2 3800000)
+(make line ^p1 3800000 ^p2 3810000)
+(make line ^p1 3810000 ^p2 3820000)
+(make line ^p1 3780000 ^p2 3780002)
+(make line ^p1 3780002 ^p2 3780003)
+(make line ^p1 3780003 ^p2 3780004)
+(make line ^p1 3780004 ^p2 3820004)
+(make line ^p1 3820004 ^p2 3820000)
+(make line ^p1 3820000 ^p2 3830001)
+(make line ^p1 3830001 ^p2 3830002)
+(make line ^p1 3830002 ^p2 3830003)
+(make line ^p1 3830003 ^p2 3830005)
+(make line ^p1 3830005 ^p2 3820004)
+(make line ^p1 3830005 ^p2 3810005)
+(make line ^p1 3810005 ^p2 3800005)
+(make line ^p1 3800005 ^p2 3790005)
+(make line ^p1 3790005 ^p2 3780004)
+(make line ^p1 3720006 ^p2 3740006)
+(make line ^p1 3740006 ^p2 3750006)
+(make line ^p1 3750006 ^p2 3760006)
+(make line ^p1 3720006 ^p2 3720008)
+(make line ^p1 3720008 ^p2 3720009)
+(make line ^p1 3720009 ^p2 3720010)
+(make line ^p1 3720010 ^p2 3760010)
+(make line ^p1 3760010 ^p2 3760006)
+(make line ^p1 3760006 ^p2 3770007)
+(make line ^p1 3770007 ^p2 3770008)
+(make line ^p1 3770008 ^p2 3770009)
+(make line ^p1 3770009 ^p2 3770011)
+(make line ^p1 3770011 ^p2 3760010)
+(make line ^p1 3770011 ^p2 3750011)
+(make line ^p1 3750011 ^p2 3740011)
+(make line ^p1 3740011 ^p2 3730011)
+(make line ^p1 3730011 ^p2 3720010)
+(make line ^p1 3780006 ^p2 3800006)
+(make line ^p1 3800006 ^p2 3810006)
+(make line ^p1 3810006 ^p2 3820006)
+(make line ^p1 3780006 ^p2 3780008)
+(make line ^p1 3780008 ^p2 3780009)
+(make line ^p1 3780009 ^p2 3780010)
+(make line ^p1 3780010 ^p2 3820010)
+(make line ^p1 3820010 ^p2 3820006)
+(make line ^p1 3820006 ^p2 3830007)
+(make line ^p1 3830007 ^p2 3830008)
+(make line ^p1 3830008 ^p2 3830009)
+(make line ^p1 3830009 ^p2 3830011)
+(make line ^p1 3830011 ^p2 3820010)
+(make line ^p1 3830011 ^p2 3810011)
+(make line ^p1 3810011 ^p2 3800011)
+(make line ^p1 3800011 ^p2 3790011)
+(make line ^p1 3790011 ^p2 3780010)
+(make line ^p1 3710003 ^p2 3720003)
+(make line ^p1 3690005 ^p2 3690006)
+(make line ^p1 3740005 ^p2 3740006)
+(make line ^p1 3710008 ^p2 3720008)
+(make line ^p1 3890003 ^p2 3900003)
+(make line ^p1 3870005 ^p2 3870006)
+(make line ^p1 3920005 ^p2 3920006)
+(make line ^p1 3890008 ^p2 3900008)
+(make line ^p1 3840000 ^p2 3860000)
+(make line ^p1 3860000 ^p2 3870000)
+(make line ^p1 3870000 ^p2 3880000)
+(make line ^p1 3840000 ^p2 3840002)
+(make line ^p1 3840002 ^p2 3840003)
+(make line ^p1 3840003 ^p2 3840004)
+(make line ^p1 3840004 ^p2 3880004)
+(make line ^p1 3880004 ^p2 3880000)
+(make line ^p1 3880000 ^p2 3890001)
+(make line ^p1 3890001 ^p2 3890002)
+(make line ^p1 3890002 ^p2 3890003)
+(make line ^p1 3890003 ^p2 3890005)
+(make line ^p1 3890005 ^p2 3880004)
+(make line ^p1 3890005 ^p2 3870005)
+(make line ^p1 3870005 ^p2 3860005)
+(make line ^p1 3860005 ^p2 3850005)
+(make line ^p1 3850005 ^p2 3840004)
+(make line ^p1 3900000 ^p2 3920000)
+(make line ^p1 3920000 ^p2 3930000)
+(make line ^p1 3930000 ^p2 3940000)
+(make line ^p1 3900000 ^p2 3900002)
+(make line ^p1 3900002 ^p2 3900003)
+(make line ^p1 3900003 ^p2 3900004)
+(make line ^p1 3900004 ^p2 3940004)
+(make line ^p1 3940004 ^p2 3940000)
+(make line ^p1 3940000 ^p2 3950001)
+(make line ^p1 3950001 ^p2 3950002)
+(make line ^p1 3950002 ^p2 3950003)
+(make line ^p1 3950003 ^p2 3950005)
+(make line ^p1 3950005 ^p2 3940004)
+(make line ^p1 3950005 ^p2 3930005)
+(make line ^p1 3930005 ^p2 3920005)
+(make line ^p1 3920005 ^p2 3910005)
+(make line ^p1 3910005 ^p2 3900004)
+(make line ^p1 3840006 ^p2 3860006)
+(make line ^p1 3860006 ^p2 3870006)
+(make line ^p1 3870006 ^p2 3880006)
+(make line ^p1 3840006 ^p2 3840008)
+(make line ^p1 3840008 ^p2 3840009)
+(make line ^p1 3840009 ^p2 3840010)
+(make line ^p1 3840010 ^p2 3880010)
+(make line ^p1 3880010 ^p2 3880006)
+(make line ^p1 3880006 ^p2 3890007)
+(make line ^p1 3890007 ^p2 3890008)
+(make line ^p1 3890008 ^p2 3890009)
+(make line ^p1 3890009 ^p2 3890011)
+(make line ^p1 3890011 ^p2 3880010)
+(make line ^p1 3890011 ^p2 3870011)
+(make line ^p1 3870011 ^p2 3860011)
+(make line ^p1 3860011 ^p2 3850011)
+(make line ^p1 3850011 ^p2 3840010)
+(make line ^p1 3900006 ^p2 3920006)
+(make line ^p1 3920006 ^p2 3930006)
+(make line ^p1 3930006 ^p2 3940006)
+(make line ^p1 3900006 ^p2 3900008)
+(make line ^p1 3900008 ^p2 3900009)
+(make line ^p1 3900009 ^p2 3900010)
+(make line ^p1 3900010 ^p2 3940010)
+(make line ^p1 3940010 ^p2 3940006)
+(make line ^p1 3940006 ^p2 3950007)
+(make line ^p1 3950007 ^p2 3950008)
+(make line ^p1 3950008 ^p2 3950009)
+(make line ^p1 3950009 ^p2 3950011)
+(make line ^p1 3950011 ^p2 3940010)
+(make line ^p1 3950011 ^p2 3930011)
+(make line ^p1 3930011 ^p2 3920011)
+(make line ^p1 3920011 ^p2 3910011)
+(make line ^p1 3910011 ^p2 3900010)
+(make line ^p1 3830003 ^p2 3840003)
+(make line ^p1 3810005 ^p2 3810006)
+(make line ^p1 3860005 ^p2 3860006)
+(make line ^p1 3830008 ^p2 3840008)
+(make line ^p1 4010003 ^p2 4020003)
+(make line ^p1 3990005 ^p2 3990006)
+(make line ^p1 4040005 ^p2 4040006)
+(make line ^p1 4010008 ^p2 4020008)
+(make line ^p1 3960000 ^p2 3980000)
+(make line ^p1 3980000 ^p2 3990000)
+(make line ^p1 3990000 ^p2 4000000)
+(make line ^p1 3960000 ^p2 3960002)
+(make line ^p1 3960002 ^p2 3960003)
+(make line ^p1 3960003 ^p2 3960004)
+(make line ^p1 3960004 ^p2 4000004)
+(make line ^p1 4000004 ^p2 4000000)
+(make line ^p1 4000000 ^p2 4010001)
+(make line ^p1 4010001 ^p2 4010002)
+(make line ^p1 4010002 ^p2 4010003)
+(make line ^p1 4010003 ^p2 4010005)
+(make line ^p1 4010005 ^p2 4000004)
+(make line ^p1 4010005 ^p2 3990005)
+(make line ^p1 3990005 ^p2 3980005)
+(make line ^p1 3980005 ^p2 3970005)
+(make line ^p1 3970005 ^p2 3960004)
+(make line ^p1 4020000 ^p2 4040000)
+(make line ^p1 4040000 ^p2 4050000)
+(make line ^p1 4050000 ^p2 4060000)
+(make line ^p1 4020000 ^p2 4020002)
+(make line ^p1 4020002 ^p2 4020003)
+(make line ^p1 4020003 ^p2 4020004)
+(make line ^p1 4020004 ^p2 4060004)
+(make line ^p1 4060004 ^p2 4060000)
+(make line ^p1 4060000 ^p2 4070001)
+(make line ^p1 4070001 ^p2 4070002)
+(make line ^p1 4070002 ^p2 4070003)
+(make line ^p1 4070003 ^p2 4070005)
+(make line ^p1 4070005 ^p2 4060004)
+(make line ^p1 4070005 ^p2 4050005)
+(make line ^p1 4050005 ^p2 4040005)
+(make line ^p1 4040005 ^p2 4030005)
+(make line ^p1 4030005 ^p2 4020004)
+(make line ^p1 3960006 ^p2 3980006)
+(make line ^p1 3980006 ^p2 3990006)
+(make line ^p1 3990006 ^p2 4000006)
+(make line ^p1 3960006 ^p2 3960008)
+(make line ^p1 3960008 ^p2 3960009)
+(make line ^p1 3960009 ^p2 3960010)
+(make line ^p1 3960010 ^p2 4000010)
+(make line ^p1 4000010 ^p2 4000006)
+(make line ^p1 4000006 ^p2 4010007)
+(make line ^p1 4010007 ^p2 4010008)
+(make line ^p1 4010008 ^p2 4010009)
+(make line ^p1 4010009 ^p2 4010011)
+(make line ^p1 4010011 ^p2 4000010)
+(make line ^p1 4010011 ^p2 3990011)
+(make line ^p1 3990011 ^p2 3980011)
+(make line ^p1 3980011 ^p2 3970011)
+(make line ^p1 3970011 ^p2 3960010)
+(make line ^p1 4020006 ^p2 4040006)
+(make line ^p1 4040006 ^p2 4050006)
+(make line ^p1 4050006 ^p2 4060006)
+(make line ^p1 4020006 ^p2 4020008)
+(make line ^p1 4020008 ^p2 4020009)
+(make line ^p1 4020009 ^p2 4020010)
+(make line ^p1 4020010 ^p2 4060010)
+(make line ^p1 4060010 ^p2 4060006)
+(make line ^p1 4060006 ^p2 4070007)
+(make line ^p1 4070007 ^p2 4070008)
+(make line ^p1 4070008 ^p2 4070009)
+(make line ^p1 4070009 ^p2 4070011)
+(make line ^p1 4070011 ^p2 4060010)
+(make line ^p1 4070011 ^p2 4050011)
+(make line ^p1 4050011 ^p2 4040011)
+(make line ^p1 4040011 ^p2 4030011)
+(make line ^p1 4030011 ^p2 4020010)
+(make line ^p1 3950003 ^p2 3960003)
+(make line ^p1 3930005 ^p2 3930006)
+(make line ^p1 3980005 ^p2 3980006)
+(make line ^p1 3950008 ^p2 3960008)
+(make line ^p1 4130003 ^p2 4140003)
+(make line ^p1 4110005 ^p2 4110006)
+(make line ^p1 4160005 ^p2 4160006)
+(make line ^p1 4130008 ^p2 4140008)
+(make line ^p1 4080000 ^p2 4100000)
+(make line ^p1 4100000 ^p2 4110000)
+(make line ^p1 4110000 ^p2 4120000)
+(make line ^p1 4080000 ^p2 4080002)
+(make line ^p1 4080002 ^p2 4080003)
+(make line ^p1 4080003 ^p2 4080004)
+(make line ^p1 4080004 ^p2 4120004)
+(make line ^p1 4120004 ^p2 4120000)
+(make line ^p1 4120000 ^p2 4130001)
+(make line ^p1 4130001 ^p2 4130002)
+(make line ^p1 4130002 ^p2 4130003)
+(make line ^p1 4130003 ^p2 4130005)
+(make line ^p1 4130005 ^p2 4120004)
+(make line ^p1 4130005 ^p2 4110005)
+(make line ^p1 4110005 ^p2 4100005)
+(make line ^p1 4100005 ^p2 4090005)
+(make line ^p1 4090005 ^p2 4080004)
+(make line ^p1 4140000 ^p2 4160000)
+(make line ^p1 4160000 ^p2 4170000)
+(make line ^p1 4170000 ^p2 4180000)
+(make line ^p1 4140000 ^p2 4140002)
+(make line ^p1 4140002 ^p2 4140003)
+(make line ^p1 4140003 ^p2 4140004)
+(make line ^p1 4140004 ^p2 4180004)
+(make line ^p1 4180004 ^p2 4180000)
+(make line ^p1 4180000 ^p2 4190001)
+(make line ^p1 4190001 ^p2 4190002)
+(make line ^p1 4190002 ^p2 4190003)
+(make line ^p1 4190003 ^p2 4190005)
+(make line ^p1 4190005 ^p2 4180004)
+(make line ^p1 4190005 ^p2 4170005)
+(make line ^p1 4170005 ^p2 4160005)
+(make line ^p1 4160005 ^p2 4150005)
+(make line ^p1 4150005 ^p2 4140004)
+(make line ^p1 4080006 ^p2 4100006)
+(make line ^p1 4100006 ^p2 4110006)
+(make line ^p1 4110006 ^p2 4120006)
+(make line ^p1 4080006 ^p2 4080008)
+(make line ^p1 4080008 ^p2 4080009)
+(make line ^p1 4080009 ^p2 4080010)
+(make line ^p1 4080010 ^p2 4120010)
+(make line ^p1 4120010 ^p2 4120006)
+(make line ^p1 4120006 ^p2 4130007)
+(make line ^p1 4130007 ^p2 4130008)
+(make line ^p1 4130008 ^p2 4130009)
+(make line ^p1 4130009 ^p2 4130011)
+(make line ^p1 4130011 ^p2 4120010)
+(make line ^p1 4130011 ^p2 4110011)
+(make line ^p1 4110011 ^p2 4100011)
+(make line ^p1 4100011 ^p2 4090011)
+(make line ^p1 4090011 ^p2 4080010)
+(make line ^p1 4140006 ^p2 4160006)
+(make line ^p1 4160006 ^p2 4170006)
+(make line ^p1 4170006 ^p2 4180006)
+(make line ^p1 4140006 ^p2 4140008)
+(make line ^p1 4140008 ^p2 4140009)
+(make line ^p1 4140009 ^p2 4140010)
+(make line ^p1 4140010 ^p2 4180010)
+(make line ^p1 4180010 ^p2 4180006)
+(make line ^p1 4180006 ^p2 4190007)
+(make line ^p1 4190007 ^p2 4190008)
+(make line ^p1 4190008 ^p2 4190009)
+(make line ^p1 4190009 ^p2 4190011)
+(make line ^p1 4190011 ^p2 4180010)
+(make line ^p1 4190011 ^p2 4170011)
+(make line ^p1 4170011 ^p2 4160011)
+(make line ^p1 4160011 ^p2 4150011)
+(make line ^p1 4150011 ^p2 4140010)
+(make line ^p1 4070003 ^p2 4080003)
+(make line ^p1 4050005 ^p2 4050006)
+(make line ^p1 4100005 ^p2 4100006)
+(make line ^p1 4070008 ^p2 4080008)
+(make line ^p1 4250003 ^p2 4260003)
+(make line ^p1 4230005 ^p2 4230006)
+(make line ^p1 4280005 ^p2 4280006)
+(make line ^p1 4250008 ^p2 4260008)
+(make line ^p1 4200000 ^p2 4220000)
+(make line ^p1 4220000 ^p2 4230000)
+(make line ^p1 4230000 ^p2 4240000)
+(make line ^p1 4200000 ^p2 4200002)
+(make line ^p1 4200002 ^p2 4200003)
+(make line ^p1 4200003 ^p2 4200004)
+(make line ^p1 4200004 ^p2 4240004)
+(make line ^p1 4240004 ^p2 4240000)
+(make line ^p1 4240000 ^p2 4250001)
+(make line ^p1 4250001 ^p2 4250002)
+(make line ^p1 4250002 ^p2 4250003)
+(make line ^p1 4250003 ^p2 4250005)
+(make line ^p1 4250005 ^p2 4240004)
+(make line ^p1 4250005 ^p2 4230005)
+(make line ^p1 4230005 ^p2 4220005)
+(make line ^p1 4220005 ^p2 4210005)
+(make line ^p1 4210005 ^p2 4200004)
+(make line ^p1 4260000 ^p2 4280000)
+(make line ^p1 4280000 ^p2 4290000)
+(make line ^p1 4290000 ^p2 4300000)
+(make line ^p1 4260000 ^p2 4260002)
+(make line ^p1 4260002 ^p2 4260003)
+(make line ^p1 4260003 ^p2 4260004)
+(make line ^p1 4260004 ^p2 4300004)
+(make line ^p1 4300004 ^p2 4300000)
+(make line ^p1 4300000 ^p2 4310001)
+(make line ^p1 4310001 ^p2 4310002)
+(make line ^p1 4310002 ^p2 4310003)
+(make line ^p1 4310003 ^p2 4310005)
+(make line ^p1 4310005 ^p2 4300004)
+(make line ^p1 4310005 ^p2 4290005)
+(make line ^p1 4290005 ^p2 4280005)
+(make line ^p1 4280005 ^p2 4270005)
+(make line ^p1 4270005 ^p2 4260004)
+(make line ^p1 4200006 ^p2 4220006)
+(make line ^p1 4220006 ^p2 4230006)
+(make line ^p1 4230006 ^p2 4240006)
+(make line ^p1 4200006 ^p2 4200008)
+(make line ^p1 4200008 ^p2 4200009)
+(make line ^p1 4200009 ^p2 4200010)
+(make line ^p1 4200010 ^p2 4240010)
+(make line ^p1 4240010 ^p2 4240006)
+(make line ^p1 4240006 ^p2 4250007)
+(make line ^p1 4250007 ^p2 4250008)
+(make line ^p1 4250008 ^p2 4250009)
+(make line ^p1 4250009 ^p2 4250011)
+(make line ^p1 4250011 ^p2 4240010)
+(make line ^p1 4250011 ^p2 4230011)
+(make line ^p1 4230011 ^p2 4220011)
+(make line ^p1 4220011 ^p2 4210011)
+(make line ^p1 4210011 ^p2 4200010)
+(make line ^p1 4260006 ^p2 4280006)
+(make line ^p1 4280006 ^p2 4290006)
+(make line ^p1 4290006 ^p2 4300006)
+(make line ^p1 4260006 ^p2 4260008)
+(make line ^p1 4260008 ^p2 4260009)
+(make line ^p1 4260009 ^p2 4260010)
+(make line ^p1 4260010 ^p2 4300010)
+(make line ^p1 4300010 ^p2 4300006)
+(make line ^p1 4300006 ^p2 4310007)
+(make line ^p1 4310007 ^p2 4310008)
+(make line ^p1 4310008 ^p2 4310009)
+(make line ^p1 4310009 ^p2 4310011)
+(make line ^p1 4310011 ^p2 4300010)
+(make line ^p1 4310011 ^p2 4290011)
+(make line ^p1 4290011 ^p2 4280011)
+(make line ^p1 4280011 ^p2 4270011)
+(make line ^p1 4270011 ^p2 4260010)
+(make line ^p1 4190003 ^p2 4200003)
+(make line ^p1 4170005 ^p2 4170006)
+(make line ^p1 4220005 ^p2 4220006)
+(make line ^p1 4190008 ^p2 4200008)
+(make line ^p1 4370003 ^p2 4380003)
+(make line ^p1 4350005 ^p2 4350006)
+(make line ^p1 4400005 ^p2 4400006)
+(make line ^p1 4370008 ^p2 4380008)
+(make line ^p1 4320000 ^p2 4340000)
+(make line ^p1 4340000 ^p2 4350000)
+(make line ^p1 4350000 ^p2 4360000)
+(make line ^p1 4320000 ^p2 4320002)
+(make line ^p1 4320002 ^p2 4320003)
+(make line ^p1 4320003 ^p2 4320004)
+(make line ^p1 4320004 ^p2 4360004)
+(make line ^p1 4360004 ^p2 4360000)
+(make line ^p1 4360000 ^p2 4370001)
+(make line ^p1 4370001 ^p2 4370002)
+(make line ^p1 4370002 ^p2 4370003)
+(make line ^p1 4370003 ^p2 4370005)
+(make line ^p1 4370005 ^p2 4360004)
+(make line ^p1 4370005 ^p2 4350005)
+(make line ^p1 4350005 ^p2 4340005)
+(make line ^p1 4340005 ^p2 4330005)
+(make line ^p1 4330005 ^p2 4320004)
+(make line ^p1 4380000 ^p2 4400000)
+(make line ^p1 4400000 ^p2 4410000)
+(make line ^p1 4410000 ^p2 4420000)
+(make line ^p1 4380000 ^p2 4380002)
+(make line ^p1 4380002 ^p2 4380003)
+(make line ^p1 4380003 ^p2 4380004)
+(make line ^p1 4380004 ^p2 4420004)
+(make line ^p1 4420004 ^p2 4420000)
+(make line ^p1 4420000 ^p2 4430001)
+(make line ^p1 4430001 ^p2 4430002)
+(make line ^p1 4430002 ^p2 4430003)
+(make line ^p1 4430003 ^p2 4430005)
+(make line ^p1 4430005 ^p2 4420004)
+(make line ^p1 4430005 ^p2 4410005)
+(make line ^p1 4410005 ^p2 4400005)
+(make line ^p1 4400005 ^p2 4390005)
+(make line ^p1 4390005 ^p2 4380004)
+(make line ^p1 4320006 ^p2 4340006)
+(make line ^p1 4340006 ^p2 4350006)
+(make line ^p1 4350006 ^p2 4360006)
+(make line ^p1 4320006 ^p2 4320008)
+(make line ^p1 4320008 ^p2 4320009)
+(make line ^p1 4320009 ^p2 4320010)
+(make line ^p1 4320010 ^p2 4360010)
+(make line ^p1 4360010 ^p2 4360006)
+(make line ^p1 4360006 ^p2 4370007)
+(make line ^p1 4370007 ^p2 4370008)
+(make line ^p1 4370008 ^p2 4370009)
+(make line ^p1 4370009 ^p2 4370011)
+(make line ^p1 4370011 ^p2 4360010)
+(make line ^p1 4370011 ^p2 4350011)
+(make line ^p1 4350011 ^p2 4340011)
+(make line ^p1 4340011 ^p2 4330011)
+(make line ^p1 4330011 ^p2 4320010)
+(make line ^p1 4380006 ^p2 4400006)
+(make line ^p1 4400006 ^p2 4410006)
+(make line ^p1 4410006 ^p2 4420006)
+(make line ^p1 4380006 ^p2 4380008)
+(make line ^p1 4380008 ^p2 4380009)
+(make line ^p1 4380009 ^p2 4380010)
+(make line ^p1 4380010 ^p2 4420010)
+(make line ^p1 4420010 ^p2 4420006)
+(make line ^p1 4420006 ^p2 4430007)
+(make line ^p1 4430007 ^p2 4430008)
+(make line ^p1 4430008 ^p2 4430009)
+(make line ^p1 4430009 ^p2 4430011)
+(make line ^p1 4430011 ^p2 4420010)
+(make line ^p1 4430011 ^p2 4410011)
+(make line ^p1 4410011 ^p2 4400011)
+(make line ^p1 4400011 ^p2 4390011)
+(make line ^p1 4390011 ^p2 4380010)
+(make line ^p1 4310003 ^p2 4320003)
+(make line ^p1 4290005 ^p2 4290006)
+(make line ^p1 4340005 ^p2 4340006)
+(make line ^p1 4310008 ^p2 4320008)
+(make line ^p1 4490003 ^p2 4500003)
+(make line ^p1 4470005 ^p2 4470006)
+(make line ^p1 4520005 ^p2 4520006)
+(make line ^p1 4490008 ^p2 4500008)
+(make line ^p1 4440000 ^p2 4460000)
+(make line ^p1 4460000 ^p2 4470000)
+(make line ^p1 4470000 ^p2 4480000)
+(make line ^p1 4440000 ^p2 4440002)
+(make line ^p1 4440002 ^p2 4440003)
+(make line ^p1 4440003 ^p2 4440004)
+(make line ^p1 4440004 ^p2 4480004)
+(make line ^p1 4480004 ^p2 4480000)
+(make line ^p1 4480000 ^p2 4490001)
+(make line ^p1 4490001 ^p2 4490002)
+(make line ^p1 4490002 ^p2 4490003)
+(make line ^p1 4490003 ^p2 4490005)
+(make line ^p1 4490005 ^p2 4480004)
+(make line ^p1 4490005 ^p2 4470005)
+(make line ^p1 4470005 ^p2 4460005)
+(make line ^p1 4460005 ^p2 4450005)
+(make line ^p1 4450005 ^p2 4440004)
+(make line ^p1 4500000 ^p2 4520000)
+(make line ^p1 4520000 ^p2 4530000)
+(make line ^p1 4530000 ^p2 4540000)
+(make line ^p1 4500000 ^p2 4500002)
+(make line ^p1 4500002 ^p2 4500003)
+(make line ^p1 4500003 ^p2 4500004)
+(make line ^p1 4500004 ^p2 4540004)
+(make line ^p1 4540004 ^p2 4540000)
+(make line ^p1 4540000 ^p2 4550001)
+(make line ^p1 4550001 ^p2 4550002)
+(make line ^p1 4550002 ^p2 4550003)
+(make line ^p1 4550003 ^p2 4550005)
+(make line ^p1 4550005 ^p2 4540004)
+(make line ^p1 4550005 ^p2 4530005)
+(make line ^p1 4530005 ^p2 4520005)
+(make line ^p1 4520005 ^p2 4510005)
+(make line ^p1 4510005 ^p2 4500004)
+(make line ^p1 4440006 ^p2 4460006)
+(make line ^p1 4460006 ^p2 4470006)
+(make line ^p1 4470006 ^p2 4480006)
+(make line ^p1 4440006 ^p2 4440008)
+(make line ^p1 4440008 ^p2 4440009)
+(make line ^p1 4440009 ^p2 4440010)
+(make line ^p1 4440010 ^p2 4480010)
+(make line ^p1 4480010 ^p2 4480006)
+(make line ^p1 4480006 ^p2 4490007)
+(make line ^p1 4490007 ^p2 4490008)
+(make line ^p1 4490008 ^p2 4490009)
+(make line ^p1 4490009 ^p2 4490011)
+(make line ^p1 4490011 ^p2 4480010)
+(make line ^p1 4490011 ^p2 4470011)
+(make line ^p1 4470011 ^p2 4460011)
+(make line ^p1 4460011 ^p2 4450011)
+(make line ^p1 4450011 ^p2 4440010)
+(make line ^p1 4500006 ^p2 4520006)
+(make line ^p1 4520006 ^p2 4530006)
+(make line ^p1 4530006 ^p2 4540006)
+(make line ^p1 4500006 ^p2 4500008)
+(make line ^p1 4500008 ^p2 4500009)
+(make line ^p1 4500009 ^p2 4500010)
+(make line ^p1 4500010 ^p2 4540010)
+(make line ^p1 4540010 ^p2 4540006)
+(make line ^p1 4540006 ^p2 4550007)
+(make line ^p1 4550007 ^p2 4550008)
+(make line ^p1 4550008 ^p2 4550009)
+(make line ^p1 4550009 ^p2 4550011)
+(make line ^p1 4550011 ^p2 4540010)
+(make line ^p1 4550011 ^p2 4530011)
+(make line ^p1 4530011 ^p2 4520011)
+(make line ^p1 4520011 ^p2 4510011)
+(make line ^p1 4510011 ^p2 4500010)
+(make line ^p1 4430003 ^p2 4440003)
+(make line ^p1 4410005 ^p2 4410006)
+(make line ^p1 4460005 ^p2 4460006)
+(make line ^p1 4430008 ^p2 4440008)
+(make line ^p1 4610003 ^p2 4620003)
+(make line ^p1 4590005 ^p2 4590006)
+(make line ^p1 4640005 ^p2 4640006)
+(make line ^p1 4610008 ^p2 4620008)
+(make line ^p1 4560000 ^p2 4580000)
+(make line ^p1 4580000 ^p2 4590000)
+(make line ^p1 4590000 ^p2 4600000)
+(make line ^p1 4560000 ^p2 4560002)
+(make line ^p1 4560002 ^p2 4560003)
+(make line ^p1 4560003 ^p2 4560004)
+(make line ^p1 4560004 ^p2 4600004)
+(make line ^p1 4600004 ^p2 4600000)
+(make line ^p1 4600000 ^p2 4610001)
+(make line ^p1 4610001 ^p2 4610002)
+(make line ^p1 4610002 ^p2 4610003)
+(make line ^p1 4610003 ^p2 4610005)
+(make line ^p1 4610005 ^p2 4600004)
+(make line ^p1 4610005 ^p2 4590005)
+(make line ^p1 4590005 ^p2 4580005)
+(make line ^p1 4580005 ^p2 4570005)
+(make line ^p1 4570005 ^p2 4560004)
+(make line ^p1 4620000 ^p2 4640000)
+(make line ^p1 4640000 ^p2 4650000)
+(make line ^p1 4650000 ^p2 4660000)
+(make line ^p1 4620000 ^p2 4620002)
+(make line ^p1 4620002 ^p2 4620003)
+(make line ^p1 4620003 ^p2 4620004)
+(make line ^p1 4620004 ^p2 4660004)
+(make line ^p1 4660004 ^p2 4660000)
+(make line ^p1 4660000 ^p2 4670001)
+(make line ^p1 4670001 ^p2 4670002)
+(make line ^p1 4670002 ^p2 4670003)
+(make line ^p1 4670003 ^p2 4670005)
+(make line ^p1 4670005 ^p2 4660004)
+(make line ^p1 4670005 ^p2 4650005)
+(make line ^p1 4650005 ^p2 4640005)
+(make line ^p1 4640005 ^p2 4630005)
+(make line ^p1 4630005 ^p2 4620004)
+(make line ^p1 4560006 ^p2 4580006)
+(make line ^p1 4580006 ^p2 4590006)
+(make line ^p1 4590006 ^p2 4600006)
+(make line ^p1 4560006 ^p2 4560008)
+(make line ^p1 4560008 ^p2 4560009)
+(make line ^p1 4560009 ^p2 4560010)
+(make line ^p1 4560010 ^p2 4600010)
+(make line ^p1 4600010 ^p2 4600006)
+(make line ^p1 4600006 ^p2 4610007)
+(make line ^p1 4610007 ^p2 4610008)
+(make line ^p1 4610008 ^p2 4610009)
+(make line ^p1 4610009 ^p2 4610011)
+(make line ^p1 4610011 ^p2 4600010)
+(make line ^p1 4610011 ^p2 4590011)
+(make line ^p1 4590011 ^p2 4580011)
+(make line ^p1 4580011 ^p2 4570011)
+(make line ^p1 4570011 ^p2 4560010)
+(make line ^p1 4620006 ^p2 4640006)
+(make line ^p1 4640006 ^p2 4650006)
+(make line ^p1 4650006 ^p2 4660006)
+(make line ^p1 4620006 ^p2 4620008)
+(make line ^p1 4620008 ^p2 4620009)
+(make line ^p1 4620009 ^p2 4620010)
+(make line ^p1 4620010 ^p2 4660010)
+(make line ^p1 4660010 ^p2 4660006)
+(make line ^p1 4660006 ^p2 4670007)
+(make line ^p1 4670007 ^p2 4670008)
+(make line ^p1 4670008 ^p2 4670009)
+(make line ^p1 4670009 ^p2 4670011)
+(make line ^p1 4670011 ^p2 4660010)
+(make line ^p1 4670011 ^p2 4650011)
+(make line ^p1 4650011 ^p2 4640011)
+(make line ^p1 4640011 ^p2 4630011)
+(make line ^p1 4630011 ^p2 4620010)
+(make line ^p1 4550003 ^p2 4560003)
+(make line ^p1 4530005 ^p2 4530006)
+(make line ^p1 4580005 ^p2 4580006)
+(make line ^p1 4550008 ^p2 4560008)
+(make line ^p1 4730003 ^p2 4740003)
+(make line ^p1 4710005 ^p2 4710006)
+(make line ^p1 4760005 ^p2 4760006)
+(make line ^p1 4730008 ^p2 4740008)
+(make line ^p1 4680000 ^p2 4700000)
+(make line ^p1 4700000 ^p2 4710000)
+(make line ^p1 4710000 ^p2 4720000)
+(make line ^p1 4680000 ^p2 4680002)
+(make line ^p1 4680002 ^p2 4680003)
+(make line ^p1 4680003 ^p2 4680004)
+(make line ^p1 4680004 ^p2 4720004)
+(make line ^p1 4720004 ^p2 4720000)
+(make line ^p1 4720000 ^p2 4730001)
+(make line ^p1 4730001 ^p2 4730002)
+(make line ^p1 4730002 ^p2 4730003)
+(make line ^p1 4730003 ^p2 4730005)
+(make line ^p1 4730005 ^p2 4720004)
+(make line ^p1 4730005 ^p2 4710005)
+(make line ^p1 4710005 ^p2 4700005)
+(make line ^p1 4700005 ^p2 4690005)
+(make line ^p1 4690005 ^p2 4680004)
+(make line ^p1 4740000 ^p2 4760000)
+(make line ^p1 4760000 ^p2 4770000)
+(make line ^p1 4770000 ^p2 4780000)
+(make line ^p1 4740000 ^p2 4740002)
+(make line ^p1 4740002 ^p2 4740003)
+(make line ^p1 4740003 ^p2 4740004)
+(make line ^p1 4740004 ^p2 4780004)
+(make line ^p1 4780004 ^p2 4780000)
+(make line ^p1 4780000 ^p2 4790001)
+(make line ^p1 4790001 ^p2 4790002)
+(make line ^p1 4790002 ^p2 4790003)
+(make line ^p1 4790003 ^p2 4790005)
+(make line ^p1 4790005 ^p2 4780004)
+(make line ^p1 4790005 ^p2 4770005)
+(make line ^p1 4770005 ^p2 4760005)
+(make line ^p1 4760005 ^p2 4750005)
+(make line ^p1 4750005 ^p2 4740004)
+(make line ^p1 4680006 ^p2 4700006)
+(make line ^p1 4700006 ^p2 4710006)
+(make line ^p1 4710006 ^p2 4720006)
+(make line ^p1 4680006 ^p2 4680008)
+(make line ^p1 4680008 ^p2 4680009)
+(make line ^p1 4680009 ^p2 4680010)
+(make line ^p1 4680010 ^p2 4720010)
+(make line ^p1 4720010 ^p2 4720006)
+(make line ^p1 4720006 ^p2 4730007)
+(make line ^p1 4730007 ^p2 4730008)
+(make line ^p1 4730008 ^p2 4730009)
+(make line ^p1 4730009 ^p2 4730011)
+(make line ^p1 4730011 ^p2 4720010)
+(make line ^p1 4730011 ^p2 4710011)
+(make line ^p1 4710011 ^p2 4700011)
+(make line ^p1 4700011 ^p2 4690011)
+(make line ^p1 4690011 ^p2 4680010)
+(make line ^p1 4740006 ^p2 4760006)
+(make line ^p1 4760006 ^p2 4770006)
+(make line ^p1 4770006 ^p2 4780006)
+(make line ^p1 4740006 ^p2 4740008)
+(make line ^p1 4740008 ^p2 4740009)
+(make line ^p1 4740009 ^p2 4740010)
+(make line ^p1 4740010 ^p2 4780010)
+(make line ^p1 4780010 ^p2 4780006)
+(make line ^p1 4780006 ^p2 4790007)
+(make line ^p1 4790007 ^p2 4790008)
+(make line ^p1 4790008 ^p2 4790009)
+(make line ^p1 4790009 ^p2 4790011)
+(make line ^p1 4790011 ^p2 4780010)
+(make line ^p1 4790011 ^p2 4770011)
+(make line ^p1 4770011 ^p2 4760011)
+(make line ^p1 4760011 ^p2 4750011)
+(make line ^p1 4750011 ^p2 4740010)
+(make line ^p1 4670003 ^p2 4680003)
+(make line ^p1 4650005 ^p2 4650006)
+(make line ^p1 4700005 ^p2 4700006)
+(make line ^p1 4670008 ^p2 4680008)
+(make line ^p1 4850003 ^p2 4860003)
+(make line ^p1 4830005 ^p2 4830006)
+(make line ^p1 4880005 ^p2 4880006)
+(make line ^p1 4850008 ^p2 4860008)
+(make line ^p1 4800000 ^p2 4820000)
+(make line ^p1 4820000 ^p2 4830000)
+(make line ^p1 4830000 ^p2 4840000)
+(make line ^p1 4800000 ^p2 4800002)
+(make line ^p1 4800002 ^p2 4800003)
+(make line ^p1 4800003 ^p2 4800004)
+(make line ^p1 4800004 ^p2 4840004)
+(make line ^p1 4840004 ^p2 4840000)
+(make line ^p1 4840000 ^p2 4850001)
+(make line ^p1 4850001 ^p2 4850002)
+(make line ^p1 4850002 ^p2 4850003)
+(make line ^p1 4850003 ^p2 4850005)
+(make line ^p1 4850005 ^p2 4840004)
+(make line ^p1 4850005 ^p2 4830005)
+(make line ^p1 4830005 ^p2 4820005)
+(make line ^p1 4820005 ^p2 4810005)
+(make line ^p1 4810005 ^p2 4800004)
+(make line ^p1 4860000 ^p2 4880000)
+(make line ^p1 4880000 ^p2 4890000)
+(make line ^p1 4890000 ^p2 4900000)
+(make line ^p1 4860000 ^p2 4860002)
+(make line ^p1 4860002 ^p2 4860003)
+(make line ^p1 4860003 ^p2 4860004)
+(make line ^p1 4860004 ^p2 4900004)
+(make line ^p1 4900004 ^p2 4900000)
+(make line ^p1 4900000 ^p2 4910001)
+(make line ^p1 4910001 ^p2 4910002)
+(make line ^p1 4910002 ^p2 4910003)
+(make line ^p1 4910003 ^p2 4910005)
+(make line ^p1 4910005 ^p2 4900004)
+(make line ^p1 4910005 ^p2 4890005)
+(make line ^p1 4890005 ^p2 4880005)
+(make line ^p1 4880005 ^p2 4870005)
+(make line ^p1 4870005 ^p2 4860004)
+(make line ^p1 4800006 ^p2 4820006)
+(make line ^p1 4820006 ^p2 4830006)
+(make line ^p1 4830006 ^p2 4840006)
+(make line ^p1 4800006 ^p2 4800008)
+(make line ^p1 4800008 ^p2 4800009)
+(make line ^p1 4800009 ^p2 4800010)
+(make line ^p1 4800010 ^p2 4840010)
+(make line ^p1 4840010 ^p2 4840006)
+(make line ^p1 4840006 ^p2 4850007)
+(make line ^p1 4850007 ^p2 4850008)
+(make line ^p1 4850008 ^p2 4850009)
+(make line ^p1 4850009 ^p2 4850011)
+(make line ^p1 4850011 ^p2 4840010)
+(make line ^p1 4850011 ^p2 4830011)
+(make line ^p1 4830011 ^p2 4820011)
+(make line ^p1 4820011 ^p2 4810011)
+(make line ^p1 4810011 ^p2 4800010)
+(make line ^p1 4860006 ^p2 4880006)
+(make line ^p1 4880006 ^p2 4890006)
+(make line ^p1 4890006 ^p2 4900006)
+(make line ^p1 4860006 ^p2 4860008)
+(make line ^p1 4860008 ^p2 4860009)
+(make line ^p1 4860009 ^p2 4860010)
+(make line ^p1 4860010 ^p2 4900010)
+(make line ^p1 4900010 ^p2 4900006)
+(make line ^p1 4900006 ^p2 4910007)
+(make line ^p1 4910007 ^p2 4910008)
+(make line ^p1 4910008 ^p2 4910009)
+(make line ^p1 4910009 ^p2 4910011)
+(make line ^p1 4910011 ^p2 4900010)
+(make line ^p1 4910011 ^p2 4890011)
+(make line ^p1 4890011 ^p2 4880011)
+(make line ^p1 4880011 ^p2 4870011)
+(make line ^p1 4870011 ^p2 4860010)
+(make line ^p1 4790003 ^p2 4800003)
+(make line ^p1 4770005 ^p2 4770006)
+(make line ^p1 4820005 ^p2 4820006)
+(make line ^p1 4790008 ^p2 4800008)
+(make line ^p1 4970003 ^p2 4980003)
+(make line ^p1 4950005 ^p2 4950006)
+(make line ^p1 5000005 ^p2 5000006)
+(make line ^p1 4970008 ^p2 4980008)
+(make line ^p1 4920000 ^p2 4940000)
+(make line ^p1 4940000 ^p2 4950000)
+(make line ^p1 4950000 ^p2 4960000)
+(make line ^p1 4920000 ^p2 4920002)
+(make line ^p1 4920002 ^p2 4920003)
+(make line ^p1 4920003 ^p2 4920004)
+(make line ^p1 4920004 ^p2 4960004)
+(make line ^p1 4960004 ^p2 4960000)
+(make line ^p1 4960000 ^p2 4970001)
+(make line ^p1 4970001 ^p2 4970002)
+(make line ^p1 4970002 ^p2 4970003)
+(make line ^p1 4970003 ^p2 4970005)
+(make line ^p1 4970005 ^p2 4960004)
+(make line ^p1 4970005 ^p2 4950005)
+(make line ^p1 4950005 ^p2 4940005)
+(make line ^p1 4940005 ^p2 4930005)
+(make line ^p1 4930005 ^p2 4920004)
+(make line ^p1 4980000 ^p2 5000000)
+(make line ^p1 5000000 ^p2 5010000)
+(make line ^p1 5010000 ^p2 5020000)
+(make line ^p1 4980000 ^p2 4980002)
+(make line ^p1 4980002 ^p2 4980003)
+(make line ^p1 4980003 ^p2 4980004)
+(make line ^p1 4980004 ^p2 5020004)
+(make line ^p1 5020004 ^p2 5020000)
+(make line ^p1 5020000 ^p2 5030001)
+(make line ^p1 5030001 ^p2 5030002)
+(make line ^p1 5030002 ^p2 5030003)
+(make line ^p1 5030003 ^p2 5030005)
+(make line ^p1 5030005 ^p2 5020004)
+(make line ^p1 5030005 ^p2 5010005)
+(make line ^p1 5010005 ^p2 5000005)
+(make line ^p1 5000005 ^p2 4990005)
+(make line ^p1 4990005 ^p2 4980004)
+(make line ^p1 4920006 ^p2 4940006)
+(make line ^p1 4940006 ^p2 4950006)
+(make line ^p1 4950006 ^p2 4960006)
+(make line ^p1 4920006 ^p2 4920008)
+(make line ^p1 4920008 ^p2 4920009)
+(make line ^p1 4920009 ^p2 4920010)
+(make line ^p1 4920010 ^p2 4960010)
+(make line ^p1 4960010 ^p2 4960006)
+(make line ^p1 4960006 ^p2 4970007)
+(make line ^p1 4970007 ^p2 4970008)
+(make line ^p1 4970008 ^p2 4970009)
+(make line ^p1 4970009 ^p2 4970011)
+(make line ^p1 4970011 ^p2 4960010)
+(make line ^p1 4970011 ^p2 4950011)
+(make line ^p1 4950011 ^p2 4940011)
+(make line ^p1 4940011 ^p2 4930011)
+(make line ^p1 4930011 ^p2 4920010)
+(make line ^p1 4980006 ^p2 5000006)
+(make line ^p1 5000006 ^p2 5010006)
+(make line ^p1 5010006 ^p2 5020006)
+(make line ^p1 4980006 ^p2 4980008)
+(make line ^p1 4980008 ^p2 4980009)
+(make line ^p1 4980009 ^p2 4980010)
+(make line ^p1 4980010 ^p2 5020010)
+(make line ^p1 5020010 ^p2 5020006)
+(make line ^p1 5020006 ^p2 5030007)
+(make line ^p1 5030007 ^p2 5030008)
+(make line ^p1 5030008 ^p2 5030009)
+(make line ^p1 5030009 ^p2 5030011)
+(make line ^p1 5030011 ^p2 5020010)
+(make line ^p1 5030011 ^p2 5010011)
+(make line ^p1 5010011 ^p2 5000011)
+(make line ^p1 5000011 ^p2 4990011)
+(make line ^p1 4990011 ^p2 4980010)
+(make line ^p1 4910003 ^p2 4920003)
+(make line ^p1 4890005 ^p2 4890006)
+(make line ^p1 4940005 ^p2 4940006)
+(make line ^p1 4910008 ^p2 4920008)
+(make line ^p1 5090003 ^p2 5100003)
+(make line ^p1 5070005 ^p2 5070006)
+(make line ^p1 5120005 ^p2 5120006)
+(make line ^p1 5090008 ^p2 5100008)
+(make line ^p1 5040000 ^p2 5060000)
+(make line ^p1 5060000 ^p2 5070000)
+(make line ^p1 5070000 ^p2 5080000)
+(make line ^p1 5040000 ^p2 5040002)
+(make line ^p1 5040002 ^p2 5040003)
+(make line ^p1 5040003 ^p2 5040004)
+(make line ^p1 5040004 ^p2 5080004)
+(make line ^p1 5080004 ^p2 5080000)
+(make line ^p1 5080000 ^p2 5090001)
+(make line ^p1 5090001 ^p2 5090002)
+(make line ^p1 5090002 ^p2 5090003)
+(make line ^p1 5090003 ^p2 5090005)
+(make line ^p1 5090005 ^p2 5080004)
+(make line ^p1 5090005 ^p2 5070005)
+(make line ^p1 5070005 ^p2 5060005)
+(make line ^p1 5060005 ^p2 5050005)
+(make line ^p1 5050005 ^p2 5040004)
+(make line ^p1 5100000 ^p2 5120000)
+(make line ^p1 5120000 ^p2 5130000)
+(make line ^p1 5130000 ^p2 5140000)
+(make line ^p1 5100000 ^p2 5100002)
+(make line ^p1 5100002 ^p2 5100003)
+(make line ^p1 5100003 ^p2 5100004)
+(make line ^p1 5100004 ^p2 5140004)
+(make line ^p1 5140004 ^p2 5140000)
+(make line ^p1 5140000 ^p2 5150001)
+(make line ^p1 5150001 ^p2 5150002)
+(make line ^p1 5150002 ^p2 5150003)
+(make line ^p1 5150003 ^p2 5150005)
+(make line ^p1 5150005 ^p2 5140004)
+(make line ^p1 5150005 ^p2 5130005)
+(make line ^p1 5130005 ^p2 5120005)
+(make line ^p1 5120005 ^p2 5110005)
+(make line ^p1 5110005 ^p2 5100004)
+(make line ^p1 5040006 ^p2 5060006)
+(make line ^p1 5060006 ^p2 5070006)
+(make line ^p1 5070006 ^p2 5080006)
+(make line ^p1 5040006 ^p2 5040008)
+(make line ^p1 5040008 ^p2 5040009)
+(make line ^p1 5040009 ^p2 5040010)
+(make line ^p1 5040010 ^p2 5080010)
+(make line ^p1 5080010 ^p2 5080006)
+(make line ^p1 5080006 ^p2 5090007)
+(make line ^p1 5090007 ^p2 5090008)
+(make line ^p1 5090008 ^p2 5090009)
+(make line ^p1 5090009 ^p2 5090011)
+(make line ^p1 5090011 ^p2 5080010)
+(make line ^p1 5090011 ^p2 5070011)
+(make line ^p1 5070011 ^p2 5060011)
+(make line ^p1 5060011 ^p2 5050011)
+(make line ^p1 5050011 ^p2 5040010)
+(make line ^p1 5100006 ^p2 5120006)
+(make line ^p1 5120006 ^p2 5130006)
+(make line ^p1 5130006 ^p2 5140006)
+(make line ^p1 5100006 ^p2 5100008)
+(make line ^p1 5100008 ^p2 5100009)
+(make line ^p1 5100009 ^p2 5100010)
+(make line ^p1 5100010 ^p2 5140010)
+(make line ^p1 5140010 ^p2 5140006)
+(make line ^p1 5140006 ^p2 5150007)
+(make line ^p1 5150007 ^p2 5150008)
+(make line ^p1 5150008 ^p2 5150009)
+(make line ^p1 5150009 ^p2 5150011)
+(make line ^p1 5150011 ^p2 5140010)
+(make line ^p1 5150011 ^p2 5130011)
+(make line ^p1 5130011 ^p2 5120011)
+(make line ^p1 5120011 ^p2 5110011)
+(make line ^p1 5110011 ^p2 5100010)
+(make line ^p1 5030003 ^p2 5040003)
+(make line ^p1 5010005 ^p2 5010006)
+(make line ^p1 5060005 ^p2 5060006)
+(make line ^p1 5030008 ^p2 5040008)
+(make line ^p1 5210003 ^p2 5220003)
+(make line ^p1 5190005 ^p2 5190006)
+(make line ^p1 5240005 ^p2 5240006)
+(make line ^p1 5210008 ^p2 5220008)
+(make line ^p1 5160000 ^p2 5180000)
+(make line ^p1 5180000 ^p2 5190000)
+(make line ^p1 5190000 ^p2 5200000)
+(make line ^p1 5160000 ^p2 5160002)
+(make line ^p1 5160002 ^p2 5160003)
+(make line ^p1 5160003 ^p2 5160004)
+(make line ^p1 5160004 ^p2 5200004)
+(make line ^p1 5200004 ^p2 5200000)
+(make line ^p1 5200000 ^p2 5210001)
+(make line ^p1 5210001 ^p2 5210002)
+(make line ^p1 5210002 ^p2 5210003)
+(make line ^p1 5210003 ^p2 5210005)
+(make line ^p1 5210005 ^p2 5200004)
+(make line ^p1 5210005 ^p2 5190005)
+(make line ^p1 5190005 ^p2 5180005)
+(make line ^p1 5180005 ^p2 5170005)
+(make line ^p1 5170005 ^p2 5160004)
+(make line ^p1 5220000 ^p2 5240000)
+(make line ^p1 5240000 ^p2 5250000)
+(make line ^p1 5250000 ^p2 5260000)
+(make line ^p1 5220000 ^p2 5220002)
+(make line ^p1 5220002 ^p2 5220003)
+(make line ^p1 5220003 ^p2 5220004)
+(make line ^p1 5220004 ^p2 5260004)
+(make line ^p1 5260004 ^p2 5260000)
+(make line ^p1 5260000 ^p2 5270001)
+(make line ^p1 5270001 ^p2 5270002)
+(make line ^p1 5270002 ^p2 5270003)
+(make line ^p1 5270003 ^p2 5270005)
+(make line ^p1 5270005 ^p2 5260004)
+(make line ^p1 5270005 ^p2 5250005)
+(make line ^p1 5250005 ^p2 5240005)
+(make line ^p1 5240005 ^p2 5230005)
+(make line ^p1 5230005 ^p2 5220004)
+(make line ^p1 5160006 ^p2 5180006)
+(make line ^p1 5180006 ^p2 5190006)
+(make line ^p1 5190006 ^p2 5200006)
+(make line ^p1 5160006 ^p2 5160008)
+(make line ^p1 5160008 ^p2 5160009)
+(make line ^p1 5160009 ^p2 5160010)
+(make line ^p1 5160010 ^p2 5200010)
+(make line ^p1 5200010 ^p2 5200006)
+(make line ^p1 5200006 ^p2 5210007)
+(make line ^p1 5210007 ^p2 5210008)
+(make line ^p1 5210008 ^p2 5210009)
+(make line ^p1 5210009 ^p2 5210011)
+(make line ^p1 5210011 ^p2 5200010)
+(make line ^p1 5210011 ^p2 5190011)
+(make line ^p1 5190011 ^p2 5180011)
+(make line ^p1 5180011 ^p2 5170011)
+(make line ^p1 5170011 ^p2 5160010)
+(make line ^p1 5220006 ^p2 5240006)
+(make line ^p1 5240006 ^p2 5250006)
+(make line ^p1 5250006 ^p2 5260006)
+(make line ^p1 5220006 ^p2 5220008)
+(make line ^p1 5220008 ^p2 5220009)
+(make line ^p1 5220009 ^p2 5220010)
+(make line ^p1 5220010 ^p2 5260010)
+(make line ^p1 5260010 ^p2 5260006)
+(make line ^p1 5260006 ^p2 5270007)
+(make line ^p1 5270007 ^p2 5270008)
+(make line ^p1 5270008 ^p2 5270009)
+(make line ^p1 5270009 ^p2 5270011)
+(make line ^p1 5270011 ^p2 5260010)
+(make line ^p1 5270011 ^p2 5250011)
+(make line ^p1 5250011 ^p2 5240011)
+(make line ^p1 5240011 ^p2 5230011)
+(make line ^p1 5230011 ^p2 5220010)
+(make line ^p1 5150003 ^p2 5160003)
+(make line ^p1 5130005 ^p2 5130006)
+(make line ^p1 5180005 ^p2 5180006)
+(make line ^p1 5150008 ^p2 5160008)
+(make line ^p1 5330003 ^p2 5340003)
+(make line ^p1 5310005 ^p2 5310006)
+(make line ^p1 5360005 ^p2 5360006)
+(make line ^p1 5330008 ^p2 5340008)
+(make line ^p1 5280000 ^p2 5300000)
+(make line ^p1 5300000 ^p2 5310000)
+(make line ^p1 5310000 ^p2 5320000)
+(make line ^p1 5280000 ^p2 5280002)
+(make line ^p1 5280002 ^p2 5280003)
+(make line ^p1 5280003 ^p2 5280004)
+(make line ^p1 5280004 ^p2 5320004)
+(make line ^p1 5320004 ^p2 5320000)
+(make line ^p1 5320000 ^p2 5330001)
+(make line ^p1 5330001 ^p2 5330002)
+(make line ^p1 5330002 ^p2 5330003)
+(make line ^p1 5330003 ^p2 5330005)
+(make line ^p1 5330005 ^p2 5320004)
+(make line ^p1 5330005 ^p2 5310005)
+(make line ^p1 5310005 ^p2 5300005)
+(make line ^p1 5300005 ^p2 5290005)
+(make line ^p1 5290005 ^p2 5280004)
+(make line ^p1 5340000 ^p2 5360000)
+(make line ^p1 5360000 ^p2 5370000)
+(make line ^p1 5370000 ^p2 5380000)
+(make line ^p1 5340000 ^p2 5340002)
+(make line ^p1 5340002 ^p2 5340003)
+(make line ^p1 5340003 ^p2 5340004)
+(make line ^p1 5340004 ^p2 5380004)
+(make line ^p1 5380004 ^p2 5380000)
+(make line ^p1 5380000 ^p2 5390001)
+(make line ^p1 5390001 ^p2 5390002)
+(make line ^p1 5390002 ^p2 5390003)
+(make line ^p1 5390003 ^p2 5390005)
+(make line ^p1 5390005 ^p2 5380004)
+(make line ^p1 5390005 ^p2 5370005)
+(make line ^p1 5370005 ^p2 5360005)
+(make line ^p1 5360005 ^p2 5350005)
+(make line ^p1 5350005 ^p2 5340004)
+(make line ^p1 5280006 ^p2 5300006)
+(make line ^p1 5300006 ^p2 5310006)
+(make line ^p1 5310006 ^p2 5320006)
+(make line ^p1 5280006 ^p2 5280008)
+(make line ^p1 5280008 ^p2 5280009)
+(make line ^p1 5280009 ^p2 5280010)
+(make line ^p1 5280010 ^p2 5320010)
+(make line ^p1 5320010 ^p2 5320006)
+(make line ^p1 5320006 ^p2 5330007)
+(make line ^p1 5330007 ^p2 5330008)
+(make line ^p1 5330008 ^p2 5330009)
+(make line ^p1 5330009 ^p2 5330011)
+(make line ^p1 5330011 ^p2 5320010)
+(make line ^p1 5330011 ^p2 5310011)
+(make line ^p1 5310011 ^p2 5300011)
+(make line ^p1 5300011 ^p2 5290011)
+(make line ^p1 5290011 ^p2 5280010)
+(make line ^p1 5340006 ^p2 5360006)
+(make line ^p1 5360006 ^p2 5370006)
+(make line ^p1 5370006 ^p2 5380006)
+(make line ^p1 5340006 ^p2 5340008)
+(make line ^p1 5340008 ^p2 5340009)
+(make line ^p1 5340009 ^p2 5340010)
+(make line ^p1 5340010 ^p2 5380010)
+(make line ^p1 5380010 ^p2 5380006)
+(make line ^p1 5380006 ^p2 5390007)
+(make line ^p1 5390007 ^p2 5390008)
+(make line ^p1 5390008 ^p2 5390009)
+(make line ^p1 5390009 ^p2 5390011)
+(make line ^p1 5390011 ^p2 5380010)
+(make line ^p1 5390011 ^p2 5370011)
+(make line ^p1 5370011 ^p2 5360011)
+(make line ^p1 5360011 ^p2 5350011)
+(make line ^p1 5350011 ^p2 5340010)
+(make line ^p1 5270003 ^p2 5280003)
+(make line ^p1 5250005 ^p2 5250006)
+(make line ^p1 5300005 ^p2 5300006)
+(make line ^p1 5270008 ^p2 5280008)
+(make line ^p1 5450003 ^p2 5460003)
+(make line ^p1 5430005 ^p2 5430006)
+(make line ^p1 5480005 ^p2 5480006)
+(make line ^p1 5450008 ^p2 5460008)
+(make line ^p1 5400000 ^p2 5420000)
+(make line ^p1 5420000 ^p2 5430000)
+(make line ^p1 5430000 ^p2 5440000)
+(make line ^p1 5400000 ^p2 5400002)
+(make line ^p1 5400002 ^p2 5400003)
+(make line ^p1 5400003 ^p2 5400004)
+(make line ^p1 5400004 ^p2 5440004)
+(make line ^p1 5440004 ^p2 5440000)
+(make line ^p1 5440000 ^p2 5450001)
+(make line ^p1 5450001 ^p2 5450002)
+(make line ^p1 5450002 ^p2 5450003)
+(make line ^p1 5450003 ^p2 5450005)
+(make line ^p1 5450005 ^p2 5440004)
+(make line ^p1 5450005 ^p2 5430005)
+(make line ^p1 5430005 ^p2 5420005)
+(make line ^p1 5420005 ^p2 5410005)
+(make line ^p1 5410005 ^p2 5400004)
+(make line ^p1 5460000 ^p2 5480000)
+(make line ^p1 5480000 ^p2 5490000)
+(make line ^p1 5490000 ^p2 5500000)
+(make line ^p1 5460000 ^p2 5460002)
+(make line ^p1 5460002 ^p2 5460003)
+(make line ^p1 5460003 ^p2 5460004)
+(make line ^p1 5460004 ^p2 5500004)
+(make line ^p1 5500004 ^p2 5500000)
+(make line ^p1 5500000 ^p2 5510001)
+(make line ^p1 5510001 ^p2 5510002)
+(make line ^p1 5510002 ^p2 5510003)
+(make line ^p1 5510003 ^p2 5510005)
+(make line ^p1 5510005 ^p2 5500004)
+(make line ^p1 5510005 ^p2 5490005)
+(make line ^p1 5490005 ^p2 5480005)
+(make line ^p1 5480005 ^p2 5470005)
+(make line ^p1 5470005 ^p2 5460004)
+(make line ^p1 5400006 ^p2 5420006)
+(make line ^p1 5420006 ^p2 5430006)
+(make line ^p1 5430006 ^p2 5440006)
+(make line ^p1 5400006 ^p2 5400008)
+(make line ^p1 5400008 ^p2 5400009)
+(make line ^p1 5400009 ^p2 5400010)
+(make line ^p1 5400010 ^p2 5440010)
+(make line ^p1 5440010 ^p2 5440006)
+(make line ^p1 5440006 ^p2 5450007)
+(make line ^p1 5450007 ^p2 5450008)
+(make line ^p1 5450008 ^p2 5450009)
+(make line ^p1 5450009 ^p2 5450011)
+(make line ^p1 5450011 ^p2 5440010)
+(make line ^p1 5450011 ^p2 5430011)
+(make line ^p1 5430011 ^p2 5420011)
+(make line ^p1 5420011 ^p2 5410011)
+(make line ^p1 5410011 ^p2 5400010)
+(make line ^p1 5460006 ^p2 5480006)
+(make line ^p1 5480006 ^p2 5490006)
+(make line ^p1 5490006 ^p2 5500006)
+(make line ^p1 5460006 ^p2 5460008)
+(make line ^p1 5460008 ^p2 5460009)
+(make line ^p1 5460009 ^p2 5460010)
+(make line ^p1 5460010 ^p2 5500010)
+(make line ^p1 5500010 ^p2 5500006)
+(make line ^p1 5500006 ^p2 5510007)
+(make line ^p1 5510007 ^p2 5510008)
+(make line ^p1 5510008 ^p2 5510009)
+(make line ^p1 5510009 ^p2 5510011)
+(make line ^p1 5510011 ^p2 5500010)
+(make line ^p1 5510011 ^p2 5490011)
+(make line ^p1 5490011 ^p2 5480011)
+(make line ^p1 5480011 ^p2 5470011)
+(make line ^p1 5470011 ^p2 5460010)
+(make line ^p1 5390003 ^p2 5400003)
+(make line ^p1 5370005 ^p2 5370006)
+(make line ^p1 5420005 ^p2 5420006)
+(make line ^p1 5390008 ^p2 5400008)
+(make line ^p1 5570003 ^p2 5580003)
+(make line ^p1 5550005 ^p2 5550006)
+(make line ^p1 5600005 ^p2 5600006)
+(make line ^p1 5570008 ^p2 5580008)
+(make line ^p1 5520000 ^p2 5540000)
+(make line ^p1 5540000 ^p2 5550000)
+(make line ^p1 5550000 ^p2 5560000)
+(make line ^p1 5520000 ^p2 5520002)
+(make line ^p1 5520002 ^p2 5520003)
+(make line ^p1 5520003 ^p2 5520004)
+(make line ^p1 5520004 ^p2 5560004)
+(make line ^p1 5560004 ^p2 5560000)
+(make line ^p1 5560000 ^p2 5570001)
+(make line ^p1 5570001 ^p2 5570002)
+(make line ^p1 5570002 ^p2 5570003)
+(make line ^p1 5570003 ^p2 5570005)
+(make line ^p1 5570005 ^p2 5560004)
+(make line ^p1 5570005 ^p2 5550005)
+(make line ^p1 5550005 ^p2 5540005)
+(make line ^p1 5540005 ^p2 5530005)
+(make line ^p1 5530005 ^p2 5520004)
+(make line ^p1 5580000 ^p2 5600000)
+(make line ^p1 5600000 ^p2 5610000)
+(make line ^p1 5610000 ^p2 5620000)
+(make line ^p1 5580000 ^p2 5580002)
+(make line ^p1 5580002 ^p2 5580003)
+(make line ^p1 5580003 ^p2 5580004)
+(make line ^p1 5580004 ^p2 5620004)
+(make line ^p1 5620004 ^p2 5620000)
+(make line ^p1 5620000 ^p2 5630001)
+(make line ^p1 5630001 ^p2 5630002)
+(make line ^p1 5630002 ^p2 5630003)
+(make line ^p1 5630003 ^p2 5630005)
+(make line ^p1 5630005 ^p2 5620004)
+(make line ^p1 5630005 ^p2 5610005)
+(make line ^p1 5610005 ^p2 5600005)
+(make line ^p1 5600005 ^p2 5590005)
+(make line ^p1 5590005 ^p2 5580004)
+(make line ^p1 5520006 ^p2 5540006)
+(make line ^p1 5540006 ^p2 5550006)
+(make line ^p1 5550006 ^p2 5560006)
+(make line ^p1 5520006 ^p2 5520008)
+(make line ^p1 5520008 ^p2 5520009)
+(make line ^p1 5520009 ^p2 5520010)
+(make line ^p1 5520010 ^p2 5560010)
+(make line ^p1 5560010 ^p2 5560006)
+(make line ^p1 5560006 ^p2 5570007)
+(make line ^p1 5570007 ^p2 5570008)
+(make line ^p1 5570008 ^p2 5570009)
+(make line ^p1 5570009 ^p2 5570011)
+(make line ^p1 5570011 ^p2 5560010)
+(make line ^p1 5570011 ^p2 5550011)
+(make line ^p1 5550011 ^p2 5540011)
+(make line ^p1 5540011 ^p2 5530011)
+(make line ^p1 5530011 ^p2 5520010)
+(make line ^p1 5580006 ^p2 5600006)
+(make line ^p1 5600006 ^p2 5610006)
+(make line ^p1 5610006 ^p2 5620006)
+(make line ^p1 5580006 ^p2 5580008)
+(make line ^p1 5580008 ^p2 5580009)
+(make line ^p1 5580009 ^p2 5580010)
+(make line ^p1 5580010 ^p2 5620010)
+(make line ^p1 5620010 ^p2 5620006)
+(make line ^p1 5620006 ^p2 5630007)
+(make line ^p1 5630007 ^p2 5630008)
+(make line ^p1 5630008 ^p2 5630009)
+(make line ^p1 5630009 ^p2 5630011)
+(make line ^p1 5630011 ^p2 5620010)
+(make line ^p1 5630011 ^p2 5610011)
+(make line ^p1 5610011 ^p2 5600011)
+(make line ^p1 5600011 ^p2 5590011)
+(make line ^p1 5590011 ^p2 5580010)
+(make line ^p1 5510003 ^p2 5520003)
+(make line ^p1 5490005 ^p2 5490006)
+(make line ^p1 5540005 ^p2 5540006)
+(make line ^p1 5510008 ^p2 5520008)
+(make line ^p1 5690003 ^p2 5700003)
+(make line ^p1 5670005 ^p2 5670006)
+(make line ^p1 5720005 ^p2 5720006)
+(make line ^p1 5690008 ^p2 5700008)
+(make line ^p1 5640000 ^p2 5660000)
+(make line ^p1 5660000 ^p2 5670000)
+(make line ^p1 5670000 ^p2 5680000)
+(make line ^p1 5640000 ^p2 5640002)
+(make line ^p1 5640002 ^p2 5640003)
+(make line ^p1 5640003 ^p2 5640004)
+(make line ^p1 5640004 ^p2 5680004)
+(make line ^p1 5680004 ^p2 5680000)
+(make line ^p1 5680000 ^p2 5690001)
+(make line ^p1 5690001 ^p2 5690002)
+(make line ^p1 5690002 ^p2 5690003)
+(make line ^p1 5690003 ^p2 5690005)
+(make line ^p1 5690005 ^p2 5680004)
+(make line ^p1 5690005 ^p2 5670005)
+(make line ^p1 5670005 ^p2 5660005)
+(make line ^p1 5660005 ^p2 5650005)
+(make line ^p1 5650005 ^p2 5640004)
+(make line ^p1 5700000 ^p2 5720000)
+(make line ^p1 5720000 ^p2 5730000)
+(make line ^p1 5730000 ^p2 5740000)
+(make line ^p1 5700000 ^p2 5700002)
+(make line ^p1 5700002 ^p2 5700003)
+(make line ^p1 5700003 ^p2 5700004)
+(make line ^p1 5700004 ^p2 5740004)
+(make line ^p1 5740004 ^p2 5740000)
+(make line ^p1 5740000 ^p2 5750001)
+(make line ^p1 5750001 ^p2 5750002)
+(make line ^p1 5750002 ^p2 5750003)
+(make line ^p1 5750003 ^p2 5750005)
+(make line ^p1 5750005 ^p2 5740004)
+(make line ^p1 5750005 ^p2 5730005)
+(make line ^p1 5730005 ^p2 5720005)
+(make line ^p1 5720005 ^p2 5710005)
+(make line ^p1 5710005 ^p2 5700004)
+(make line ^p1 5640006 ^p2 5660006)
+(make line ^p1 5660006 ^p2 5670006)
+(make line ^p1 5670006 ^p2 5680006)
+(make line ^p1 5640006 ^p2 5640008)
+(make line ^p1 5640008 ^p2 5640009)
+(make line ^p1 5640009 ^p2 5640010)
+(make line ^p1 5640010 ^p2 5680010)
+(make line ^p1 5680010 ^p2 5680006)
+(make line ^p1 5680006 ^p2 5690007)
+(make line ^p1 5690007 ^p2 5690008)
+(make line ^p1 5690008 ^p2 5690009)
+(make line ^p1 5690009 ^p2 5690011)
+(make line ^p1 5690011 ^p2 5680010)
+(make line ^p1 5690011 ^p2 5670011)
+(make line ^p1 5670011 ^p2 5660011)
+(make line ^p1 5660011 ^p2 5650011)
+(make line ^p1 5650011 ^p2 5640010)
+(make line ^p1 5700006 ^p2 5720006)
+(make line ^p1 5720006 ^p2 5730006)
+(make line ^p1 5730006 ^p2 5740006)
+(make line ^p1 5700006 ^p2 5700008)
+(make line ^p1 5700008 ^p2 5700009)
+(make line ^p1 5700009 ^p2 5700010)
+(make line ^p1 5700010 ^p2 5740010)
+(make line ^p1 5740010 ^p2 5740006)
+(make line ^p1 5740006 ^p2 5750007)
+(make line ^p1 5750007 ^p2 5750008)
+(make line ^p1 5750008 ^p2 5750009)
+(make line ^p1 5750009 ^p2 5750011)
+(make line ^p1 5750011 ^p2 5740010)
+(make line ^p1 5750011 ^p2 5730011)
+(make line ^p1 5730011 ^p2 5720011)
+(make line ^p1 5720011 ^p2 5710011)
+(make line ^p1 5710011 ^p2 5700010)
+(make line ^p1 5630003 ^p2 5640003)
+(make line ^p1 5610005 ^p2 5610006)
+(make line ^p1 5660005 ^p2 5660006)
+(make line ^p1 5630008 ^p2 5640008)
+(make line ^p1 5810003 ^p2 5820003)
+(make line ^p1 5790005 ^p2 5790006)
+(make line ^p1 5840005 ^p2 5840006)
+(make line ^p1 5810008 ^p2 5820008)
+(make line ^p1 5760000 ^p2 5780000)
+(make line ^p1 5780000 ^p2 5790000)
+(make line ^p1 5790000 ^p2 5800000)
+(make line ^p1 5760000 ^p2 5760002)
+(make line ^p1 5760002 ^p2 5760003)
+(make line ^p1 5760003 ^p2 5760004)
+(make line ^p1 5760004 ^p2 5800004)
+(make line ^p1 5800004 ^p2 5800000)
+(make line ^p1 5800000 ^p2 5810001)
+(make line ^p1 5810001 ^p2 5810002)
+(make line ^p1 5810002 ^p2 5810003)
+(make line ^p1 5810003 ^p2 5810005)
+(make line ^p1 5810005 ^p2 5800004)
+(make line ^p1 5810005 ^p2 5790005)
+(make line ^p1 5790005 ^p2 5780005)
+(make line ^p1 5780005 ^p2 5770005)
+(make line ^p1 5770005 ^p2 5760004)
+(make line ^p1 5820000 ^p2 5840000)
+(make line ^p1 5840000 ^p2 5850000)
+(make line ^p1 5850000 ^p2 5860000)
+(make line ^p1 5820000 ^p2 5820002)
+(make line ^p1 5820002 ^p2 5820003)
+(make line ^p1 5820003 ^p2 5820004)
+(make line ^p1 5820004 ^p2 5860004)
+(make line ^p1 5860004 ^p2 5860000)
+(make line ^p1 5860000 ^p2 5870001)
+(make line ^p1 5870001 ^p2 5870002)
+(make line ^p1 5870002 ^p2 5870003)
+(make line ^p1 5870003 ^p2 5870005)
+(make line ^p1 5870005 ^p2 5860004)
+(make line ^p1 5870005 ^p2 5850005)
+(make line ^p1 5850005 ^p2 5840005)
+(make line ^p1 5840005 ^p2 5830005)
+(make line ^p1 5830005 ^p2 5820004)
+(make line ^p1 5760006 ^p2 5780006)
+(make line ^p1 5780006 ^p2 5790006)
+(make line ^p1 5790006 ^p2 5800006)
+(make line ^p1 5760006 ^p2 5760008)
+(make line ^p1 5760008 ^p2 5760009)
+(make line ^p1 5760009 ^p2 5760010)
+(make line ^p1 5760010 ^p2 5800010)
+(make line ^p1 5800010 ^p2 5800006)
+(make line ^p1 5800006 ^p2 5810007)
+(make line ^p1 5810007 ^p2 5810008)
+(make line ^p1 5810008 ^p2 5810009)
+(make line ^p1 5810009 ^p2 5810011)
+(make line ^p1 5810011 ^p2 5800010)
+(make line ^p1 5810011 ^p2 5790011)
+(make line ^p1 5790011 ^p2 5780011)
+(make line ^p1 5780011 ^p2 5770011)
+(make line ^p1 5770011 ^p2 5760010)
+(make line ^p1 5820006 ^p2 5840006)
+(make line ^p1 5840006 ^p2 5850006)
+(make line ^p1 5850006 ^p2 5860006)
+(make line ^p1 5820006 ^p2 5820008)
+(make line ^p1 5820008 ^p2 5820009)
+(make line ^p1 5820009 ^p2 5820010)
+(make line ^p1 5820010 ^p2 5860010)
+(make line ^p1 5860010 ^p2 5860006)
+(make line ^p1 5860006 ^p2 5870007)
+(make line ^p1 5870007 ^p2 5870008)
+(make line ^p1 5870008 ^p2 5870009)
+(make line ^p1 5870009 ^p2 5870011)
+(make line ^p1 5870011 ^p2 5860010)
+(make line ^p1 5870011 ^p2 5850011)
+(make line ^p1 5850011 ^p2 5840011)
+(make line ^p1 5840011 ^p2 5830011)
+(make line ^p1 5830011 ^p2 5820010)
+(make line ^p1 5750003 ^p2 5760003)
+(make line ^p1 5730005 ^p2 5730006)
+(make line ^p1 5780005 ^p2 5780006)
+(make line ^p1 5750008 ^p2 5760008)
+(make line ^p1 5930003 ^p2 5940003)
+(make line ^p1 5910005 ^p2 5910006)
+(make line ^p1 5960005 ^p2 5960006)
+(make line ^p1 5930008 ^p2 5940008)
+(make line ^p1 5880000 ^p2 5900000)
+(make line ^p1 5900000 ^p2 5910000)
+(make line ^p1 5910000 ^p2 5920000)
+(make line ^p1 5880000 ^p2 5880002)
+(make line ^p1 5880002 ^p2 5880003)
+(make line ^p1 5880003 ^p2 5880004)
+(make line ^p1 5880004 ^p2 5920004)
+(make line ^p1 5920004 ^p2 5920000)
+(make line ^p1 5920000 ^p2 5930001)
+(make line ^p1 5930001 ^p2 5930002)
+(make line ^p1 5930002 ^p2 5930003)
+(make line ^p1 5930003 ^p2 5930005)
+(make line ^p1 5930005 ^p2 5920004)
+(make line ^p1 5930005 ^p2 5910005)
+(make line ^p1 5910005 ^p2 5900005)
+(make line ^p1 5900005 ^p2 5890005)
+(make line ^p1 5890005 ^p2 5880004)
+(make line ^p1 5940000 ^p2 5960000)
+(make line ^p1 5960000 ^p2 5970000)
+(make line ^p1 5970000 ^p2 5980000)
+(make line ^p1 5940000 ^p2 5940002)
+(make line ^p1 5940002 ^p2 5940003)
+(make line ^p1 5940003 ^p2 5940004)
+(make line ^p1 5940004 ^p2 5980004)
+(make line ^p1 5980004 ^p2 5980000)
+(make line ^p1 5980000 ^p2 5990001)
+(make line ^p1 5990001 ^p2 5990002)
+(make line ^p1 5990002 ^p2 5990003)
+(make line ^p1 5990003 ^p2 5990005)
+(make line ^p1 5990005 ^p2 5980004)
+(make line ^p1 5990005 ^p2 5970005)
+(make line ^p1 5970005 ^p2 5960005)
+(make line ^p1 5960005 ^p2 5950005)
+(make line ^p1 5950005 ^p2 5940004)
+(make line ^p1 5880006 ^p2 5900006)
+(make line ^p1 5900006 ^p2 5910006)
+(make line ^p1 5910006 ^p2 5920006)
+(make line ^p1 5880006 ^p2 5880008)
+(make line ^p1 5880008 ^p2 5880009)
+(make line ^p1 5880009 ^p2 5880010)
+(make line ^p1 5880010 ^p2 5920010)
+(make line ^p1 5920010 ^p2 5920006)
+(make line ^p1 5920006 ^p2 5930007)
+(make line ^p1 5930007 ^p2 5930008)
+(make line ^p1 5930008 ^p2 5930009)
+(make line ^p1 5930009 ^p2 5930011)
+(make line ^p1 5930011 ^p2 5920010)
+(make line ^p1 5930011 ^p2 5910011)
+(make line ^p1 5910011 ^p2 5900011)
+(make line ^p1 5900011 ^p2 5890011)
+(make line ^p1 5890011 ^p2 5880010)
+(make line ^p1 5940006 ^p2 5960006)
+(make line ^p1 5960006 ^p2 5970006)
+(make line ^p1 5970006 ^p2 5980006)
+(make line ^p1 5940006 ^p2 5940008)
+(make line ^p1 5940008 ^p2 5940009)
+(make line ^p1 5940009 ^p2 5940010)
+(make line ^p1 5940010 ^p2 5980010)
+(make line ^p1 5980010 ^p2 5980006)
+(make line ^p1 5980006 ^p2 5990007)
+(make line ^p1 5990007 ^p2 5990008)
+(make line ^p1 5990008 ^p2 5990009)
+(make line ^p1 5990009 ^p2 5990011)
+(make line ^p1 5990011 ^p2 5980010)
+(make line ^p1 5990011 ^p2 5970011)
+(make line ^p1 5970011 ^p2 5960011)
+(make line ^p1 5960011 ^p2 5950011)
+(make line ^p1 5950011 ^p2 5940010)
+(make line ^p1 5870003 ^p2 5880003)
+(make line ^p1 5850005 ^p2 5850006)
+(make line ^p1 5900005 ^p2 5900006)
+(make line ^p1 5870008 ^p2 5880008)
+(make line ^p1 6050003 ^p2 6060003)
+(make line ^p1 6030005 ^p2 6030006)
+(make line ^p1 6080005 ^p2 6080006)
+(make line ^p1 6050008 ^p2 6060008)
+(make line ^p1 6000000 ^p2 6020000)
+(make line ^p1 6020000 ^p2 6030000)
+(make line ^p1 6030000 ^p2 6040000)
+(make line ^p1 6000000 ^p2 6000002)
+(make line ^p1 6000002 ^p2 6000003)
+(make line ^p1 6000003 ^p2 6000004)
+(make line ^p1 6000004 ^p2 6040004)
+(make line ^p1 6040004 ^p2 6040000)
+(make line ^p1 6040000 ^p2 6050001)
+(make line ^p1 6050001 ^p2 6050002)
+(make line ^p1 6050002 ^p2 6050003)
+(make line ^p1 6050003 ^p2 6050005)
+(make line ^p1 6050005 ^p2 6040004)
+(make line ^p1 6050005 ^p2 6030005)
+(make line ^p1 6030005 ^p2 6020005)
+(make line ^p1 6020005 ^p2 6010005)
+(make line ^p1 6010005 ^p2 6000004)
+(make line ^p1 6060000 ^p2 6080000)
+(make line ^p1 6080000 ^p2 6090000)
+(make line ^p1 6090000 ^p2 6100000)
+(make line ^p1 6060000 ^p2 6060002)
+(make line ^p1 6060002 ^p2 6060003)
+(make line ^p1 6060003 ^p2 6060004)
+(make line ^p1 6060004 ^p2 6100004)
+(make line ^p1 6100004 ^p2 6100000)
+(make line ^p1 6100000 ^p2 6110001)
+(make line ^p1 6110001 ^p2 6110002)
+(make line ^p1 6110002 ^p2 6110003)
+(make line ^p1 6110003 ^p2 6110005)
+(make line ^p1 6110005 ^p2 6100004)
+(make line ^p1 6110005 ^p2 6090005)
+(make line ^p1 6090005 ^p2 6080005)
+(make line ^p1 6080005 ^p2 6070005)
+(make line ^p1 6070005 ^p2 6060004)
+(make line ^p1 6000006 ^p2 6020006)
+(make line ^p1 6020006 ^p2 6030006)
+(make line ^p1 6030006 ^p2 6040006)
+(make line ^p1 6000006 ^p2 6000008)
+(make line ^p1 6000008 ^p2 6000009)
+(make line ^p1 6000009 ^p2 6000010)
+(make line ^p1 6000010 ^p2 6040010)
+(make line ^p1 6040010 ^p2 6040006)
+(make line ^p1 6040006 ^p2 6050007)
+(make line ^p1 6050007 ^p2 6050008)
+(make line ^p1 6050008 ^p2 6050009)
+(make line ^p1 6050009 ^p2 6050011)
+(make line ^p1 6050011 ^p2 6040010)
+(make line ^p1 6050011 ^p2 6030011)
+(make line ^p1 6030011 ^p2 6020011)
+(make line ^p1 6020011 ^p2 6010011)
+(make line ^p1 6010011 ^p2 6000010)
+(make line ^p1 6060006 ^p2 6080006)
+(make line ^p1 6080006 ^p2 6090006)
+(make line ^p1 6090006 ^p2 6100006)
+(make line ^p1 6060006 ^p2 6060008)
+(make line ^p1 6060008 ^p2 6060009)
+(make line ^p1 6060009 ^p2 6060010)
+(make line ^p1 6060010 ^p2 6100010)
+(make line ^p1 6100010 ^p2 6100006)
+(make line ^p1 6100006 ^p2 6110007)
+(make line ^p1 6110007 ^p2 6110008)
+(make line ^p1 6110008 ^p2 6110009)
+(make line ^p1 6110009 ^p2 6110011)
+(make line ^p1 6110011 ^p2 6100010)
+(make line ^p1 6110011 ^p2 6090011)
+(make line ^p1 6090011 ^p2 6080011)
+(make line ^p1 6080011 ^p2 6070011)
+(make line ^p1 6070011 ^p2 6060010)
+(make line ^p1 5990003 ^p2 6000003)
+(make line ^p1 5970005 ^p2 5970006)
+(make line ^p1 6020005 ^p2 6020006)
+(make line ^p1 5990008 ^p2 6000008)
+(make stage ^value duplicate)

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule "AccumulateParserTest"
+when
+     Integer() from accumulate( Person( age > 21 ),
+                                init( int x = 0; ),
+                                action( x++; ),
+                                result( new Integer(x) ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateExternalFunction.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateExternalFunction.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateExternalFunction.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+rule "AccumulateReverseParserTest"
+when
+     Number() from accumulate( Person( $age : age > 21 ),
+                               average( $age ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateReverse.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateReverse.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulateReverse.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+rule "AccumulateReverseParserTest"
+when
+     Integer() from accumulate( Person( age > 21 ),
+                                init( int x = 0; ),
+                                action( x++; ),
+                                reverse( x--; ),
+                                result( new Integer(x) ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_multi_pattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_multi_pattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_multi_pattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule "AccumulateMultiPatternParserTest"
+when
+     $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
+                                         init( int x = 0; ),
+                                         action( x++; ),
+                                         result( new Integer(x) ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_bindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_bindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_bindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule "AccumulateParserTest"
+when
+     $counter:Integer() from accumulate( $person : Person( age > 21 ),
+                                         init( int x = 0; ),
+                                         action( x++; ),
+                                         result( new Integer(x) ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_nested_from.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_nested_from.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/accumulate_with_nested_from.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule "AccumulateParserTest"
+when
+     #bellow statement makes no sense, but is useful to test parsing recursiveness
+     $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
+                                                max( $age ) );
+then
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/almost_empty_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/almost_empty_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/almost_empty_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+
+rule almost_empty 
+  when
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/and_or_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/and_or_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/and_or_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+import org.drools.Person
+
+rule simple_rule 
+  when
+    Person(name == "mark") && Cheese(type == "stilton")
+    Person(name == "mark") || Cheese(type == "stilton")
+  then
+	System.out.println( "Mark and Michael" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/application-data.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/application-data.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/application-data.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+# showing application data
+
+import java.lang.String
+import java.util.Random
+
+#setup application data here (optional semi colons, as always).
+application-data MyObject me;
+application-data YourObject you
+
+#app data should come after imports, before functions
+
+
+
+
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/autofocus.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/autofocus.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/autofocus.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+rule rule1 
+  auto-focus true
+  when
+  	not Cheese(type == "stilton")
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/basic_binding.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/basic_binding.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/basic_binding.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "like cheddar"
+    when
+        Cheese( $type:type )
+    then
+        System.out.println("I like " + $type);
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/bindings.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/bindings.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/bindings.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+rule "Who likes Stilton"
+    when
+        Cheese($type : type == "stilton")
+        $person : Person($name : name == "bob", likes == $type)        
+    then
+        System.out.println( $name + " likes " + $type);
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/brackets_precedence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/brackets_precedence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/brackets_precedence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+
+rule simple_rule 
+  when
+	 ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
+  then
+	go wild
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese-rules.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese-rules.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese-rules.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+# Example DRL with expansion 
+# (ie "domain specific language")
+
+# declare expanders for domain specific and natural language extensions
+use expander cheese.dsl.properties
+#this one is just a simple properties file
+
+
+rule cheese_rules
+    when
+        Bob is in atlanta
+        Bob likes cheese
+	    #There exists a Guest with name of "Michael" and sex of "Male"
+        >Guest( name == seatingRightGuestName, rightGuestSex:sex, rightGuestHobby:hobby )
+        >Guest( leftGuestName:name , sex != rightGuestSex, hobby == rightGuestHobby )
+
+        #count => Count() can be replaced by
+        bind count to Count
+    then
+        Send notification to Mark with message "hello"
+        >System.out.println("and this is code")
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese.dsl.properties
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese.dsl.properties	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/cheese.dsl.properties	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+#this is an little dsl
+
+Bob\ is\ in\ {0}=Bob(location={0})
+{Person}\ likes\ cheese={Person}(cheeseFan==true)
+bind\ {var}\ to\ {object}={var} => {object}()
+Send\ notification\ to\ {Person}\ with\ message\ {message}=EmailUtil.sendEmail("{Person}", {message})
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+rule "CollectParserTest"
+when
+     $personList : ArrayList() from collect( Person( age > 21 ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect_with_nested_from.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect_with_nested_from.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/collect_with_nested_from.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+rule "CollectParserTest"
+when
+     #bellow statement makes no sense, but is useful to test parsing recursiveness
+     $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );
+then
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comma_misuse.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comma_misuse.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comma_misuse.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools;
+
+rule "Avoid NPE on wrong syntax"
+when
+    not( Cheese( ( type == "stilton", price == 10 ) || ( type == "brie", price == 15 ) ) from $cheeseList )
+then
+    System.out.println("OK");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comment.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comment.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/comment.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+#this starts with a comment
+package foo.bar
+
+//and another comment
+
+/*
+yet
+	   another
+   				style
+*/
+
+rule "test"
+  when
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/complex.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/complex.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/complex.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,5 @@
+#place your comments here - this is just a description for your own purposes.
+[when]There is a Person with name of {name}=Person(name=="{name}")
+[when]Person is at least {age} years old and lives in {location}=Person(age > {age}, location == "{location}")
+[then]Log "{message}"=System.out.println("{message}");
+[when]Or=or

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declaration-in-consequence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declaration-in-consequence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declaration-in-consequence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+
+
+rule myrule 
+  when
+  then
+  	int i = 0;
+	i = 1;
+	i / 1;
+	i == 1;
+	i(i);
+	i = 'i';
+	i.i.i;
+	i\i;
+	i<i;
+	i>i;
+	i="i";	
+	++i;
+	i++;
+	--i;
+	i--;
+	i += i;
+	i -= i;
+	i *= i;
+	i /= i;
+	int i = 5;
+	for(int j; j<i; ++j) {
+	  System.out.println(j);
+	}	
+	Object o = new String("Hello");
+	String s = (String) o;	
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declare_type.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declare_type.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/declare_type.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools;
+
+declare CallEvent {
+    type event,
+    class org.drools.events.Call,
+    duration_attribute duration,
+    clock_strategy pseudo
+}
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/template/test.dsl.properties
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/template/test.dsl.properties	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/template/test.dsl.properties	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+This is something=Another thing
+[when]This is something for a condition=yeah
+
+#and this is a comment
+##this is also a comment
+
+[then]This is for consequence=blah
+[then] this is also=woot
+
+##and following shows how to span a line
+ This\ has\ spaces=yup\
+ yep
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,4 @@
+#for a test
+[when]Person has name of {name}=Person(name=="{name}")
+[then]Go wild=wild();
+nothing=something
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_expansion.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_expansion.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_expansion.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,36 @@
+# Example DRL with expansion 
+# (ie "domain specific language")
+
+# declare expanders for domain specific and natural language extensions
+expander test_metainfo.dsl
+
+consulta "a query" 
+   # a comment in the middle of the query
+   the Customer
+   - first name is "bob"
+   - last name is not "dylan"
+fim
+
+regra "average \"bob\"" salience -10
+ faça
+   # a comment in the consequence
+   Log "just an average bob"
+   Show last name
+   >System.out.println("and this is code")
+ se
+   # a comment in the middle of a rule
+   the Customer
+   # a comment before an attribute
+   - first name is "bob"
+   - last name is not "dylan"
+fim
+
+regra "a second rule" agenda-group test
+ faça
+>  System.out.println("bla")
+ se
+   the Product
+   - store is "Wall Mart"
+   - shop category is "grocery"
+fim
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_metainfo.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_metainfo.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/dsl/test_metainfo.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,32 @@
+#This is a sample DSL for a ficticous E-Commerce website that is building a recommendation engine
+[keyword][*]regra {atributos} faça {rhs} se {lhs} fim=rule {atributos} \\n when\\n    {lhs}\\n then\\n    {rhs}\\n end
+[keyword][*]consulta=query
+[keyword]fim=end
+[when][woolfel.ecommerce.model.Customer]the Customer=cust : Customer()
+[when][woolfel.ecommerce.model.Customer]- has an email=emailAddress != null
+[when][woolfel.ecommerce.model.Customer]- first name is "{first}"=first == "{first}"
+[when][woolfel.ecommerce.model.Customer]- last name is "{surname}"=sname: surname == "{surname}"
+[when][woolfel.ecommerce.model.CustomerProfile]a User profile=userprof : CustomerProfile(prfid : profileId)
+[when][woolfel.ecommerce.model.Response]the Response=resp : Response()
+[when][woolfel.ecommerce.model.Response]- is empty=userId == usrid, recommendation == null
+[when][woolfel.ecommerce.model.Response]- is not empty=userId == usrid, recommendation != null
+[when][woolfel.ecommerce.model.Response]- matches the user=userId == userid
+[when][woolfel.ecommerce.model.Aggregate]an aggregate=aggr : Aggregate()
+[when][woolfel.ecommerce.model.Recommendation]the recommendation where=recm : Recommendation()
+[when][woolfel.ecommerce.model.Recommendation]- the profile is found=profileId == prfid
+[when][woolfel.ecommerce.model.Product]the Product=prod : Product()
+[when][woolfel.ecommerce.model.Product]- store is "{store}"=storeCategory == "{store}"
+[when][woolfel.ecommerce.model.Product]- shop category is "{shopcat}"=shopCategory == "{shopcat}"
+[when][woolfel.ecommerce.model.Product]- category is "{prodcat}"=productCategory == "{prodcat}"
+[when][woolfel.ecommerce.model.Product]- subcategory is "{subcat}"=subProductCategory == "{subcat}"
+[when][woolfel.ecommerce.model.Product]- manufacturer is "{manufac}"=manufacturer == "{manufac}"
+[when][woolfel.ecommerce.model.Product]- SKU is equal to "{sku}"=SKU == "{sku}"
+[when][woolfel.ecommerce.model.Order]the Order where=ordr : Order()
+[when][woolfel.ecommerce.model.Order]- shipping method is "{shipmethod}"=shippingMethod == "{shipmethod}"
+[when][woolfel.ecommerce.model.Order]- has more than {items}=cartItems > {items}
+[when][woolfel.ecommerce.model.Order]- has coupons=coupons != null
+[then][woolfel.ecommerce.model.Recommendation]return the recommendation=resp.setRecommendation(recm);
+[then]Log "{msg}"=System.out.println("{msg}");
+[when]but not=not
+[when][woolfel.ecommerce.model.Customer]- last name is not "{surname}"=surname != "{surname}"
+[then][*]Show last name=System.out.println(cust.getSurname());

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/empty_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/empty_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/empty_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+
+rule empty 
+
+then
+  
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/enumeration.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/enumeration.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/enumeration.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+
+rule simple_rule 
+  when
+  	Foo(bar == Foo.BAR)
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eol_funny_business.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eol_funny_business.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eol_funny_business.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,20 @@
+package test.dialect.rule.when.end.package.mine;
+
+global java.lang.String rule;
+
+import com.dialect.something.SomeClass
+
+function boolean test() {
+    return true;
+}
+
+rule type1
+  when
+	$id : Something( duration == "foo")
+  then
+  	The.method();
+  	attributes;
+  	rule;
+  	package;
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/escaped-string.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/escaped-string.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/escaped-string.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+rule "test_Quotes"
+   when
+      InitialFact()
+   then
+      String s = "\"\n\t\\";
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_multiple.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_multiple.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_multiple.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+
+rule simple_rule 
+  when
+	eval(abc("foo") + 5)
+	Foo()
+	eval(qed())
+	Bar()
+  then
+	Kapow
+	Poof
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_parsing.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_parsing.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_parsing.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools
+
+rule "Test Parse"
+
+when
+    eval( 3==3 )
+then
+    System.out.println("OK");
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_newline.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_newline.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_newline.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+
+rule simple_rule 
+  when
+	Foo()
+	Bar()
+	eval(
+	
+	
+	
+	       abc(
+	       
+	       "foo") + 
+	       5
+	       
+	       
+	       
+	        
+	       )
+  then
+	Kapow
+	Poof
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_semicolon.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_semicolon.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/eval_with_semicolon.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+rule simple_rule 
+  when
+	eval(abc();)
+  then
+	Kapow
+	Poof
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/exist_instead_of_exists_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/exist_instead_of_exists_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/exist_instead_of_exists_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "exists rule test"
+    when       
+        exist Cheese( price == 5 )
+    then
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_line_errors.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_line_errors.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_line_errors.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+#this will show error line numbers due to failure to expand
+package expanderFoo
+
+expander foo.dsl
+
+rule nonsense 
+  when
+	blah blah
+	Good()
+	wee wee
+  then
+  	yabba yabba
+  	goo goo
+  	Good()
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+#created on: 13/04/2006
+package mydsl
+
+
+expander multiple_constraints.dsl
+
+
+rule "Your First Rule"
+	
+	when
+		There is a Person with 
+			-   age less than 42
+			-location is 'atlanta'
+		Bar bar black sheep
+	then 
+		Log "hola bob"		
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints_flush.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints_flush.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_multiple_constraints_flush.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+#created on: 13/04/2006
+package mydsl
+
+
+expander multiple_constraints.dsl
+
+
+rule "Your First Rule"
+	
+	when
+		There is a Person with 
+			-age less than 42
+			-location is 'atlanta'
+	then 
+		Log "hola bob"		
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_post_errors.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_post_errors.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_post_errors.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+#this will show error line numbers post expansion
+expander foo.dsl
+
+rule simple_rule 
+  when
+	Foo().
+	Bar()
+	bax() from wee()
+	k x
+  then
+  	baz
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_spread_lines.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_spread_lines.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/expander_spread_lines.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,19 @@
+#created on: 13/04/2006
+package mydsl
+
+
+expander complex.dsl
+
+
+rule "Your First Rule"
+	
+	when
+		Person is at least 42 years old and lives in atlanta 
+		
+			Or 
+			
+		There is a Person with name of bob
+	then 
+		Log "hola bob"		
+		
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/extra_lhs_newline.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/extra_lhs_newline.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/extra_lhs_newline.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule "another test"
+    when
+        s : String()
+        eval(s.equals("foo") && s.startsWith("f"))
+        
+        
+    then
+        list.add( s );
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/forall.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/forall.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/forall.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+rule "ForallParserTest"
+when
+     forall( Person( age > 21, $likes : likes )
+             Cheese( type == $likes ) );
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/from.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/from.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/from.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+rule using_from
+  when
+    Foo() from bar.baz
+    Foo() from bar.baz["key"]    
+    Foo() from bar.baz[$key]    
+    Foo() from bar.baz[1]        
+    Whee(bar=="baz") from whee("y")
+    f: Foo(la==2) from bar.la(x)   
+    Bam() from wa()
+    Kah() from la.wa(42, 42.42, false, null)
+    Bam(a=="c") 
+  then
+  	whee();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/function_arrays.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/function_arrays.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/function_arrays.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package foo
+
+function String[] yourFunction(String args[]) {
+     baz();
+}
+
+rule "new rule"
+
+	when
+		Something()
+	then
+		yourFunction(new String[3] {"a","b","c"});
+		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/functions.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/functions.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/functions.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+
+import java.lang.String
+
+function String functionA(String s, Integer i) {
+	
+	foo();
+
+}
+
+function void functionB() {
+	bar();	
+}
+
+
+rule something 
+	when
+	then
+end
+
+rule "one more thing"
+	when
+	then
+end
+
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/globals.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/globals.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/globals.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.lang.String foo
+global java.lang.Integer bar;
+
+rule baz
+    when
+        Cheese( )
+    then
+
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/import_event.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/import_event.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/import_event.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools;
+
+import event org.drools.StockTick;
+
+rule "Check event"
+when
+    StockTick( company == "ACME" )
+then
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/in_operator_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/in_operator_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/in_operator_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+#testing 'in' operator
+
+rule simple_rule 
+  when
+  	Person(age > 30 && < 40)
+  	Vehicle(type in ( "sedan", "wagon" ), age < 3)
+  then
+	consequence();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/invalid_syntax.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/invalid_syntax.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/invalid_syntax.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1 @@
+cheddar banana import rule foo when then end.

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin-sample.dslr
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin-sample.dslr	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin-sample.dslr	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package br.com.auster.drools.sample;
+
+import br.com.auster.drools.sample.SampleObject;
+
+expander latin.dsl;  // so I had to change the filename to this
+
+rule "Latin Sample"
+	when
+		Objeto éé igual a 1
+	then
+		Mostre Objeto
+end
+  
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/latin.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,3 @@
+#place your comments here - this is just a description for your own purposes.
+[then]Mostre {$object}=System.out.println({$object});
+[when]{$object} éé igual a {$value}={$object}: SampleObject(value == {$value});

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/lhs_semicolon_delim.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/lhs_semicolon_delim.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/lhs_semicolon_delim.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+
+rule simple_rule 
+  when
+    foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/literal_bool_and_negative.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/literal_bool_and_negative.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/literal_bool_and_negative.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+#check that it can handle true/false literals, and 
+#negative numbers
+rule simple_rule 
+  when
+	Foo(bar == false)
+	Foo(boo > -42)
+	Foo(boo > -42.42)
+  then
+	cons();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/misplaced_parenthesis.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/misplaced_parenthesis.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/misplaced_parenthesis.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools;
+
+rule "test rule"
+	salience 10
+	when
+		$c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))
+	then
+		retract($p);
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_constraints.dsl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_constraints.dsl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_constraints.dsl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+#place your comments here - this is just a description for your own purposes.
+[when]There is a Person with=Person()
+[when]- age less than {age}=age < {age}
+[when]- location is '{city}'=location=={city}
+[when]Bar bar black sheep=Bar()
+[then]Log "{message}"=System.out.println("{message}");

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_errors.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_errors.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_errors.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+rule one
+  when
+    exists Foo()
+    exits Bar()
+  then
+end
+
+rule two 
+  when
+    ford = ford = ford
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_rules.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_rules.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/multiple_rules.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package org.drools.test;
+
+import org.drools.integrationtests.Cheese;
+
+rule "Like Stilton"
+    when
+        Cheese( t:type == "stilton" )
+    then
+        System.out.println("I like " + t);
+end    
+
+rule "Like Cheddar"
+    when
+        Cheese( t:type == "cheddar" )
+    then
+        System.out.println("I like " + t );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/nested_conditional_elements.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/nested_conditional_elements.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/nested_conditional_elements.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+rule "test nested CEs"	
+	when
+	    not ( State( $state : state ) and
+	          not( Person( status == $state, $likes : likes ) and
+	               Cheese( type == $likes ) ) )
+	    Person( name == "Bob" )
+	    ( Cheese( price == 10 ) or Cheese( type == "brie" ) )
+	then 
+		results.add("OK");		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/no-loop.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/no-loop.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/no-loop.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+rule rule1 
+  no-loop false
+  when
+  	not Cheese(type == "stilton")
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_exist_with_brackets.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_exist_with_brackets.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_exist_with_brackets.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package HR1
+
+rule simple_rule 
+  when  		  	
+  	not ( Cheese(type == "stilton") )
+  	exists ( Foo() )
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_binding_error.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_binding_error.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_binding_error.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package HR2
+
+rule simple_rule 
+  when  		  	
+  	a : (not ( Cheese(type == "stilton") ))
+  	exists ( Foo() )
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_constraint.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_constraint.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/not_with_constraint.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.lang.Integer five;
+
+rule "not rule test"
+    when
+        $person : Person( $likes:like )
+        not Cheese( type == $likes )
+    then
+		list.add( $person );
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/notin_operator_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/notin_operator_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/notin_operator_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+#testing not 'in' operator
+
+rule simple_rule 
+  when
+  	Person(age > 30 && < 40)
+  	Vehicle(type not in ( "sedan", "wagon" ), age < 3)
+  then
+	consequence();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/npe_on_parser.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/npe_on_parser.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/npe_on_parser.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+rule "Test"
+when
+    action : Object()
+then
+    System.out.println("A RHS");
+end
+
+rule
+when
+    Object()
+then
+    System.out.println("A RHS");
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/one-rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/one-rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/one-rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,43 @@
+# Example DRL with only a package decl
+#
+
+// yes, you can use silly java comments
+
+package org.drools.lang; 
+
+# semi colons are optional, we're line-centric
+
+import java.util.List
+import java.util.ArrayList;
+
+# use expanders for domain specific and pseudo natural language extensions
+# use expander foo;
+
+
+rule find seating
+
+	salience 30
+	no-loop true
+
+    when
+	    context => Context( state == Context.ASSIGN_SEATS ) 
+	    Seating( seatingId:id, seatingPid:pid, pathDone == true, seatingRightSeat:rightSeat, seatingRightGuestName:rightGuestName )
+	    
+        Guest( name == seatingRightGuestName, rightGuestSex:sex, rightGuestHobby:hobby )
+        Guest( leftGuestName:name , sex != rightGuestSex, hobby == rightGuestHobby )
+        count => Count()
+        #not ( Path( id == seatingId, guestName == leftGuestName) )
+        #not ( Chosen( id == seatingId, guestName == leftGuestName, hobby == rightGuestHobby) )
+    then
+        make a ruckus, damnit
+        Really, you should
+        #following should be expanded using the consequence expander...
+        modify ( anObject );
+end
+
+
+
+
+
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+import org.drools.Person
+
+rule simple_rule 
+  when
+	foo :  ( Person(name == "mark") or Person(type == "fan") ) 
+	Cheese(type == "green")
+  then
+	System.out.println( "Mark and Michael" + bar );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_complex.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_complex.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_complex.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+
+rule simple_rule 
+  when
+	foo : ( Person(name == "mark") 
+		or 
+		Person(type == "fan") )
+  then
+	System.out.println( "Mark and Michael" + bar );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_with_brackets.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_with_brackets.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_binding_with_brackets.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule simple_rule 
+  when
+	foo : ( 
+		Person(name == "mark") or Person(type == "fan") 
+		)
+  then
+	System.out.println( "Mark and Michael" + bar );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_ce.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_ce.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_ce.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools;
+
+rule "testing OR CE"
+when
+    $p : Person( name == "bob" )
+    $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
+then
+    // do something
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_nesting.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_nesting.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/or_nesting.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+import org.drools.Person
+
+rule simple_rule 
+  when
+	Person(name == "mark") or 
+	( Person(type == "fan") and Cheese(type == "green") )
+  then
+	System.out.println( "Mark and Michael" + bar );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package-imports.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package-imports.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package-imports.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+# Example DRL with only a package decl
+#
+
+package org.drools.lang;
+
+import java.util.List;
+import java.util.ArrayList;
+
+
+
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+# Example DRL with only a package decl
+#
+
+package org.drools.lang;
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_attributes.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_attributes.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_attributes.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package com.foo;
+
+agenda-group "x"
+
+import goo.ber
+import wee.waa
+
+
+dialect "java"
+
+
+
+
+rule bar
+  when
+  then
+end
+
+rule baz
+  dialect "mvel"
+  when
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_garbage.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_garbage.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/package_garbage.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package nesting;
+
+dialect "mvel"
+
+import org.drools.Person
+import org.drools.Address
+
+fdsfdsfds
+
+
+rule "test something"
+	
+	when
+		p: Person( name=="Michael", 
+								(addresses[1].street == "Low" && 
+								addresses[0].street == "High"  )
+								)
+	then
+		p.name = "goober"
+		System.out.println(p.name)		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pattern_partial.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pattern_partial.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pattern_partial.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+#the purpose of this is to see what happens when we have some partially damaged syntax
+#as the IDE uses the parsers AST to work out completion suggestions.
+package test
+
+
+rule simple_rule 
+  when
+    foo3 : Bar(
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pluggable_operators.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pluggable_operators.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/pluggable_operators.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+package org.drools;
+
+rule "test pluggable operators"
+when
+    $a : EventA()
+    $b : EventB( this ~after[1,10] $a )
+    $c : EventC( this ~finishes $b )
+    $d : EventD( this not ~starts $a )
+    $e : EventE( this not ~before [1, 10] $b )
+then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/qualified_classname.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/qualified_classname.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/qualified_classname.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+package org.drools.test;
+
+rule "Who likes Stilton"
+    when
+        com.cheeseco.Cheese($type : type == "stilton")
+    then
+        System.out.println( $name + " likes " + $type);
+end    
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/query_and_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/query_and_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/query_and_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+
+package foo
+
+rule bar
+	when
+		Baz()
+	then
+		Boo()
+end
+
+query "simple_query" 
+    foo3 : Bar(a==3)
+    foo4 : Bar(a4:a==4)
+    Baz()
+	
+end
+
+rule bar2
+	when
+		Baz()
+	then
+		Boo()
+end
+
+query "simple_query2" 
+    foo3 : Bar(a==3)
+    foo4 : Bar(a4:a==4)
+    Baz()
+	
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/quoted_string_name_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/quoted_string_name_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/quoted_string_name_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,4 @@
+rule "quoted string name"
+  when
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/restrictions_test.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/restrictions_test.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/restrictions_test.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+#this is for showing off all the new multi restriction stuff
+
+
+
+
+rule simple_rule 
+  when
+  	Person(age > 30 && < 40)
+  	Vehicle(type == "sedan" || == "wagon", age < 3)
+  then
+	consequence();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,16 @@
+
+
+
+rule simple_rule 
+		#attributes keywork (and colon) is totally optional
+		salience 42
+		agenda-group "my_group"
+		no-loop 
+		duration 42
+		activation-group "my_activation_group"
+		lock-on-active true
+	when
+		Foo()
+	then
+		bar();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes_alt.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes_alt.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_attributes_alt.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+
+
+
+rule simple_rule 
+	attributes: 
+		salience 42, agenda-group "my_group", no-loop,  lock-on-active, duration 42, activation-group "my_activation_group"
+	when
+		Foo()
+	then
+		bar();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_names_number_prefix.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_names_number_prefix.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_names_number_prefix.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule "1. Do Stuff!"
+  when
+  then
+end
+
+rule "2. Do More Stuff!"
+  when
+  then
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_not.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_not.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/rule_not.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+
+rule simple_rule 
+  when
+  	not Cheese(type == "stilton")
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ruleflowgroup.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ruleflowgroup.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ruleflowgroup.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+rule rule1 
+  ruleflow-group "a group"
+  when
+  	not Cheese(type == "stilton")
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/semicolon.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/semicolon.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/semicolon.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+package org.drools;
+
+global java.util.List list;
+
+rule "rule1"
+when
+    Pattern1();
+    Pattern2() from x.y.z;
+then
+    System.out.println("Test");
+end;
+
+query "query1"
+	Pattern5();
+	Pattern6();
+	Pattern7();
+end;
+
+rule "rule2"
+when
+    Pattern3();
+    Pattern4() from collect( Pattern5() );
+then
+    System.out.println("Test");
+end;
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_expander.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_expander.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_expander.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,18 @@
+
+expander foo.dsl
+
+rule simple_rule 
+  when
+    The rain in spain falls mainly
+    >Baz()    
+    The rain in spain falls mainly
+    >Bar()   
+    
+    
+
+  then
+	>bar
+	Something else
+	> baz
+	Hey dude
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_query.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_query.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_query.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+
+query "simple_query" 
+    foo3 : Bar(a==3)
+    foo4 : Bar(a4:a==4)
+    Baz()
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/simple_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,14 @@
+
+rule simple_rule 
+  when
+    foo3 : Bar(a==3)
+    foo4 : Bar(a4:a==4)
+    Baz()
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/soundslike_operator.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/soundslike_operator.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/soundslike_operator.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package nesting;
+
+
+
+
+rule "test something"
+
+	when
+		p: Person( name soundslike "Michael" )
+	then
+		p.name = "goober"
+		System.out.println(p.name)
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/statement_ordering_1.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/statement_ordering_1.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/statement_ordering_1.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,28 @@
+
+package com.foo;
+
+import im.one
+
+import im.two
+
+rule foo
+  when
+  then
+end
+
+function cheeseIt() {
+
+}
+
+import im.three;
+
+rule bar
+  when
+  then
+end
+
+function uncheeseIt() {
+
+}
+
+import im.four;
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ternary_expression.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ternary_expression.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/ternary_expression.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package foo
+
+rule rule_one 
+  when
+  	Foo()
+  then
+  	 if (speed > speedLimit ? true : false;)
+     pullEmOver();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_CommentLineNumbersInConsequence.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_CommentLineNumbersInConsequence.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_CommentLineNumbersInConsequence.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,17 @@
+package la
+
+
+rule simple_rule 
+  when
+  	Baz()
+  then
+  	//woot
+  	first
+  	
+  	#
+  	
+  	/* lala
+  	
+  	*/
+  	second  
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_ComplexChainedCallWithFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_ComplexChainedCallWithFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_ComplexChainedCallWithFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+rule blah
+ when 
+	Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
+	            .doIt2(bar, [a, "b", 42]).field["key"]
+	Col2()
+ then
+	partay();
+end	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EmptyPattern.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EmptyPattern.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EmptyPattern.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,9 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+ 
+rule "simple rule"
+    when
+        Cheese( )
+    then
+end 
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EndPosition.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EndPosition.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_EndPosition.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+
+
+
+rule simple_rule 
+  when
+	Foo(
+	  bar == baz, la==laz
+	  )
+  then
+	Kapow
+	Poof
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_FunctionImport.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_FunctionImport.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_FunctionImport.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,12 @@
+package HR1
+
+import function abd.def.x
+import function qed.wah.*
+
+rule simple_rule 
+  when  		  	
+  	not ( Cheese(type == "stilton") )
+  	exists ( Foo() )
+  then
+	funky();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorArgWithFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorArgWithFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorArgWithFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule blah
+
+ when 
+
+	Col1() from something.doIt["key"]
+	Col2()
+ then
+	partay();
+end	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorWithFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorWithFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleAccessorWithFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule blah
+
+ when 
+
+	Col1() from something.doIt
+	Col2()
+ then
+	partay();
+end	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleFunctionCallWithFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleFunctionCallWithFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleFunctionCallWithFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule blah
+
+ when 
+
+	Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+	Col2()
+ then
+	partay();
+end	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleMethodCallWithFrom.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleMethodCallWithFrom.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_SimpleMethodCallWithFrom.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule blah
+
+ when 
+
+	Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+	Col2()
+ then
+	partay();
+end	
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_Templates.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_Templates.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/test_Templates.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+package test.templates
+
+template Cheese
+	String 	name
+	Integer age
+end
+
+template "Wine"
+	String 		name
+	String 		year
+	String[] 	accolades
+end
+
+
+rule "a rule"
+  when
+	Cheese(name == "Stilton", age==2001)
+	Wine(name == "Grange", age == "1978", accolades contains "world champion")
+  then
+  	baz();
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_eval.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_eval.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_eval.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,10 @@
+
+rule simple_rule 
+  when
+	Foo()
+	Bar()
+	eval(abc("foo"))
+  then
+	Kapow
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_predicate.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_predicate.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_predicate.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,7 @@
+
+rule simple_rule 
+  when
+  	Person( $age2:age -> ($age2 == $age1+2 ) ) 
+  then
+	foo bar
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_retval.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_retval.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/lang/with_retval.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,8 @@
+
+rule simple_rule 
+  when
+	Foo(name== (a + b))
+  then
+	Kapow
+	
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrs
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrs	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrs	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,576 @@
+<org.drools.reteoo.ReteooRuleBase>
+  <map>
+    <entry>
+      <string>org.drools.reteoo</string>
+      <org.drools.rule.Package>
+        <org.drools.rule.PackageCompilationData>
+          <map>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_2_0.class</string>
+              <byte-array>yv66vgAAADAALAcAAgEAJm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wBwAE
+AQAQamF2YS9sYW5nL09iamVjdAEAEHNlcmlhbFZlcnNpb25VSUQBAAFKAQANQ29uc3RhbnRWYWx1
+ZQUAAAAAAAABQAEABjxpbml0PgEAAygpVgEABENvZGUKAAMADgwACgALAQAPTGluZU51bWJlclRh
+YmxlAQASTG9jYWxWYXJpYWJsZVRhYmxlAQAEdGhpcwEAKExvcmcvZHJvb2xzL3JldGVvby9SdWxl
+X0hlbGxvX1dvcmxkXzJfMDsBAAVldmFsMAEAAygpWgEACkV4Y2VwdGlvbnMHABcBABNqYXZhL2xh
+bmcvRXhjZXB0aW9uAQALY29uc2VxdWVuY2UBACMoTG9yZy9kcm9vbHMvc3BpL0tub3dsZWRnZUhl
+bHBlcjspVgkAGwAdBwAcAQAQamF2YS9sYW5nL1N5c3RlbQwAHgAfAQADb3V0AQAVTGphdmEvaW8v
+UHJpbnRTdHJlYW07CAAhAQAGZG9uZSAyCgAjACUHACQBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAm
+ACcBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWAQAGZHJvb2xzAQAgTG9yZy9kcm9v
+bHMvc3BpL0tub3dsZWRnZUhlbHBlcjsBAApTb3VyY2VGaWxlAQAZUnVsZV9IZWxsb19Xb3JsZF8y
+XzAuamF2YQAhAAEAAwAAAAEAGgAFAAYAAQAHAAAAAgAIAAMAAQAKAAsAAQAMAAAALwABAAEAAAAF
+KrcADbEAAAACAA8AAAAGAAEAAAAFABAAAAAMAAEAAAAFABEAEgAAAAkAEwAUAAIAFQAAAAQAAQAW
+AAwAAAAiAAEAAAAAAAIErAAAAAIADwAAAAYAAQAAAAgAEAAAAAIAAAAJABgAGQACABUAAAAEAAEA
+FgAMAAAANwACAAEAAAAJsgAaEiC2ACKxAAAAAgAPAAAACgACAAAACwAIAAwAEAAAAAwAAQAAAAkA
+KAApAAAAAQAqAAAAAgAr</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_1_0.class</string>
+              <byte-array>yv66vgAAADAAKgcAAgEAJm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMV8wBwAE
+AQAQamF2YS9sYW5nL09iamVjdAEAEHNlcmlhbFZlcnNpb25VSUQBAAFKAQANQ29uc3RhbnRWYWx1
+ZQUAAAAAAAABQAEABjxpbml0PgEAAygpVgEABENvZGUKAAMADgwACgALAQAPTGluZU51bWJlclRh
+YmxlAQASTG9jYWxWYXJpYWJsZVRhYmxlAQAEdGhpcwEAKExvcmcvZHJvb2xzL3JldGVvby9SdWxl
+X0hlbGxvX1dvcmxkXzFfMDsBAAtjb25zZXF1ZW5jZQEAIyhMb3JnL2Ryb29scy9zcGkvS25vd2xl
+ZGdlSGVscGVyOylWAQAKRXhjZXB0aW9ucwcAFwEAE2phdmEvbGFuZy9FeGNlcHRpb24JABkAGwcA
+GgEAEGphdmEvbGFuZy9TeXN0ZW0MABwAHQEAA291dAEAFUxqYXZhL2lvL1ByaW50U3RyZWFtOwgA
+HwEABmRvbmUgMQoAIQAjBwAiAQATamF2YS9pby9QcmludFN0cmVhbQwAJAAlAQAHcHJpbnRsbgEA
+FShMamF2YS9sYW5nL1N0cmluZzspVgEABmRyb29scwEAIExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7AQAKU291cmNlRmlsZQEAGVJ1bGVfSGVsbG9fV29ybGRfMV8wLmphdmEAIQABAAMA
+AAABABoABQAGAAEABwAAAAIACAACAAEACgALAAEADAAAAC8AAQABAAAABSq3AA2xAAAAAgAPAAAA
+BgABAAAABQAQAAAADAABAAAABQARABIAAAAJABMAFAACABUAAAAEAAEAFgAMAAAANwACAAEAAAAJ
+sgAYEh62ACCxAAAAAgAPAAAACgACAAAACAAIAAkAEAAAAAwAAQAAAAkAJgAnAAAAAQAoAAAAAgAp
+</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_2_0ConsequenceInvoker.class</string>
+              <byte-array>yv66vgAAADAAOAcAAgEAOG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wQ29u
+c2VxdWVuY2VJbnZva2VyBwAEAQAQamF2YS9sYW5nL09iamVjdAcABgEAGm9yZy9kcm9vbHMvc3Bp
+L0NvbnNlcXVlbmNlAQAQc2VyaWFsVmVyc2lvblVJRAEAAUoBAA1Db25zdGFudFZhbHVlBQAAAAAA
+AAFAAQAGPGluaXQ+AQADKClWAQAEQ29kZQoAAwAQDAAMAA0BAA9MaW5lTnVtYmVyVGFibGUBABJM
+b2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQA6TG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9f
+V29ybGRfMl8wQ29uc2VxdWVuY2VJbnZva2VyOwEACGV2YWx1YXRlAQA9KExvcmcvZHJvb2xzL3Nw
+aS9Lbm93bGVkZ2VIZWxwZXI7TG9yZy9kcm9vbHMvV29ya2luZ01lbW9yeTspVgEACkV4Y2VwdGlv
+bnMHABkBABNqYXZhL2xhbmcvRXhjZXB0aW9uCwAbAB0HABwBAB5vcmcvZHJvb2xzL3NwaS9Lbm93
+bGVkZ2VIZWxwZXIMAB4AHwEACGdldFR1cGxlAQAYKClMb3JnL2Ryb29scy9zcGkvVHVwbGU7CwAb
+ACEMACIAIwEAB2dldFJ1bGUBABgoKUxvcmcvZHJvb2xzL3J1bGUvUnVsZTsKACUAJwcAJgEAFG9y
+Zy9kcm9vbHMvcnVsZS9SdWxlDAAoACkBAA9nZXREZWNsYXJhdGlvbnMBACAoKVtMb3JnL2Ryb29s
+cy9ydWxlL0RlY2xhcmF0aW9uOwoAKwAtBwAsAQAmb3JnL2Ryb29scy9yZXRlb28vUnVsZV9IZWxs
+b19Xb3JsZF8yXzAMAC4ALwEAC2NvbnNlcXVlbmNlAQAjKExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7KVYBAA9rbm93bGVkZ2VIZWxwZXIBACBMb3JnL2Ryb29scy9zcGkvS25vd2xlZGdl
+SGVscGVyOwEADXdvcmtpbmdNZW1vcnkBABpMb3JnL2Ryb29scy9Xb3JraW5nTWVtb3J5OwEABHJ1
+bGUBABZMb3JnL2Ryb29scy9ydWxlL1J1bGU7AQAKU291cmNlRmlsZQEAK1J1bGVfSGVsbG9fV29y
+bGRfMl8wQ29uc2VxdWVuY2VJbnZva2VyLmphdmEAIQABAAMAAQAFAAEAGgAHAAgAAQAJAAAAAgAK
+AAIAAQAMAA0AAQAOAAAALwABAAEAAAAFKrcAD7EAAAACABEAAAAGAAEAAAADABIAAAAMAAEAAAAF
+ABMAFAAAAAEAFQAWAAIAFwAAAAQAAQAYAA4AAAB0AAEABAAAABgruQAaAQBXK7kAIAEATi22ACRX
+K7gAKrEAAAACABEAAAAaAAYAAAAKAAcACwAOAAwAEwATABQAEgAXABYAEgAAACoABAAAABgAEwAU
+AAAAAAAYADAAMQABAAAAGAAyADMAAgAOAAoANAA1AAMAAQA2AAAAAgA3</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_2_0Eval0Invoker.class</string>
+              <byte-array>yv66vgAAADAAtAcAAgEAMm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wRXZh
+bDBJbnZva2VyBwAEAQAQamF2YS9sYW5nL09iamVjdAcABgEAHW9yZy9kcm9vbHMvc3BpL0V2YWxF
+eHByZXNzaW9uBwAIAQAeb3JnL2Ryb29scy9zcGkvQ29tcGlsZWRJbnZva2VyAQAQc2VyaWFsVmVy
+c2lvblVJRAEAAUoBAA1Db25zdGFudFZhbHVlBQAAAAAAAAFAAQAHY2xhc3MkMAEAEUxqYXZhL2xh
+bmcvQ2xhc3M7AQAJU3ludGhldGljAQAGPGluaXQ+AQADKClWAQAEQ29kZQoAAwAVDAARABIBAA9M
+aW5lTnVtYmVyVGFibGUBABJMb2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQA0TG9yZy9kcm9vbHMv
+cmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wRXZhbDBJbnZva2VyOwEACGV2YWx1YXRlAQBRKExv
+cmcvZHJvb2xzL3NwaS9UdXBsZTtbTG9yZy9kcm9vbHMvcnVsZS9EZWNsYXJhdGlvbjtMb3JnL2Ry
+b29scy9Xb3JraW5nTWVtb3J5OylaAQAKRXhjZXB0aW9ucwcAHgEAE2phdmEvbGFuZy9FeGNlcHRp
+b24KACAAIgcAIQEAJm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wDAAjACQB
+AAVldmFsMAEAAygpWgEABXR1cGxlAQAWTG9yZy9kcm9vbHMvc3BpL1R1cGxlOwEADGRlY2xhcmF0
+aW9ucwEAHltMb3JnL2Ryb29scy9ydWxlL0RlY2xhcmF0aW9uOwEADXdvcmtpbmdNZW1vcnkBABpM
+b3JnL2Ryb29scy9Xb3JraW5nTWVtb3J5OwEACGhhc2hDb2RlAQADKClJAwA2dY4BABFnZXRNZXRo
+b2RCeXRlY29kZQEAEigpTGphdmEvdXRpbC9MaXN0OwcAMQEAK29yZy9kcm9vbHMvdXRpbC9hc20v
+TWV0aG9kQ29tcGFyYXRvciRUcmFjZXIIACMKADAANAwAEQA1AQAVKExqYXZhL2xhbmcvU3RyaW5n
+OylWCQABADcMAA4ADwgAOQEAJm9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8w
+CgA7AD0HADwBAA9qYXZhL2xhbmcvQ2xhc3MMAD4APwEAB2Zvck5hbWUBACUoTGphdmEvbGFuZy9T
+dHJpbmc7KUxqYXZhL2xhbmcvQ2xhc3M7BwBBAQAeamF2YS9sYW5nL05vQ2xhc3NEZWZGb3VuZEVy
+cm9yCgBDAEUHAEQBABNqYXZhL2xhbmcvVGhyb3dhYmxlDABGAEcBAApnZXRNZXNzYWdlAQAUKClM
+amF2YS9sYW5nL1N0cmluZzsKAEAANAoAOwBKDABLAEwBAA5nZXRDbGFzc0xvYWRlcgEAGSgpTGph
+dmEvbGFuZy9DbGFzc0xvYWRlcjsHAE4BABZqYXZhL2xhbmcvU3RyaW5nQnVmZmVyCgBQAFIHAFEB
+ABBqYXZhL2xhbmcvU3RyaW5nDABTAFQBAAdyZXBsYWNlAQAWKENDKUxqYXZhL2xhbmcvU3RyaW5n
+OwoAUABWDABXAFgBAAd2YWx1ZU9mAQAmKExqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL1N0
+cmluZzsKAE0ANAgAWwEABi5jbGFzcwoATQBdDABeAF8BAAZhcHBlbmQBACwoTGphdmEvbGFuZy9T
+dHJpbmc7KUxqYXZhL2xhbmcvU3RyaW5nQnVmZmVyOwoATQBhDABiAEcBAAh0b1N0cmluZwoAZABm
+BwBlAQAVamF2YS9sYW5nL0NsYXNzTG9hZGVyDABnAGgBABNnZXRSZXNvdXJjZUFzU3RyZWFtAQAp
+KExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9pby9JbnB1dFN0cmVhbTsHAGoBAB1qYXZhL2lvL0J5
+dGVBcnJheU91dHB1dFN0cmVhbQoAaQAVCgBpAG0MAG4AbwEABXdyaXRlAQAHKFtCSUkpVgoAcQBz
+BwByAQATamF2YS9pby9JbnB1dFN0cmVhbQwAdAB1AQAEcmVhZAEAByhbQklJKUkHAHcBACFvcmcv
+ZHJvb2xzL1J1bnRpbWVEcm9vbHNFeGNlcHRpb24IAHkBADxVbmFibGUgZ2V0UmVzb3VyY2VBc1N0
+cmVhbSBmb3IgQ2xhc3MgJ1J1bGVfSGVsbG9fV29ybGRfMl8wJyAKAHYANAcAfAEAGm9yZy9kcm9v
+bHMvYXNtL0NsYXNzUmVhZGVyCgBpAH4MAH8AgAEAC3RvQnl0ZUFycmF5AQAEKClbQgoAewCCDAAR
+AIMBAAUoW0IpVgoAewCFDACGAIcBAAZhY2NlcHQBACEoTG9yZy9kcm9vbHMvYXNtL0NsYXNzVmlz
+aXRvcjtaKVYKADAAiQwAigCLAQAIZ2V0VHJhY2UBACooKUxvcmcvZHJvb2xzL2FzbS91dGlsL1Ry
+YWNlTWV0aG9kVmlzaXRvcjsKAI0AjwcAjgEAJm9yZy9kcm9vbHMvYXNtL3V0aWwvVHJhY2VNZXRo
+b2RWaXNpdG9yDACQAC8BAAdnZXRUZXh0BwCSAQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNl
+cHRpb24HAJQBABNqYXZhL2lvL0lPRXhjZXB0aW9uAQAFdmlzaXQBAC1Mb3JnL2Ryb29scy91dGls
+L2FzbS9NZXRob2RDb21wYXJhdG9yJFRyYWNlcjsBAAJpcwEAFUxqYXZhL2lvL0lucHV0U3RyZWFt
+OwEAA2JvcwEAH0xqYXZhL2lvL0J5dGVBcnJheU91dHB1dFN0cmVhbTsBAARkYXRhAQACW0IBAAli
+eXRlQ291bnQBAAFJAQALY2xhc3NSZWFkZXIBABxMb3JnL2Ryb29scy9hc20vQ2xhc3NSZWFkZXI7
+AQAFdHJhY2UBAChMb3JnL2Ryb29scy9hc20vdXRpbC9UcmFjZU1ldGhvZFZpc2l0b3I7AQAGZXF1
+YWxzAQAVKExqYXZhL2xhbmcvT2JqZWN0OylaCgABAKYMAC4ALwsABwCmCgCpAKsHAKoBACRvcmcv
+ZHJvb2xzL3V0aWwvYXNtL01ldGhvZENvbXBhcmF0b3IMAKwArQEAD2NvbXBhcmVCeXRlY29kZQEA
+IyhMamF2YS91dGlsL0xpc3Q7TGphdmEvdXRpbC9MaXN0OylaAQAGb2JqZWN0AQASTGphdmEvbGFu
+Zy9PYmplY3Q7AQAFb3RoZXIBACBMb3JnL2Ryb29scy9zcGkvQ29tcGlsZWRJbnZva2VyOwEAClNv
+dXJjZUZpbGUBACVSdWxlX0hlbGxvX1dvcmxkXzJfMEV2YWwwSW52b2tlci5qYXZhACEAAQADAAIA
+BQAHAAIAGgAJAAoAAQALAAAAAgAMAAgADgAPAAEAEAAAAAAABQABABEAEgABABMAAAAvAAEAAQAA
+AAUqtwAUsQAAAAIAFgAAAAYAAQAAAAcAFwAAAAwAAQAAAAUAGAAZAAAAAQAaABsAAgAcAAAABAAB
+AB0AEwAAAEwAAQAEAAAABLgAH6wAAAACABYAAAAGAAEAAAARABcAAAAqAAQAAAAEABgAGQAAAAAA
+BAAlACYAAQAAAAQAJwAoAAIAAAAEACkAKgADAAEAKwAsAAEAEwAAAC0AAQABAAAAAxItrAAAAAIA
+FgAAAAYAAQAAABcAFwAAAAwAAQAAAAMAGAAZAAAAAQAuAC8AAQATAAABegAGAAgAAACmuwAwWRIy
+twAzTLIANlnHABxXEji4ADpZswA2pwAPuwBAWl+2AEK3AEi/tgBJuwBNWRI4EC4QL7YAT7gAVbcA
+WRJatgBctgBgtgBjTbsAaVm3AGtOEQQAvAg6BKcADC0ZBAMVBbYAbCwZBAMRBAC2AHBZNgUCo//p
+pwAOV7sAdlkSeLcAer+7AHtZLbYAfbcAgToGGQYrBLYAhCu2AIg6BxkHtgCMsAACABIAFwAeAJEA
+WwB7AHsAkwACABYAAABGABEAAAAbAAoAHgBMACAAVAAhAFsAJABeACgAZwAkAGoAJQBrACYAbgAk
+AHQAJgB7ACoAfAArAIYALgCTAC8AmgAwAKAAMQAXAAAAZgAKAAAApgAYABkAAAAKAJwAlQCWAAEA
+TABaAJcAmAACAFQAUgCZAJoAAwBbAEsAmwCcAAQAXgAJAJ0AngAFAHQABwCdAJ4ABQCGACAAnQCe
+AAUAkwATAJ8AoAAGAKAABgChAKIABwABAKMApAABABMAAACDAAIAAwAAACkrxwAFA6wrKqYABQSs
+K8EAB5oABQOsK8AAB00qtgClLLkApwEAuACorAAAAAIAFgAAACIACAAAADUABAA2AAYANwALADgA
+DQA7ABQAPAAWAD8AGwBBABcAAAAgAAMAAAApABgAGQAAAAAAKQCuAK8AAQAbAA4AsACxAAIAAQCy
+AAAAAgCz</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_1_0ConsequenceInvoker.class</string>
+              <byte-array>yv66vgAAADAAOAcAAgEAOG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMV8wQ29u
+c2VxdWVuY2VJbnZva2VyBwAEAQAQamF2YS9sYW5nL09iamVjdAcABgEAGm9yZy9kcm9vbHMvc3Bp
+L0NvbnNlcXVlbmNlAQAQc2VyaWFsVmVyc2lvblVJRAEAAUoBAA1Db25zdGFudFZhbHVlBQAAAAAA
+AAFAAQAGPGluaXQ+AQADKClWAQAEQ29kZQoAAwAQDAAMAA0BAA9MaW5lTnVtYmVyVGFibGUBABJM
+b2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQA6TG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9f
+V29ybGRfMV8wQ29uc2VxdWVuY2VJbnZva2VyOwEACGV2YWx1YXRlAQA9KExvcmcvZHJvb2xzL3Nw
+aS9Lbm93bGVkZ2VIZWxwZXI7TG9yZy9kcm9vbHMvV29ya2luZ01lbW9yeTspVgEACkV4Y2VwdGlv
+bnMHABkBABNqYXZhL2xhbmcvRXhjZXB0aW9uCwAbAB0HABwBAB5vcmcvZHJvb2xzL3NwaS9Lbm93
+bGVkZ2VIZWxwZXIMAB4AHwEACGdldFR1cGxlAQAYKClMb3JnL2Ryb29scy9zcGkvVHVwbGU7CwAb
+ACEMACIAIwEAB2dldFJ1bGUBABgoKUxvcmcvZHJvb2xzL3J1bGUvUnVsZTsKACUAJwcAJgEAFG9y
+Zy9kcm9vbHMvcnVsZS9SdWxlDAAoACkBAA9nZXREZWNsYXJhdGlvbnMBACAoKVtMb3JnL2Ryb29s
+cy9ydWxlL0RlY2xhcmF0aW9uOwoAKwAtBwAsAQAmb3JnL2Ryb29scy9yZXRlb28vUnVsZV9IZWxs
+b19Xb3JsZF8xXzAMAC4ALwEAC2NvbnNlcXVlbmNlAQAjKExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7KVYBAA9rbm93bGVkZ2VIZWxwZXIBACBMb3JnL2Ryb29scy9zcGkvS25vd2xlZGdl
+SGVscGVyOwEADXdvcmtpbmdNZW1vcnkBABpMb3JnL2Ryb29scy9Xb3JraW5nTWVtb3J5OwEABHJ1
+bGUBABZMb3JnL2Ryb29scy9ydWxlL1J1bGU7AQAKU291cmNlRmlsZQEAK1J1bGVfSGVsbG9fV29y
+bGRfMV8wQ29uc2VxdWVuY2VJbnZva2VyLmphdmEAIQABAAMAAQAFAAEAGgAHAAgAAQAJAAAAAgAK
+AAIAAQAMAA0AAQAOAAAALwABAAEAAAAFKrcAD7EAAAACABEAAAAGAAEAAAADABIAAAAMAAEAAAAF
+ABMAFAAAAAEAFQAWAAIAFwAAAAQAAQAYAA4AAAB0AAEABAAAABgruQAaAQBXK7kAIAEATi22ACRX
+K7gAKrEAAAACABEAAAAaAAYAAAAKAAcACwAOAAwAEwATABQAEgAXABYAEgAAACoABAAAABgAEwAU
+AAAAAAAYADAAMQABAAAAGAAyADMAAgAOAAoANAA1AAMAAQA2AAAAAgA3</byte-array>
+            </entry>
+          </map>
+          <null/>
+          <byte-array>rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVz
+aG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAyb3JnLmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19X
+b3JsZF8yXzBFdmFsMEludm9rZXJzcgAdb3JnLmRyb29scy5ydWxlLkV2YWxDb25kaXRpb24+KtwM
+coOPFgIAAkwACmV4cHJlc3Npb250AB9Mb3JnL2Ryb29scy9zcGkvRXZhbEV4cHJlc3Npb247WwAU
+cmVxdWlyZWREZWNsYXJhdGlvbnN0AB5bTG9yZy9kcm9vbHMvcnVsZS9EZWNsYXJhdGlvbjt4cgAi
+b3JnLmRyb29scy5ydWxlLkNvbmRpdGlvbmFsRWxlbWVudMYMc+lm86I2AgAAeHBzcgAyb3JnLmRy
+b29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8yXzBFdmFsMEludm9rZXIAAAAAAAABQAIAAHhw
+dXIAHltMb3JnLmRyb29scy5ydWxlLkRlY2xhcmF0aW9uO/Wnzws0aCnjAgAAeHAAAAAAdAA4b3Jn
+LmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8xXzBDb25zZXF1ZW5jZUludm9rZXJzcgAU
+b3JnLmRyb29scy5ydWxlLlJ1bGUAAAAAAAABQAIADloACWF1dG9Gb2N1c0oACWxvYWRPcmRlcloA
+Bm5vTG9vcEkACHNhbGllbmNlWgARc2VtYW50aWNhbGx5VmFsaWRMAA9BY3RpdmF0aW9uR3JvdXB0
+ABJMamF2YS9sYW5nL1N0cmluZztMAAthZ2VuZGFHcm91cHEAfgAOTAALY29uc2VxdWVuY2V0ABxM
+b3JnL2Ryb29scy9zcGkvQ29uc2VxdWVuY2U7WwAQZGVjbGFyYXRpb25BcnJheXEAfgAFTAAMZGVj
+bGFyYXRpb25zdAAPTGphdmEvdXRpbC9NYXA7TAAIZHVyYXRpb250ABlMb3JnL2Ryb29scy9zcGkv
+RHVyYXRpb247TAAHbGhzUm9vdHQAFUxvcmcvZHJvb2xzL3J1bGUvQW5kO0wABG5hbWVxAH4ADkwA
+A3BrZ3EAfgAOeHAAAAAAAAAAAAEAAAAAAAFwdAAETUFJTnNyADhvcmcuZHJvb2xzLnJldGVvby5S
+dWxlX0hlbGxvX1dvcmxkXzFfMENvbnNlcXVlbmNlSW52b2tlcgAAAAAAAAFAAgAAeHB1cQB+AAoA
+AAAAc3EAfgAAP0AAAAAAAAx3CAAAABAAAAAAeHBzcgATb3JnLmRyb29scy5ydWxlLkFuZPz45yLw
+psN2AgAAeHIAHG9yZy5kcm9vbHMucnVsZS5Hcm91cEVsZW1lbnTG3JO/b7XpWAIAAUwACGNoaWxk
+cmVudAAQTGphdmEvdXRpbC9MaXN0O3hxAH4ABnNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnH
+YZ0DAAFJAARzaXpleHAAAAADdwQAAAAKc3EAfgAZc3EAfgAdAAAAAncEAAAACnNyABZvcmcuZHJv
+b2xzLnJ1bGUuQ29sdW1uAAAAAAAAAUACAAVJAAVpbmRleEkABm9mZnNldEwAC2NvbnN0cmFpbnRz
+cQB+ABtMAAtkZWNsYXJhdGlvbnQAHUxvcmcvZHJvb2xzL3J1bGUvRGVjbGFyYXRpb247TAAKb2Jq
+ZWN0VHlwZXQAG0xvcmcvZHJvb2xzL3NwaS9PYmplY3RUeXBlO3hwAAAAAAAAAABzcQB+AB0AAAAB
+dwQAAAABc3IAIW9yZy5kcm9vbHMucnVsZS5MaXRlcmFsQ29uc3RyYWludAAAAAAAAAFAAgACTAAJ
+ZXh0cmFjdG9ydAAfTG9yZy9kcm9vbHMvc3BpL0ZpZWxkRXh0cmFjdG9yO0wAC3Jlc3RyaWN0aW9u
+dAAkTG9yZy9kcm9vbHMvcnVsZS9MaXRlcmFsUmVzdHJpY3Rpb247eHBzcgAjb3JnLmRyb29scy5i
+YXNlLkNsYXNzRmllbGRFeHRyYWN0b3IAAAAAAAABQAIAAkwABWNsYXp6dAARTGphdmEvbGFuZy9D
+bGFzcztMAAlmaWVsZE5hbWVxAH4ADnhwdnIAEm9yZy5kcm9vbHMuTWVzc2FnZQAAAAAAAAAAAAAA
+eHB0AAhtZXNzYWdlMXNyACJvcmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9uAAAAAAAA
+AUACAANMAAxjb250ZXh0RW50cnl0ADhMb3JnL2Ryb29scy9ydWxlL0xpdGVyYWxSZXN0cmljdGlv
+biRMaXRlcmFsQ29udGV4dEVudHJ5O0wACWV2YWx1YXRvcnQAGkxvcmcvZHJvb2xzL3NwaS9FdmFs
+dWF0b3I7TAAFZmllbGR0ABtMb3JnL2Ryb29scy9zcGkvRmllbGRWYWx1ZTt4cHNyADZvcmcuZHJv
+b2xzLnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9uJExpdGVyYWxDb250ZXh0RW50cnkkYrwhVPFjKwIA
+A0wACWV4dHJhY3RvcnEAfgAnTAAEbmV4dHQAHkxvcmcvZHJvb2xzL3J1bGUvQ29udGV4dEVudHJ5
+O0wABm9iamVjdHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwcQB+ACxwcHNyAD1vcmcuZHJvb2xzLmJh
+c2UuZXZhbHVhdG9ycy5TdHJpbmdGYWN0b3J5JFN0cmluZ0VxdWFsRXZhbHVhdG9yAAAAAAAAAUAC
+AAB4cgAdb3JnLmRyb29scy5iYXNlLkJhc2VFdmFsdWF0b3IqtHoO7bF+tgIAAkwACG9wZXJhdG9y
+dAAlTG9yZy9kcm9vbHMvYmFzZS9ldmFsdWF0b3JzL09wZXJhdG9yO0wABHR5cGV0ABtMb3JnL2Ry
+b29scy9iYXNlL1ZhbHVlVHlwZTt4cHNyACNvcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5PcGVy
+YXRvcgAAAAAAAAFAAgABTAAIb3BlcmF0b3JxAH4ADnhwdAACPT1zcgAZb3JnLmRyb29scy5iYXNl
+LlZhbHVlVHlwZQAAAAAAAAFAAgADTAAJY2xhc3NUeXBlcQB+ACtMABBldmFsdWF0b3JGYWN0b3J5
+dAAtTG9yZy9kcm9vbHMvYmFzZS9ldmFsdWF0b3JzL0V2YWx1YXRvckZhY3Rvcnk7TAAEbmFtZXEA
+fgAOeHB2cgAQamF2YS5sYW5nLlN0cmluZ6DwpDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNl
+LmV2YWx1YXRvcnMuU3RyaW5nRmFjdG9yeeeM/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRy
+b29scy5iYXNlLmZpZWxkLk9iamVjdEZpZWxkSW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AN3hw
+dAADT25leHBzcgAfb3JnLmRyb29scy5iYXNlLkNsYXNzT2JqZWN0VHlwZQAAAAAAAAFAAgAEWgAN
+c2hhZG93RW5hYmxlZEwAD29iamVjdFR5cGVDbGFzc3EAfgArTAALc2hhZG93Q2xhc3NxAH4AK0wA
+CXZhbHVlVHlwZXEAfgA8eHABcQB+AC52cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkA
+AAAAAAAAAAAAAHhwc3EAfgBBdnIAEGphdmEubGFuZy5PYmplY3QAAAAAAAAAAAAAAHhwc3IAKG9y
+Zy5kcm9vbHMuYmFzZS5ldmFsdWF0b3JzLk9iamVjdEZhY3RvcnmJYnOb3hlWOQIAAHhwdAAGT2Jq
+ZWN0c3EAfgAhAAAAAQAAAABzcQB+AB0AAAABdwQAAAABc3EAfgAmc3EAfgAqcQB+AC50AAhtZXNz
+YWdlMnNxAH4AMHNxAH4ANXEAfgBZcHBxAH4APXNxAH4ASXQAA1R3b3hwc3EAfgBMAXEAfgAudnIA
+HW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBQeHNyABJvcmcu
+ZHJvb2xzLnJ1bGUuT3IVF4eAAV23IwIAAHhxAH4AGnNxAH4AHQAAAAJ3BAAAAApzcQB+ACEAAAAC
+AAAAAHNxAH4AHQAAAAF3BAAAAAFzcQB+ACZxAH4AWXNxAH4AMHNxAH4ANXEAfgBZcHBxAH4APXNx
+AH4ASXEAfgBLeHBzcQB+AEwBcQB+AC52cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkA
+AAAAAAAAAAAAAHhwcQB+AFBzcQB+ACEAAAAD/////3NxAH4AHQAAAAF3BAAAAAFzcQB+ACZxAH4A
+WXNxAH4AMHNxAH4ANXEAfgBZcHBxAH4APXNxAH4ASXEAfgBeeHBzcQB+AEwBcQB+AC52cgAdb3Jn
+LmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AFB4c3EAfgBic3EAfgAd
+AAAAAncEAAAACnNxAH4AIQAAAAT/////c3EAfgAdAAAAAXcEAAAAAXNxAH4AJnNxAH4AKnEAfgAu
+dAAIbWVzc2FnZTNzcQB+ADBzcQB+ADVxAH4AfHBwcQB+AD1zcQB+AElxAH4AS3hwc3EAfgBMAXEA
+fgAudnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBQc3EA
+fgAhAAAABf////5zcQB+AB0AAAABdwQAAAABc3EAfgAmcQB+AHxzcQB+ADBzcQB+ADVxAH4AfHBw
+cQB+AD1zcQB+AEl0AAVUaHJlZXhwc3EAfgBMAXEAfgAudnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNo
+YWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBQeHh0AA1IZWxsbyBXb3JsZCAxcHQAOG9yZy5kcm9v
+bHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8wQ29uc2VxdWVuY2VJbnZva2Vyc3EAfgANAAAA
+AAAAAAACAAAAAAABcHEAfgAUc3IAOG9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRf
+Ml8wQ29uc2VxdWVuY2VJbnZva2VyAAAAAAAAAUACAAB4cHVxAH4ACgAAAABzcQB+AAA/QAAAAAAA
+DHcIAAAAEAAAAAB4cHNxAH4AGXNxAH4AHQAAAAR3BAAAAApzcQB+ABlzcQB+AB0AAAACdwQAAAAK
+c3EAfgAhAAAAAAAAAABzcQB+AB0AAAABdwQAAAABc3EAfgAmcQB+ACxzcQB+ADBzcQB+ADVxAH4A
+LHBwcQB+AD1zcQB+AElxAH4AS3hwc3EAfgBMAXEAfgAudnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNo
+YWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBQc3EAfgAhAAAAAQAAAABzcQB+AB0AAAABdwQAAAAB
+c3EAfgAmcQB+AFlzcQB+ADBzcQB+ADVxAH4AWXBwcQB+AD1zcQB+AElxAH4AXnhwc3EAfgBMAXEA
+fgAudnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBQeHNx
+AH4AYnNxAH4AHQAAAAJ3BAAAAApzcQB+ACEAAAACAAAAAHNxAH4AHQAAAAF3BAAAAAFzcQB+ACZx
+AH4AWXNxAH4AMHNxAH4ANXEAfgBZcHBxAH4APXNxAH4ASXEAfgBLeHBzcQB+AEwBcQB+AC52cgAd
+b3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AFBzcQB+ACEAAAAD
+/////3NxAH4AHQAAAAF3BAAAAAFzcQB+ACZxAH4AWXNxAH4AMHNxAH4ANXEAfgBZcHBxAH4APXNx
+AH4ASXEAfgBeeHBzcQB+AEwBcQB+AC52cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkA
+AAAAAAAAAAAAAHhwcQB+AFB4c3EAfgBic3EAfgAdAAAAAncEAAAACnNxAH4AIQAAAAT/////c3EA
+fgAdAAAAAXcEAAAAAXNxAH4AJnEAfgB8c3EAfgAwc3EAfgA1cQB+AHxwcHEAfgA9c3EAfgBJcQB+
+AEt4cHNxAH4ATAFxAH4ALnZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAA
+AAAAeHBxAH4AUHNxAH4AIQAAAAX////+c3EAfgAdAAAAAXcEAAAAAXNxAH4AJnEAfgB8c3EAfgAw
+c3EAfgA1cQB+AHxwcHEAfgA9c3EAfgBJcQB+AIp4cHNxAH4ATAFxAH4ALnZyAB1vcmcuZHJvb2xz
+Lk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AUHhxAH4AB3h0AA1IZWxsbyBXb3Js
+ZCAycHg=</byte-array>
+        </org.drools.rule.PackageCompilationData>
+        <string>org.drools.reteoo</string>
+        <list>
+          <string>org.drools.Message</string>
+          <string>org.drools.reteoo.*</string>
+          <string>java.lang.*</string>
+        </list>
+        <java.util.Collections-EmptyList/>
+        <java.util.Collections-EmptyMap/>
+        <byte-array>rO0ABXNyABdqYXZhLnV0aWwuTGlua2VkSGFzaE1hcDTATlwQbMD7AgABWgALYWNjZXNzT3JkZXJ4
+cgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4
+cD9AAAAAAAAMdwgAAAAQAAAAAnQADUhlbGxvIFdvcmxkIDFzcgAUb3JnLmRyb29scy5ydWxlLlJ1
+bGUAAAAAAAABQAIADloACWF1dG9Gb2N1c0oACWxvYWRPcmRlcloABm5vTG9vcEkACHNhbGllbmNl
+WgARc2VtYW50aWNhbGx5VmFsaWRMAA9BY3RpdmF0aW9uR3JvdXB0ABJMamF2YS9sYW5nL1N0cmlu
+ZztMAAthZ2VuZGFHcm91cHEAfgAFTAALY29uc2VxdWVuY2V0ABxMb3JnL2Ryb29scy9zcGkvQ29u
+c2VxdWVuY2U7WwAQZGVjbGFyYXRpb25BcnJheXQAHltMb3JnL2Ryb29scy9ydWxlL0RlY2xhcmF0
+aW9uO0wADGRlY2xhcmF0aW9uc3QAD0xqYXZhL3V0aWwvTWFwO0wACGR1cmF0aW9udAAZTG9yZy9k
+cm9vbHMvc3BpL0R1cmF0aW9uO0wAB2xoc1Jvb3R0ABVMb3JnL2Ryb29scy9ydWxlL0FuZDtMAARu
+YW1lcQB+AAVMAANwa2dxAH4ABXhwAAAAAAAAAAABAAAAAAABcHQABE1BSU5zcgA4b3JnLmRyb29s
+cy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8xXzBDb25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIA
+AHhwdXIAHltMb3JnLmRyb29scy5ydWxlLkRlY2xhcmF0aW9uO/Wnzws0aCnjAgAAeHAAAAAAc3EA
+fgABP0AAAAAAAAx3CAAAABAAAAAAeHBzcgATb3JnLmRyb29scy5ydWxlLkFuZPz45yLwpsN2AgAA
+eHIAHG9yZy5kcm9vbHMucnVsZS5Hcm91cEVsZW1lbnTG3JO/b7XpWAIAAUwACGNoaWxkcmVudAAQ
+TGphdmEvdXRpbC9MaXN0O3hyACJvcmcuZHJvb2xzLnJ1bGUuQ29uZGl0aW9uYWxFbGVtZW50xgxz
+6WbzojYCAAB4cHNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAD
+dwQAAAAKc3EAfgASc3EAfgAXAAAAAncEAAAACnNyABZvcmcuZHJvb2xzLnJ1bGUuQ29sdW1uAAAA
+AAAAAUACAAVJAAVpbmRleEkABm9mZnNldEwAC2NvbnN0cmFpbnRzcQB+ABRMAAtkZWNsYXJhdGlv
+bnQAHUxvcmcvZHJvb2xzL3J1bGUvRGVjbGFyYXRpb247TAAKb2JqZWN0VHlwZXQAG0xvcmcvZHJv
+b2xzL3NwaS9PYmplY3RUeXBlO3hwAAAAAAAAAABzcQB+ABcAAAABdwQAAAABc3IAIW9yZy5kcm9v
+bHMucnVsZS5MaXRlcmFsQ29uc3RyYWludAAAAAAAAAFAAgACTAAJZXh0cmFjdG9ydAAfTG9yZy9k
+cm9vbHMvc3BpL0ZpZWxkRXh0cmFjdG9yO0wAC3Jlc3RyaWN0aW9udAAkTG9yZy9kcm9vbHMvcnVs
+ZS9MaXRlcmFsUmVzdHJpY3Rpb247eHBzcgAjb3JnLmRyb29scy5iYXNlLkNsYXNzRmllbGRFeHRy
+YWN0b3IAAAAAAAABQAIAAkwABWNsYXp6dAARTGphdmEvbGFuZy9DbGFzcztMAAlmaWVsZE5hbWVx
+AH4ABXhwdnIAEm9yZy5kcm9vbHMuTWVzc2FnZQAAAAAAAAAAAAAAeHB0AAhtZXNzYWdlMXNyACJv
+cmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9uAAAAAAAAAUACAANMAAxjb250ZXh0RW50
+cnl0ADhMb3JnL2Ryb29scy9ydWxlL0xpdGVyYWxSZXN0cmljdGlvbiRMaXRlcmFsQ29udGV4dEVu
+dHJ5O0wACWV2YWx1YXRvcnQAGkxvcmcvZHJvb2xzL3NwaS9FdmFsdWF0b3I7TAAFZmllbGR0ABtM
+b3JnL2Ryb29scy9zcGkvRmllbGRWYWx1ZTt4cHNyADZvcmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJl
+c3RyaWN0aW9uJExpdGVyYWxDb250ZXh0RW50cnkkYrwhVPFjKwIAA0wACWV4dHJhY3RvcnEAfgAh
+TAAEbmV4dHQAHkxvcmcvZHJvb2xzL3J1bGUvQ29udGV4dEVudHJ5O0wABm9iamVjdHQAEkxqYXZh
+L2xhbmcvT2JqZWN0O3hwcQB+ACZwcHNyAD1vcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5TdHJp
+bmdGYWN0b3J5JFN0cmluZ0VxdWFsRXZhbHVhdG9yAAAAAAAAAUACAAB4cgAdb3JnLmRyb29scy5i
+YXNlLkJhc2VFdmFsdWF0b3IqtHoO7bF+tgIAAkwACG9wZXJhdG9ydAAlTG9yZy9kcm9vbHMvYmFz
+ZS9ldmFsdWF0b3JzL09wZXJhdG9yO0wABHR5cGV0ABtMb3JnL2Ryb29scy9iYXNlL1ZhbHVlVHlw
+ZTt4cHNyACNvcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5PcGVyYXRvcgAAAAAAAAFAAgABTAAI
+b3BlcmF0b3JxAH4ABXhwdAACPT1zcgAZb3JnLmRyb29scy5iYXNlLlZhbHVlVHlwZQAAAAAAAAFA
+AgADTAAJY2xhc3NUeXBlcQB+ACVMABBldmFsdWF0b3JGYWN0b3J5dAAtTG9yZy9kcm9vbHMvYmFz
+ZS9ldmFsdWF0b3JzL0V2YWx1YXRvckZhY3Rvcnk7TAAEbmFtZXEAfgAFeHB2cgAQamF2YS5sYW5n
+LlN0cmluZ6DwpDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3RyaW5n
+RmFjdG9yeeeM/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRyb29scy5iYXNlLmZpZWxkLk9i
+amVjdEZpZWxkSW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AMXhwdAADT25leHBzcgAfb3JnLmRy
+b29scy5iYXNlLkNsYXNzT2JqZWN0VHlwZQAAAAAAAAFAAgAEWgANc2hhZG93RW5hYmxlZEwAD29i
+amVjdFR5cGVDbGFzc3EAfgAlTAALc2hhZG93Q2xhc3NxAH4AJUwACXZhbHVlVHlwZXEAfgA2eHAB
+cQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwc3EAfgA7
+dnIAEGphdmEubGFuZy5PYmplY3QAAAAAAAAAAAAAAHhwc3IAKG9yZy5kcm9vbHMuYmFzZS5ldmFs
+dWF0b3JzLk9iamVjdEZhY3RvcnmJYnOb3hlWOQIAAHhwdAAGT2JqZWN0c3EAfgAbAAAAAQAAAABz
+cQB+ABcAAAABdwQAAAABc3EAfgAgc3EAfgAkcQB+ACh0AAhtZXNzYWdlMnNxAH4AKnNxAH4AL3EA
+fgBTcHBxAH4AN3NxAH4AQ3QAA1R3b3hwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMuTWVzc2Fn
+ZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBKeHNyABJvcmcuZHJvb2xzLnJ1bGUuT3IVF4eA
+AV23IwIAAHhxAH4AE3NxAH4AFwAAAAJ3BAAAAApzcQB+ABsAAAACAAAAAHNxAH4AFwAAAAF3BAAA
+AAFzcQB+ACBxAH4AU3NxAH4AKnNxAH4AL3EAfgBTcHBxAH4AN3NxAH4AQ3EAfgBFeHBzcQB+AEYB
+cQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEpz
+cQB+ABsAAAAD/////3NxAH4AFwAAAAF3BAAAAAFzcQB+ACBxAH4AU3NxAH4AKnNxAH4AL3EAfgBT
+cHBxAH4AN3NxAH4AQ3EAfgBYeHBzcQB+AEYBcQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hh
+ZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEp4c3EAfgBcc3EAfgAXAAAAAncEAAAACnNxAH4AGwAA
+AAT/////c3EAfgAXAAAAAXcEAAAAAXNxAH4AIHNxAH4AJHEAfgAodAAIbWVzc2FnZTNzcQB+ACpz
+cQB+AC9xAH4AdnBwcQB+ADdzcQB+AENxAH4ARXhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMu
+TWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBKc3EAfgAbAAAABf////5zcQB+ABcA
+AAABdwQAAAABc3EAfgAgcQB+AHZzcQB+ACpzcQB+AC9xAH4AdnBwcQB+ADdzcQB+AEN0AAVUaHJl
+ZXhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAA
+AAB4cHEAfgBKeHhxAH4AA3B0AA1IZWxsbyBXb3JsZCAyc3EAfgAEAAAAAAAAAAACAAAAAAABcHEA
+fgAMc3IAOG9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8wQ29uc2VxdWVuY2VJ
+bnZva2VyAAAAAAAAAUACAAB4cHVxAH4ADwAAAABzcQB+AAE/QAAAAAAADHcIAAAAEAAAAAB4cHNx
+AH4AEnNxAH4AFwAAAAR3BAAAAApzcQB+ABJzcQB+ABcAAAACdwQAAAAKc3EAfgAbAAAAAAAAAABz
+cQB+ABcAAAABdwQAAAABc3EAfgAgcQB+ACZzcQB+ACpzcQB+AC9xAH4AJnBwcQB+ADdzcQB+AENx
+AH4ARXhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAA
+AAAAAAB4cHEAfgBKc3EAfgAbAAAAAQAAAABzcQB+ABcAAAABdwQAAAABc3EAfgAgcQB+AFNzcQB+
+ACpzcQB+AC9xAH4AU3BwcQB+ADdzcQB+AENxAH4AWHhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9v
+bHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBKeHNxAH4AXHNxAH4AFwAAAAJ3
+BAAAAApzcQB+ABsAAAACAAAAAHNxAH4AFwAAAAF3BAAAAAFzcQB+ACBxAH4AU3NxAH4AKnNxAH4A
+L3EAfgBTcHBxAH4AN3NxAH4AQ3EAfgBFeHBzcQB+AEYBcQB+ACh2cgAdb3JnLmRyb29scy5NZXNz
+YWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEpzcQB+ABsAAAAD/////3NxAH4AFwAAAAF3
+BAAAAAFzcQB+ACBxAH4AU3NxAH4AKnNxAH4AL3EAfgBTcHBxAH4AN3NxAH4AQ3EAfgBYeHBzcQB+
+AEYBcQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+
+AEp4c3EAfgBcc3EAfgAXAAAAAncEAAAACnNxAH4AGwAAAAT/////c3EAfgAXAAAAAXcEAAAAAXNx
+AH4AIHEAfgB2c3EAfgAqc3EAfgAvcQB+AHZwcHEAfgA3c3EAfgBDcQB+AEV4cHNxAH4ARgFxAH4A
+KHZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4ASnNxAH4A
+GwAAAAX////+c3EAfgAXAAAAAXcEAAAAAXNxAH4AIHEAfgB2c3EAfgAqc3EAfgAvcQB+AHZwcHEA
+fgA3c3EAfgBDcQB+AIR4cHNxAH4ARgFxAH4AKHZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQ
+cm94eQAAAAAAAAAAAAAAeHBxAH4ASnhzcgAdb3JnLmRyb29scy5ydWxlLkV2YWxDb25kaXRpb24+
+KtwMcoOPFgIAAkwACmV4cHJlc3Npb250AB9Mb3JnL2Ryb29scy9zcGkvRXZhbEV4cHJlc3Npb247
+WwAUcmVxdWlyZWREZWNsYXJhdGlvbnNxAH4AB3hxAH4AFXNyADJvcmcuZHJvb2xzLnJldGVvby5S
+dWxlX0hlbGxvX1dvcmxkXzJfMEV2YWwwSW52b2tlcgAAAAAAAAFAAgAAeHB1cQB+AA8AAAAAeHEA
+fgCIcHgA</byte-array>
+      </org.drools.rule.Package>
+    </entry>
+  </map>
+  <byte-array>rO0ABXQAJDJhMTIyOGU2LWMwZDUtNDkzYy05OTBiLTMwMDY0NTY2MGNjNXNyAClvcmcuZHJvb2xz
+LnJldGVvby5SZXRlb29GYWN0SGFuZGxlRmFjdG9yeQAAAAAAAAEsAgAAeHIAK29yZy5kcm9vbHMu
+Y29tbW9uLkFic3RyYWN0RmFjdEhhbmRsZUZhY3RvcnlrwcaUre4SdAIAA0oAB2NvdW50ZXJKAAJp
+ZEwADmZhY3RIYW5kbGVQb29sdAAkTG9yZy9kcm9vbHMvdXRpbC9QcmltaXRpdmVMb25nU3RhY2s7
+eHAAAAAAAAAAAAAAAAAAAAAAc3IAIm9yZy5kcm9vbHMudXRpbC5QcmltaXRpdmVMb25nU3RhY2sP
+j6ttreBeeQIAA0kADWN1cnJlbnRQYWdlSWRJAAl0YWJsZVNpemVMAAtjdXJyZW50UGFnZXQAKUxv
+cmcvZHJvb2xzL3V0aWwvUHJpbWl0aXZlTG9uZ1N0YWNrJFBhZ2U7eHAAAAAAAAABAHNyACdvcmcu
+ZHJvb2xzLnV0aWwuUHJpbWl0aXZlTG9uZ1N0YWNrJFBhZ2Utnhd8IgiDlAIABUkAB2xhc3RLZXlJ
+AAZwYWdlSWRMAAtuZXh0U2libGluZ3EAfgAGTAAPcHJldmlvdXNTaWJsaW5ncQB+AAZbAAV0YWJs
+ZXQAAltKeHD/////AAAAAHBwdXIAAltKeCAEtRKxdZMCAAB4cAAAAQAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHNyABFqYXZhLnV0aWwuSGFzaE1h
+cAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAA
+eHNyACBvcmcuZHJvb2xzLlJ1bGVCYXNlQ29uZmlndXJhdGlvbgAAAAAAAAFAAgALWgALYWxwaGFN
+ZW1vcnlJABlhbHBoYU5vZGVIYXNoaW5nVGhyZXNob2xkSQARY29tcG9zaXRlS2V5RGVwdGhaAAlp
+bW11dGFibGVaABNpbmRleExlZnRCZXRhTWVtb3J5WgAUaW5kZXhSaWdodEJldGFNZW1vcnlaABBy
+ZW1vdmVJZGVudGl0aWVzWgAPc2hhcmVBbHBoYU5vZGVzWgAOc2hhcmVCZXRhTm9kZXNMAA9hc3Nl
+cnRCZWhhdmlvdXJ0ADJMb3JnL2Ryb29scy9SdWxlQmFzZUNvbmZpZ3VyYXRpb24kQXNzZXJ0QmVo
+YXZpb3VyO0wAD2xvZ2ljYWxPdmVycmlkZXQAMkxvcmcvZHJvb2xzL1J1bGVCYXNlQ29uZmlndXJh
+dGlvbiRMb2dpY2FsT3ZlcnJpZGU7eHAAAAAAAwAAAAMBAQEAAQFzcgAwb3JnLmRyb29scy5SdWxl
+QmFzZUNvbmZpZ3VyYXRpb24kQXNzZXJ0QmVoYXZpb3VyAAAAAAAAAUACAAFJAAV2YWx1ZXhwAAAA
+AHNyADBvcmcuZHJvb2xzLlJ1bGVCYXNlQ29uZmlndXJhdGlvbiRMb2dpY2FsT3ZlcnJpZGUAAAAA
+AAABQAIAAUkABXZhbHVleHAAAAABc3IAFm9yZy5kcm9vbHMucmV0ZW9vLlJldGUAAAAAAAABQAIA
+AUwAD29iamVjdFR5cGVOb2Rlc3QAH0xvcmcvZHJvb2xzL3V0aWwvT2JqZWN0SGFzaE1hcDt4cgAe
+b3JnLmRyb29scy5yZXRlb28uT2JqZWN0U291cmNlW528FtDzXo0CAANJABlhbHBoYU5vZGVIYXNo
+aW5nVGhyZXNob2xkTAAMb2JqZWN0U291cmNldAAgTG9yZy9kcm9vbHMvcmV0ZW9vL09iamVjdFNv
+dXJjZTtMAARzaW5rdAAoTG9yZy9kcm9vbHMvcmV0ZW9vL09iamVjdFNpbmtQcm9wYWdhdG9yO3hy
+ABpvcmcuZHJvb2xzLmNvbW1vbi5CYXNlTm9kZeK9dF1arM6UAgADWgAJaGFzTWVtb3J5SQACaWRJ
+AAtzaGFyZWRDb3VudHhwAAAAAAAAAAAAAAAAA3BzcgAob3JnLmRyb29scy5yZXRlb28uRW1wdHlP
+YmplY3RTaW5rQWRhcHRlctw8SkYUA/qZAgAAeHBzcgAdb3JnLmRyb29scy51dGlsLk9iamVjdEhh
+c2hNYXAM5rjKq4yAgQIAAHhyACFvcmcuZHJvb2xzLnV0aWwuQWJzdHJhY3RIYXNoVGFibGXzzroG
+hO24nAIABkYACmxvYWRGYWN0b3JJAARzaXplSQAJdGhyZXNob2xkTAAKY29tcGFyYXRvcnQANExv
+cmcvZHJvb2xzL3V0aWwvQWJzdHJhY3RIYXNoVGFibGUkT2JqZWN0Q29tcGFyYXRvcjtMAAhpdGVy
+YXRvcnQANUxvcmcvZHJvb2xzL3V0aWwvQWJzdHJhY3RIYXNoVGFibGUkSGFzaFRhYmxlSXRlcmF0
+b3I7WwAFdGFibGV0ABhbTG9yZy9kcm9vbHMvdXRpbC9FbnRyeTt4cD9AAAAAAAABAAAADHNyADBv
+cmcuZHJvb2xzLnV0aWwuQWJzdHJhY3RIYXNoVGFibGUkRXF1YWxpdHlFcXVhbHNvFs5QO+Qj0wIA
+AHhwcHVyABhbTG9yZy5kcm9vbHMudXRpbC5FbnRyeTtplR3hOYt48QIAAHhwAAAAEHBwcHBwc3IA
+KW9yZy5kcm9vbHMudXRpbC5PYmplY3RIYXNoTWFwJE9iamVjdEVudHJ5FcrE/UwCYfECAARJAAho
+YXNoQ29kZUwAA2tleXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABG5leHR0ABdMb3JnL2Ryb29scy91
+dGlsL0VudHJ5O0wABXZhbHVlcQB+ACt4cKcr1dVzcgAfb3JnLmRyb29scy5iYXNlLkNsYXNzT2Jq
+ZWN0VHlwZQAAAAAAAAFAAgAEWgANc2hhZG93RW5hYmxlZEwAD29iamVjdFR5cGVDbGFzc3QAEUxq
+YXZhL2xhbmcvQ2xhc3M7TAALc2hhZG93Q2xhc3NxAH4AL0wACXZhbHVlVHlwZXQAG0xvcmcvZHJv
+b2xzL2Jhc2UvVmFsdWVUeXBlO3hwAXZyABJvcmcuZHJvb2xzLk1lc3NhZ2UAAAAAAAAAAAAAAHhw
+dnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHNyABlvcmcuZHJv
+b2xzLmJhc2UuVmFsdWVUeXBlAAAAAAAAAUACAANMAAljbGFzc1R5cGVxAH4AL0wAEGV2YWx1YXRv
+ckZhY3Rvcnl0AC1Mb3JnL2Ryb29scy9iYXNlL2V2YWx1YXRvcnMvRXZhbHVhdG9yRmFjdG9yeTtM
+AARuYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7eHB2cgAQamF2YS5sYW5nLk9iamVjdAAAAAAAAAAA
+AAAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuT2JqZWN0RmFjdG9yeYlic5veGVY5
+AgAAeHB0AAZPYmplY3Rwc3IAIG9yZy5kcm9vbHMucmV0ZW9vLk9iamVjdFR5cGVOb2RlAAAAAAAA
+AUACAAJMAApvYmplY3RUeXBldAAbTG9yZy9kcm9vbHMvc3BpL09iamVjdFR5cGU7TAAEcmV0ZXQA
+GExvcmcvZHJvb2xzL3JldGVvby9SZXRlO3hxAH4AGQEAAAABAAAAHwAAAANwc3IALG9yZy5kcm9v
+bHMucmV0ZW9vLkNvbXBvc2l0ZU9iamVjdFNpbmtBZGFwdGVyAAAAAAAAAUACAAZJABlhbHBoYU5v
+ZGVIYXNoaW5nVGhyZXNob2xkTAAHaGFzaEtleXQANkxvcmcvZHJvb2xzL3JldGVvby9Db21wb3Np
+dGVPYmplY3RTaW5rQWRhcHRlciRIYXNoS2V5O0wADWhhc2hhYmxlU2lua3N0ACZMb3JnL2Ryb29s
+cy9yZXRlb28vT2JqZWN0U2lua05vZGVMaXN0O0wAEmhhc2hlZEZpZWxkSW5kZXhlc3QAHExvcmcv
+ZHJvb2xzL3V0aWwvTGlua2VkTGlzdDtMAA1oYXNoZWRTaW5rTWFwcQB+ABhMAApvdGhlclNpbmtz
+cQB+AEV4cAAAAANzcgA0b3JnLmRyb29scy5yZXRlb28uQ29tcG9zaXRlT2JqZWN0U2lua0FkYXB0
+ZXIkSGFzaEtleRsM6xs9psGCAgAHWgAGYnZhbHVlRAAGZHZhbHVlSQAIaGFzaENvZGVJAAVpbmRl
+eEoABmx2YWx1ZUIABHR5cGVMAAZvdmFsdWVxAH4AK3hwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AABwc3IAJG9yZy5kcm9vbHMucmV0ZW9vLk9iamVjdFNpbmtOb2RlTGlzdAAAAAAAAAFAAgADSQAE
+c2l6ZUwACWZpcnN0Tm9kZXQAIkxvcmcvZHJvb2xzL3JldGVvby9PYmplY3RTaW5rTm9kZTtMAAhs
+YXN0Tm9kZXEAfgBLeHAAAAAFc3IAG29yZy5kcm9vbHMucmV0ZW9vLkFscGhhTm9kZQAAAAAAAAFA
+AgADTAAKY29uc3RyYWludHQAKUxvcmcvZHJvb2xzL3NwaS9BbHBoYU5vZGVGaWVsZENvbnN0cmFp
+bnQ7TAASbmV4dE9iamVjdFNpbmtOb2RlcQB+AEtMABZwcmV2aW91c09iamVjdFNpbmtOb2RlcQB+
+AEt4cQB+ABkBAAAAAgAAAAcAAAADcQB+AEJzcgApb3JnLmRyb29scy5yZXRlb28uU2luZ2xlT2Jq
+ZWN0U2lua0FkYXB0ZXKbSfZkhSu2EwIAAUwABHNpbmt0AB5Mb3JnL2Ryb29scy9yZXRlb28vT2Jq
+ZWN0U2luazt4cHNyACZvcmcuZHJvb2xzLnJldGVvby5MZWZ0SW5wdXRBZGFwdGVyTm9kZQAAAAAA
+AAFAAgADTAASbmV4dE9iamVjdFNpbmtOb2RlcQB+AEtMAAxvYmplY3RTb3VyY2VxAH4AGkwAFnBy
+ZXZpb3VzT2JqZWN0U2lua05vZGVxAH4AS3hyAB1vcmcuZHJvb2xzLnJldGVvby5UdXBsZVNvdXJj
+ZT6alB7Ahxx7AgABTAAEc2lua3QAJ0xvcmcvZHJvb2xzL3JldGVvby9UdXBsZVNpbmtQcm9wYWdh
+dG9yO3hxAH4AHAAAAAADAAAAB3NyAChvcmcuZHJvb2xzLnJldGVvby5TaW5nbGVUdXBsZVNpbmtB
+ZGFwdGVyNGYRLuMST0oCAAFMAARzaW5rdAAdTG9yZy9kcm9vbHMvcmV0ZW9vL1R1cGxlU2luazt4
+cHNyABpvcmcuZHJvb2xzLnJldGVvby5Kb2luTm9kZQAAAAAAAAFAAgAAeHIAGm9yZy5kcm9vbHMu
+cmV0ZW9vLkJldGFOb2Rll/Io5qUjbtgCAAdMAAtjb25zdHJhaW50c3QAI0xvcmcvZHJvb2xzL2Nv
+bW1vbi9CZXRhQ29uc3RyYWludHM7TAAJbGVmdElucHV0dAAfTG9yZy9kcm9vbHMvcmV0ZW9vL1R1
+cGxlU291cmNlO0wAEm5leHRPYmplY3RTaW5rTm9kZXEAfgBLTAARbmV4dFR1cGxlU2lua05vZGV0
+ACFMb3JnL2Ryb29scy9yZXRlb28vVHVwbGVTaW5rTm9kZTtMABZwcmV2aW91c09iamVjdFNpbmtO
+b2RlcQB+AEtMABVwcmV2aW91c1R1cGxlU2lua05vZGVxAH4AXkwACnJpZ2h0SW5wdXRxAH4AGnhx
+AH4AVAAAAAAFAAAAB3NyACtvcmcuZHJvb2xzLnJldGVvby5Db21wb3NpdGVUdXBsZVNpbmtBZGFw
+dGVyg2IGbDB+jusCAAFMAAVzaW5rc3QAJUxvcmcvZHJvb2xzL3JldGVvby9UdXBsZVNpbmtOb2Rl
+TGlzdDt4cHNyACNvcmcuZHJvb2xzLnJldGVvby5UdXBsZVNpbmtOb2RlTGlzdAAAAAAAAAFAAgAD
+SQAEc2l6ZUwACWZpcnN0Tm9kZXEAfgBeTAAIbGFzdE5vZGVxAH4AXnhwAAAAAnNxAH4AWgAAAAAH
+AAAAA3NxAH4AYHNxAH4AYwAAAAJzcQB+AFoAAAAACQAAAAFzcQB+AGBzcQB+AGMAAAACc3IAHm9y
+Zy5kcm9vbHMucmV0ZW9vLlRlcm1pbmFsTm9kZQAAAAAAAAFAAgAETAARbmV4dFR1cGxlU2lua05v
+ZGVxAH4AXkwAFXByZXZpb3VzVHVwbGVTaW5rTm9kZXEAfgBeTAAEcnVsZXQAFkxvcmcvZHJvb2xz
+L3J1bGUvUnVsZTtMAAt0dXBsZVNvdXJjZXEAfgBdeHEAfgAcAAAAAAoAAAAAc3IAI29yZy5kcm9v
+bHMucmV0ZW9vLkV2YWxDb25kaXRpb25Ob2RlG5Anz5SL4+ACAARMAAljb25kaXRpb250AB9Mb3Jn
+L2Ryb29scy9ydWxlL0V2YWxDb25kaXRpb247TAARbmV4dFR1cGxlU2lua05vZGVxAH4AXkwAFXBy
+ZXZpb3VzVHVwbGVTaW5rTm9kZXEAfgBeTAALdHVwbGVTb3VyY2VxAH4AXXhxAH4AVAEAAAATAAAA
+AHNxAH4AV3NxAH4AawAAAAAUAAAAAHBwc3IAFG9yZy5kcm9vbHMucnVsZS5SdWxlAAAAAAAAAUAC
+AA5aAAlhdXRvRm9jdXNKAAlsb2FkT3JkZXJaAAZub0xvb3BJAAhzYWxpZW5jZVoAEXNlbWFudGlj
+YWxseVZhbGlkTAAPQWN0aXZhdGlvbkdyb3VwcQB+ADhMAAthZ2VuZGFHcm91cHEAfgA4TAALY29u
+c2VxdWVuY2V0ABxMb3JnL2Ryb29scy9zcGkvQ29uc2VxdWVuY2U7WwAQZGVjbGFyYXRpb25BcnJh
+eXQAHltMb3JnL2Ryb29scy9ydWxlL0RlY2xhcmF0aW9uO0wADGRlY2xhcmF0aW9uc3QAD0xqYXZh
+L3V0aWwvTWFwO0wACGR1cmF0aW9udAAZTG9yZy9kcm9vbHMvc3BpL0R1cmF0aW9uO0wAB2xoc1Jv
+b3R0ABVMb3JnL2Ryb29scy9ydWxlL0FuZDtMAARuYW1lcQB+ADhMAANwa2dxAH4AOHhwAAAAAAAA
+AAACAAAAAAABcHQABE1BSU5zcgA4b3JnLmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8y
+XzBDb25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIAAHhwdXIAHltMb3JnLmRyb29scy5ydWxlLkRl
+Y2xhcmF0aW9uO/Wnzws0aCnjAgAAeHAAAAAAc3EAfgANP0AAAAAAAAx3CAAAABAAAAAAeHBzcgAT
+b3JnLmRyb29scy5ydWxlLkFuZPz45yLwpsN2AgAAeHIAHG9yZy5kcm9vbHMucnVsZS5Hcm91cEVs
+ZW1lbnTG3JO/b7XpWAIAAUwACGNoaWxkcmVudAAQTGphdmEvdXRpbC9MaXN0O3hyACJvcmcuZHJv
+b2xzLnJ1bGUuQ29uZGl0aW9uYWxFbGVtZW50xgxz6WbzojYCAAB4cHNyABNqYXZhLnV0aWwuQXJy
+YXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAEdwQAAAAKc3EAfgCAc3EAfgCFAAAAAncEAAAA
+CnNyABZvcmcuZHJvb2xzLnJ1bGUuQ29sdW1uAAAAAAAAAUACAAVJAAVpbmRleEkABm9mZnNldEwA
+C2NvbnN0cmFpbnRzcQB+AIJMAAtkZWNsYXJhdGlvbnQAHUxvcmcvZHJvb2xzL3J1bGUvRGVjbGFy
+YXRpb247TAAKb2JqZWN0VHlwZXEAfgBAeHAAAAAAAAAAAHNxAH4AhQAAAAF3BAAAAAFzcgAhb3Jn
+LmRyb29scy5ydWxlLkxpdGVyYWxDb25zdHJhaW50AAAAAAAAAUACAAJMAAlleHRyYWN0b3J0AB9M
+b3JnL2Ryb29scy9zcGkvRmllbGRFeHRyYWN0b3I7TAALcmVzdHJpY3Rpb250ACRMb3JnL2Ryb29s
+cy9ydWxlL0xpdGVyYWxSZXN0cmljdGlvbjt4cHNyACNvcmcuZHJvb2xzLmJhc2UuQ2xhc3NGaWVs
+ZEV4dHJhY3RvcgAAAAAAAAFAAgACTAAFY2xhenpxAH4AL0wACWZpZWxkTmFtZXEAfgA4eHBxAH4A
+M3QACG1lc3NhZ2Uxc3IAIm9yZy5kcm9vbHMucnVsZS5MaXRlcmFsUmVzdHJpY3Rpb24AAAAAAAAB
+QAIAA0wADGNvbnRleHRFbnRyeXQAOExvcmcvZHJvb2xzL3J1bGUvTGl0ZXJhbFJlc3RyaWN0aW9u
+JExpdGVyYWxDb250ZXh0RW50cnk7TAAJZXZhbHVhdG9ydAAaTG9yZy9kcm9vbHMvc3BpL0V2YWx1
+YXRvcjtMAAVmaWVsZHQAG0xvcmcvZHJvb2xzL3NwaS9GaWVsZFZhbHVlO3hwc3IANm9yZy5kcm9v
+bHMucnVsZS5MaXRlcmFsUmVzdHJpY3Rpb24kTGl0ZXJhbENvbnRleHRFbnRyeSRivCFU8WMrAgAD
+TAAJZXh0cmFjdG9ycQB+AI5MAARuZXh0dAAeTG9yZy9kcm9vbHMvcnVsZS9Db250ZXh0RW50cnk7
+TAAGb2JqZWN0cQB+ACt4cHEAfgCScHBzcgA9b3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3Ry
+aW5nRmFjdG9yeSRTdHJpbmdFcXVhbEV2YWx1YXRvcgAAAAAAAAFAAgAAeHIAHW9yZy5kcm9vbHMu
+YmFzZS5CYXNlRXZhbHVhdG9yKrR6Du2xfrYCAAJMAAhvcGVyYXRvcnQAJUxvcmcvZHJvb2xzL2Jh
+c2UvZXZhbHVhdG9ycy9PcGVyYXRvcjtMAAR0eXBlcQB+ADB4cHNyACNvcmcuZHJvb2xzLmJhc2Uu
+ZXZhbHVhdG9ycy5PcGVyYXRvcgAAAAAAAAFAAgABTAAIb3BlcmF0b3JxAH4AOHhwdAACPT1zcQB+
+ADZ2cgAQamF2YS5sYW5nLlN0cmluZ6DwpDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2
+YWx1YXRvcnMuU3RyaW5nRmFjdG9yeeeM/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRyb29s
+cy5iYXNlLmZpZWxkLk9iamVjdEZpZWxkSW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AK3hwdAAD
+T25leHBzcQB+AC4BcQB+ADN2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAA
+AAAAAHhwcQB+ADlzcQB+AIkAAAABAAAAAHNxAH4AhQAAAAF3BAAAAAFzcQB+AI1zcQB+AJFxAH4A
+M3QACG1lc3NhZ2Uyc3EAfgCUc3EAfgCZcQB+ALJwcHEAfgCfc3EAfgCpdAADVHdveHBzcQB+AC4B
+cQB+ADN2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADl4
+c3IAEm9yZy5kcm9vbHMucnVsZS5PchUXh4ABXbcjAgAAeHEAfgCBc3EAfgCFAAAAAncEAAAACnNx
+AH4AiQAAAAIAAAAAc3EAfgCFAAAAAXcEAAAAAXNxAH4AjXEAfgCyc3EAfgCUc3EAfgCZcQB+ALJw
+cHEAfgCfc3EAfgCpcQB+AKt4cHNxAH4ALgFxAH4AM3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFk
+b3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AOXNxAH4AiQAAAAP/////c3EAfgCFAAAAAXcEAAAAAXNx
+AH4AjXEAfgCyc3EAfgCUc3EAfgCZcQB+ALJwcHEAfgCfc3EAfgCpcQB+ALd4cHNxAH4ALgFxAH4A
+M3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AOXhzcQB+
+ALtzcQB+AIUAAAACdwQAAAAKc3EAfgCJAAAABP////9zcQB+AIUAAAABdwQAAAABc3EAfgCNc3EA
+fgCRcQB+ADN0AAhtZXNzYWdlM3NxAH4AlHNxAH4AmXEAfgDVcHBxAH4An3NxAH4AqXEAfgCreHBz
+cQB+AC4BcQB+ADN2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhw
+cQB+ADlzcQB+AIkAAAAF/////nNxAH4AhQAAAAF3BAAAAAFzcQB+AI1xAH4A1XNxAH4AlHNxAH4A
+mXEAfgDVcHBxAH4An3NxAH4AqXQABVRocmVleHBzcQB+AC4BcQB+ADN2cgAdb3JnLmRyb29scy5N
+ZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADl4c3IAHW9yZy5kcm9vbHMucnVsZS5F
+dmFsQ29uZGl0aW9uPircDHKDjxYCAAJMAApleHByZXNzaW9udAAfTG9yZy9kcm9vbHMvc3BpL0V2
+YWxFeHByZXNzaW9uO1sAFHJlcXVpcmVkRGVjbGFyYXRpb25zcQB+AHV4cQB+AINzcgAyb3JnLmRy
+b29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8yXzBFdmFsMEludm9rZXIAAAAAAAABQAIAAHhw
+dXEAfgB9AAAAAHh0AA1IZWxsbyBXb3JsZCAycHEAfgBwcQB+AOlwcQB+AG1xAH4AaHBzcQB+AHMA
+AAAAAAAAAAEAAAAAAAFwcQB+AHpzcgA4b3JnLmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3Js
+ZF8xXzBDb25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIAAHhwdXEAfgB9AAAAAHNxAH4ADT9AAAAA
+AAAMdwgAAAAQAAAAAHhwc3EAfgCAc3EAfgCFAAAAA3cEAAAACnNxAH4AgHNxAH4AhQAAAAJ3BAAA
+AApzcQB+AIkAAAAAAAAAAHNxAH4AhQAAAAF3BAAAAAFzcQB+AI1xAH4AknNxAH4AlHNxAH4AmXEA
+fgCScHBxAH4An3NxAH4AqXEAfgCreHBxAH4AMXNxAH4AiQAAAAEAAAAAc3EAfgCFAAAAAXcEAAAA
+AXNxAH4AjXEAfgCyc3EAfgCUc3EAfgCZcQB+ALJwcHEAfgCfc3EAfgCpcQB+ALd4cHNxAH4ALgFx
+AH4AM3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AOXhz
+cQB+ALtzcQB+AIUAAAACdwQAAAAKc3EAfgCJAAAAAgAAAABzcQB+AIUAAAABdwQAAAABc3EAfgCN
+cQB+ALJzcQB+AJRzcQB+AJlxAH4AsnBwcQB+AJ9zcQB+AKlxAH4Aq3hwc3EAfgAuAXEAfgAzdnIA
+HW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgA5c3EAfgCJAAAA
+A/////9zcQB+AIUAAAABdwQAAAABc3EAfgCNcQB+ALJzcQB+AJRzcQB+AJlxAH4AsnBwcQB+AJ9z
+cQB+AKlxAH4At3hwc3EAfgAuAXEAfgAzdnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5
+AAAAAAAAAAAAAAB4cHEAfgA5eHNxAH4Au3NxAH4AhQAAAAJ3BAAAAApzcQB+AIkAAAAE/////3Nx
+AH4AhQAAAAF3BAAAAAFzcQB+AI1xAH4A1XNxAH4AlHNxAH4AmXEAfgDVcHBxAH4An3NxAH4AqXEA
+fgCreHBzcQB+AC4BcQB+ADN2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAA
+AAAAAHhwcQB+ADlzcQB+AIkAAAAF/////nNxAH4AhQAAAAF3BAAAAAFzcQB+AI1xAH4A1XNxAH4A
+lHNxAH4AmXEAfgDVcHBxAH4An3NxAH4AqXEAfgDjeHBzcQB+AC4BcQB+ADN2cgAdb3JnLmRyb29s
+cy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADl4eHQADUhlbGxvIFdvcmxkIDFw
+cQB+AGhxAH4AcHNyACZvcmcuZHJvb2xzLmNvbW1vbi5FbXB0eUJldGFDb25zdHJhaW50cwAAAAAA
+AAFAAgAAeHBxAH4AZXNxAH4AWgAAAAAPAAAAAXNxAH4AYHNxAH4AYwAAAAJzcQB+AGsAAAAAEAAA
+AABzcQB+AG4BAAAAFwAAAABzcQB+AFdzcQB+AGsAAAAAGAAAAABwcHEAfgB5cQB+ATVxAH4A6XBx
+AH4BNHEAfgExcHEAfgDucQB+ATFxAH4BNXEAfgEwc3EAfgBaAAAAAA4AAAADc3EAfgBgc3EAfgBj
+AAAAAnEAfgExc3EAfgBaAAAAABEAAAABc3EAfgBgc3EAfgBjAAAAAnNxAH4AawAAAAASAAAAAHNx
+AH4AbgEAAAAZAAAAAHNxAH4AV3NxAH4AawAAAAAaAAAAAHBwcQB+AHlxAH4BP3EAfgDpcHEAfgE+
+cQB+ATtwcQB+AO5xAH4BO3EAfgE/cQB+ATBxAH4BOHBwc3EAfgBaAAAAAAwAAAABc3EAfgBgc3EA
+fgBjAAAAAnNxAH4AawAAAAANAAAAAHNxAH4AbgEAAAAVAAAAAHNxAH4AV3NxAH4AawAAAAAWAAAA
+AHBwcQB+AHlxAH4BRnEAfgDpcHEAfgFFcQB+AUJwcQB+AO5xAH4BQnEAfgFGcQB+ATBxAH4AZXEA
+fgE7cHBxAH4AaHNxAH4ATQEAAAALAAAAAwAAAANxAH4AQnNxAH4AQwAAAANzcQB+AEgAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAHBwcHBzcQB+AEoAAAACcQB+AUJxAH4BO3EAfgEncHNxAH4ATQEA
+AAAIAAAAAwAAAANxAH4AQnNxAH4AQwAAAANzcQB+AEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AHBwcHBzcQB+AEoAAAACcQB+AGhxAH4BMXEAfgEecQB+AUlzcQB+AE0BAAAABgAAAAMAAAADcQB+
+AEJzcQB+AFBxAH4AZXEAfgEKcQB+AU1zcQB+AE0BAAAABAAAAAsAAAADcQB+AEJzcQB+AEMAAAAD
+c3EAfgBIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwcHBwc3EAfgBKAAAAAnEAfgBfcQB+AThx
+AH4A/3EAfgFRcQB+AE9xAH4BMXEAfgFJcQB+ATBxAH4AX3BwcQB+AF9xAH4AZXEAfgFTcHEAfgE7
+cQB+AGhwcQB+AU1xAH4BQnBwcQB+AU1xAH4BQnEAfgEwcQB+AF9wcQB+AThwcHEAfgFRcQB+AThx
+AH4BMHEAfgBWcQB+AThwcHBxAH4BU3BxAH4AT3BxAH4A+XEAfgFTcHEAfgFJc3IAGm9yZy5kcm9v
+bHMudXRpbC5MaW5rZWRMaXN0AAAAAAAAAUACAARJAARzaXplTAAJZmlyc3ROb2RldAAgTG9yZy9k
+cm9vbHMvdXRpbC9MaW5rZWRMaXN0Tm9kZTtMAAhpdGVyYXRvcnQAL0xvcmcvZHJvb2xzL3V0aWwv
+TGlua2VkTGlzdCRMaW5rZWRMaXN0SXRlcmF0b3I7TAAIbGFzdE5vZGVxAH4BWHhwAAAAA3NyADdv
+cmcuZHJvb2xzLnJldGVvby5Db21wb3NpdGVPYmplY3RTaW5rQWRhcHRlciRGaWVsZEluZGV4NXsf
+4rdO8JQCAAZJAAVjb3VudFoABmhhc2hlZEkABWluZGV4TAANZmllbGRFeHRhY3RvcnEAfgCOTAAE
+bmV4dHEAfgFYTAAIcHJldmlvdXNxAH4BWHhwAAAAAQAAAAACcQB+AJJzcQB+AVsAAAACAAAAAANx
+AH4AsnNxAH4BWwAAAAIAAAAABHEAfgDVcHEAfgFdcQB+AVxwc3IALW9yZy5kcm9vbHMudXRpbC5M
+aW5rZWRMaXN0JExpbmtlZExpc3RJdGVyYXRvcvzF4DzRBqf5AgADTAAHY3VycmVudHEAfgFYTAAE
+bGlzdHEAfgBGTAAGdGhpcyQwcQB+AEZ4cHBwcQB+AVpxAH4BXnBwcQB+ADFxAH4AHXBwcHBwcHBw
+cHBzcgAfb3JnLmRyb29scy5yZXRlb28uUmV0ZW9vQnVpbGRlchgdWfuPyAPwAgAJSQAXY3VycmVu
+dE9mZnNldEFkanVzdG1lbnRJAAJpZFoAEHJlbW92ZUlkZW50aXRpZXNMAA1hdHRhY2hlZE5vZGVz
+cQB+AHZMAAxkZWNsYXJhdGlvbnNxAH4AdkwADG9iamVjdFNvdXJjZXEAfgAaTAAKb2JqZWN0VHlw
+ZXEAfgB2TAAFcnVsZXNxAH4AdkwAC3R1cGxlU291cmNlcQB+AF14cAAAAAAAAAAbAHNxAH4ADT9A
+AAAAAAAYdwgAAAAgAAAAEnEAfgFRcQB+AVFxAH4BU3EAfgFTcQB+AUZxAH4BRnEAfgBocQB+AGhx
+AH4BQnEAfgFCcQB+AEJxAH4AQnEAfgBfcQB+AF9xAH4BMXEAfgExcQB+AGVxAH4AZXEAfgE/cQB+
+AT9xAH4AT3EAfgBPcQB+AFZxAH4AVnEAfgE4cQB+AThxAH4AcHEAfgBwcQB+ATVxAH4BNXEAfgFJ
+cQB+AUlxAH4BO3EAfgE7cQB+AU1xAH4BTXhzcQB+AA0/QAAAAAAADHcIAAAAEAAAAAB4cQB+AUlz
+cgAXamF2YS51dGlsLkxpbmtlZEhhc2hNYXA0wE5cEGzA+wIAAVoAC2FjY2Vzc09yZGVyeHEAfgAN
+P0AAAAAAAAx3CAAAABAAAAAAeABzcQB+AA0/QAAAAAAADHcIAAAAEAAAAAJxAH4A7nVyAB1bTG9y
+Zy5kcm9vbHMuY29tbW9uLkJhc2VOb2RlO3gP5nV9Cv4lAgAAeHAAAAAEcQB+AG1xAH4BRXEAfgE0
+cQB+AT5xAH4AeXVxAH4BaAAAAARxAH4AcnEAfgFIcQB+ATdxAH4BQXhxAH4BPw==</byte-array>
+</org.drools.reteoo.ReteooRuleBase>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,657 @@
+<org.drools.reteoo.ReteooRuleBase>
+  <map>
+    <entry>
+      <string>org.drools.reteoo</string>
+      <org.drools.rule.Package>
+        <org.drools.rule.PackageCompilationData>
+          <map>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_2_0.class</string>
+              <byte-array>yv66vgAAADAAKgcAAgEAJm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wBwAE
+AQAQamF2YS9sYW5nL09iamVjdAEAEHNlcmlhbFZlcnNpb25VSUQBAAFKAQANQ29uc3RhbnRWYWx1
+ZQUAAAAAAAABQAEABjxpbml0PgEAAygpVgEABENvZGUKAAMADgwACgALAQAPTGluZU51bWJlclRh
+YmxlAQASTG9jYWxWYXJpYWJsZVRhYmxlAQAEdGhpcwEAKExvcmcvZHJvb2xzL3JldGVvby9SdWxl
+X0hlbGxvX1dvcmxkXzJfMDsBAAtjb25zZXF1ZW5jZQEAIyhMb3JnL2Ryb29scy9zcGkvS25vd2xl
+ZGdlSGVscGVyOylWAQAKRXhjZXB0aW9ucwcAFwEAE2phdmEvbGFuZy9FeGNlcHRpb24JABkAGwcA
+GgEAEGphdmEvbGFuZy9TeXN0ZW0MABwAHQEAA291dAEAFUxqYXZhL2lvL1ByaW50U3RyZWFtOwgA
+HwEABmRvbmUgMQoAIQAjBwAiAQATamF2YS9pby9QcmludFN0cmVhbQwAJAAlAQAHcHJpbnRsbgEA
+FShMamF2YS9sYW5nL1N0cmluZzspVgEABmRyb29scwEAIExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7AQAKU291cmNlRmlsZQEAGVJ1bGVfSGVsbG9fV29ybGRfMl8wLmphdmEAIQABAAMA
+AAABABoABQAGAAEABwAAAAIACAACAAEACgALAAEADAAAAC8AAQABAAAABSq3AA2xAAAAAgAPAAAA
+BgABAAAABwAQAAAADAABAAAABQARABIAAAAJABMAFAACABUAAAAEAAEAFgAMAAAANwACAAEAAAAJ
+sgAYEh62ACCxAAAAAgAPAAAACgACAAAACgAIAAsAEAAAAAwAAQAAAAkAJgAnAAAAAQAoAAAAAgAp
+</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_1_0.class</string>
+              <byte-array>yv66vgAAADAAKgcAAgEAJm9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMV8wBwAE
+AQAQamF2YS9sYW5nL09iamVjdAEAEHNlcmlhbFZlcnNpb25VSUQBAAFKAQANQ29uc3RhbnRWYWx1
+ZQUAAAAAAAABQAEABjxpbml0PgEAAygpVgEABENvZGUKAAMADgwACgALAQAPTGluZU51bWJlclRh
+YmxlAQASTG9jYWxWYXJpYWJsZVRhYmxlAQAEdGhpcwEAKExvcmcvZHJvb2xzL3JldGVvby9SdWxl
+X0hlbGxvX1dvcmxkXzFfMDsBAAtjb25zZXF1ZW5jZQEAIyhMb3JnL2Ryb29scy9zcGkvS25vd2xl
+ZGdlSGVscGVyOylWAQAKRXhjZXB0aW9ucwcAFwEAE2phdmEvbGFuZy9FeGNlcHRpb24JABkAGwcA
+GgEAEGphdmEvbGFuZy9TeXN0ZW0MABwAHQEAA291dAEAFUxqYXZhL2lvL1ByaW50U3RyZWFtOwgA
+HwEABmRvbmUgMQoAIQAjBwAiAQATamF2YS9pby9QcmludFN0cmVhbQwAJAAlAQAHcHJpbnRsbgEA
+FShMamF2YS9sYW5nL1N0cmluZzspVgEABmRyb29scwEAIExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7AQAKU291cmNlRmlsZQEAGVJ1bGVfSGVsbG9fV29ybGRfMV8wLmphdmEAIQABAAMA
+AAABABoABQAGAAEABwAAAAIACAACAAEACgALAAEADAAAAC8AAQABAAAABSq3AA2xAAAAAgAPAAAA
+BgABAAAABwAQAAAADAABAAAABQARABIAAAAJABMAFAACABUAAAAEAAEAFgAMAAAANwACAAEAAAAJ
+sgAYEh62ACCxAAAAAgAPAAAACgACAAAACgAIAAsAEAAAAAwAAQAAAAkAJgAnAAAAAQAoAAAAAgAp
+</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_2_0ConsequenceInvoker.class</string>
+              <byte-array>yv66vgAAADAAOAcAAgEAOG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMl8wQ29u
+c2VxdWVuY2VJbnZva2VyBwAEAQAQamF2YS9sYW5nL09iamVjdAcABgEAGm9yZy9kcm9vbHMvc3Bp
+L0NvbnNlcXVlbmNlAQAQc2VyaWFsVmVyc2lvblVJRAEAAUoBAA1Db25zdGFudFZhbHVlBQAAAAAA
+AAFAAQAGPGluaXQ+AQADKClWAQAEQ29kZQoAAwAQDAAMAA0BAA9MaW5lTnVtYmVyVGFibGUBABJM
+b2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQA6TG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9f
+V29ybGRfMl8wQ29uc2VxdWVuY2VJbnZva2VyOwEACGV2YWx1YXRlAQA9KExvcmcvZHJvb2xzL3Nw
+aS9Lbm93bGVkZ2VIZWxwZXI7TG9yZy9kcm9vbHMvV29ya2luZ01lbW9yeTspVgEACkV4Y2VwdGlv
+bnMHABkBABNqYXZhL2xhbmcvRXhjZXB0aW9uCwAbAB0HABwBAB5vcmcvZHJvb2xzL3NwaS9Lbm93
+bGVkZ2VIZWxwZXIMAB4AHwEACGdldFR1cGxlAQAYKClMb3JnL2Ryb29scy9zcGkvVHVwbGU7CwAb
+ACEMACIAIwEAB2dldFJ1bGUBABgoKUxvcmcvZHJvb2xzL3J1bGUvUnVsZTsKACUAJwcAJgEAFG9y
+Zy9kcm9vbHMvcnVsZS9SdWxlDAAoACkBAA9nZXREZWNsYXJhdGlvbnMBACAoKVtMb3JnL2Ryb29s
+cy9ydWxlL0RlY2xhcmF0aW9uOwoAKwAtBwAsAQAmb3JnL2Ryb29scy9yZXRlb28vUnVsZV9IZWxs
+b19Xb3JsZF8yXzAMAC4ALwEAC2NvbnNlcXVlbmNlAQAjKExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7KVYBAA9rbm93bGVkZ2VIZWxwZXIBACBMb3JnL2Ryb29scy9zcGkvS25vd2xlZGdl
+SGVscGVyOwEADXdvcmtpbmdNZW1vcnkBABpMb3JnL2Ryb29scy9Xb3JraW5nTWVtb3J5OwEABHJ1
+bGUBABZMb3JnL2Ryb29scy9ydWxlL1J1bGU7AQAKU291cmNlRmlsZQEAK1J1bGVfSGVsbG9fV29y
+bGRfMl8wQ29uc2VxdWVuY2VJbnZva2VyLmphdmEAIQABAAMAAQAFAAEAGgAHAAgAAQAJAAAAAgAK
+AAIAAQAMAA0AAQAOAAAALwABAAEAAAAFKrcAD7EAAAACABEAAAAGAAEAAAADABIAAAAMAAEAAAAF
+ABMAFAAAAAEAFQAWAAIAFwAAAAQAAQAYAA4AAAB0AAEABAAAABgruQAaAQBXK7kAIAEATi22ACRX
+K7gAKrEAAAACABEAAAAaAAYAAAAKAAcACwAOAAwAEwATABQAEgAXABYAEgAAACoABAAAABgAEwAU
+AAAAAAAYADAAMQABAAAAGAAyADMAAgAOAAoANAA1AAMAAQA2AAAAAgA3</byte-array>
+            </entry>
+            <entry>
+              <string>org/drools/reteoo/Rule_Hello_World_1_0ConsequenceInvoker.class</string>
+              <byte-array>yv66vgAAADAAOAcAAgEAOG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9fV29ybGRfMV8wQ29u
+c2VxdWVuY2VJbnZva2VyBwAEAQAQamF2YS9sYW5nL09iamVjdAcABgEAGm9yZy9kcm9vbHMvc3Bp
+L0NvbnNlcXVlbmNlAQAQc2VyaWFsVmVyc2lvblVJRAEAAUoBAA1Db25zdGFudFZhbHVlBQAAAAAA
+AAFAAQAGPGluaXQ+AQADKClWAQAEQ29kZQoAAwAQDAAMAA0BAA9MaW5lTnVtYmVyVGFibGUBABJM
+b2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQA6TG9yZy9kcm9vbHMvcmV0ZW9vL1J1bGVfSGVsbG9f
+V29ybGRfMV8wQ29uc2VxdWVuY2VJbnZva2VyOwEACGV2YWx1YXRlAQA9KExvcmcvZHJvb2xzL3Nw
+aS9Lbm93bGVkZ2VIZWxwZXI7TG9yZy9kcm9vbHMvV29ya2luZ01lbW9yeTspVgEACkV4Y2VwdGlv
+bnMHABkBABNqYXZhL2xhbmcvRXhjZXB0aW9uCwAbAB0HABwBAB5vcmcvZHJvb2xzL3NwaS9Lbm93
+bGVkZ2VIZWxwZXIMAB4AHwEACGdldFR1cGxlAQAYKClMb3JnL2Ryb29scy9zcGkvVHVwbGU7CwAb
+ACEMACIAIwEAB2dldFJ1bGUBABgoKUxvcmcvZHJvb2xzL3J1bGUvUnVsZTsKACUAJwcAJgEAFG9y
+Zy9kcm9vbHMvcnVsZS9SdWxlDAAoACkBAA9nZXREZWNsYXJhdGlvbnMBACAoKVtMb3JnL2Ryb29s
+cy9ydWxlL0RlY2xhcmF0aW9uOwoAKwAtBwAsAQAmb3JnL2Ryb29scy9yZXRlb28vUnVsZV9IZWxs
+b19Xb3JsZF8xXzAMAC4ALwEAC2NvbnNlcXVlbmNlAQAjKExvcmcvZHJvb2xzL3NwaS9Lbm93bGVk
+Z2VIZWxwZXI7KVYBAA9rbm93bGVkZ2VIZWxwZXIBACBMb3JnL2Ryb29scy9zcGkvS25vd2xlZGdl
+SGVscGVyOwEADXdvcmtpbmdNZW1vcnkBABpMb3JnL2Ryb29scy9Xb3JraW5nTWVtb3J5OwEABHJ1
+bGUBABZMb3JnL2Ryb29scy9ydWxlL1J1bGU7AQAKU291cmNlRmlsZQEAK1J1bGVfSGVsbG9fV29y
+bGRfMV8wQ29uc2VxdWVuY2VJbnZva2VyLmphdmEAIQABAAMAAQAFAAEAGgAHAAgAAQAJAAAAAgAK
+AAIAAQAMAA0AAQAOAAAALwABAAEAAAAFKrcAD7EAAAACABEAAAAGAAEAAAADABIAAAAMAAEAAAAF
+ABMAFAAAAAEAFQAWAAIAFwAAAAQAAQAYAA4AAAB0AAEABAAAABgruQAaAQBXK7kAIAEATi22ACRX
+K7gAKrEAAAACABEAAAAaAAYAAAAKAAcACwAOAAwAEwATABQAEgAXABYAEgAAACoABAAAABgAEwAU
+AAAAAAAYADAAMQABAAAAGAAyADMAAgAOAAoANAA1AAMAAQA2AAAAAgA3</byte-array>
+            </entry>
+          </map>
+          <null/>
+          <byte-array>rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVz
+aG9sZHhwP0AAAAAAAAx3CAAAABAAAAACdAA4b3JnLmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19X
+b3JsZF8xXzBDb25zZXF1ZW5jZUludm9rZXJzcgAUb3JnLmRyb29scy5ydWxlLlJ1bGUAAAAAAAAB
+QAIADloACWF1dG9Gb2N1c0oACWxvYWRPcmRlcloABm5vTG9vcEkACHNhbGllbmNlWgARc2VtYW50
+aWNhbGx5VmFsaWRMAA9BY3RpdmF0aW9uR3JvdXB0ABJMamF2YS9sYW5nL1N0cmluZztMAAthZ2Vu
+ZGFHcm91cHEAfgAETAALY29uc2VxdWVuY2V0ABxMb3JnL2Ryb29scy9zcGkvQ29uc2VxdWVuY2U7
+WwAQZGVjbGFyYXRpb25BcnJheXQAHltMb3JnL2Ryb29scy9ydWxlL0RlY2xhcmF0aW9uO0wADGRl
+Y2xhcmF0aW9uc3QAD0xqYXZhL3V0aWwvTWFwO0wACGR1cmF0aW9udAAZTG9yZy9kcm9vbHMvc3Bp
+L0R1cmF0aW9uO0wAB2xoc1Jvb3R0ABVMb3JnL2Ryb29scy9ydWxlL0FuZDtMAARuYW1lcQB+AARM
+AANwa2dxAH4ABHhwAAAAAAAAAAABAAAAAAABcHQABE1BSU5zcgA4b3JnLmRyb29scy5yZXRlb28u
+UnVsZV9IZWxsb19Xb3JsZF8xXzBDb25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIAAHhwdXIAHltM
+b3JnLmRyb29scy5ydWxlLkRlY2xhcmF0aW9uO/Wnzws0aCnjAgAAeHAAAAAAc3EAfgAAP0AAAAAA
+AAx3CAAAABAAAAAAeHBzcgATb3JnLmRyb29scy5ydWxlLkFuZPz45yLwpsN2AgAAeHIAHG9yZy5k
+cm9vbHMucnVsZS5Hcm91cEVsZW1lbnTG3JO/b7XpWAIAAUwACGNoaWxkcmVudAAQTGphdmEvdXRp
+bC9MaXN0O3hyACJvcmcuZHJvb2xzLnJ1bGUuQ29uZGl0aW9uYWxFbGVtZW50xgxz6WbzojYCAAB4
+cHNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAADdwQAAAAKc3EA
+fgARc3EAfgAWAAAAAncEAAAACnNyABZvcmcuZHJvb2xzLnJ1bGUuQ29sdW1uAAAAAAAAAUACAAVJ
+AAVpbmRleEkABm9mZnNldEwAC2NvbnN0cmFpbnRzcQB+ABNMAAtkZWNsYXJhdGlvbnQAHUxvcmcv
+ZHJvb2xzL3J1bGUvRGVjbGFyYXRpb247TAAKb2JqZWN0VHlwZXQAG0xvcmcvZHJvb2xzL3NwaS9P
+YmplY3RUeXBlO3hwAAAAAAAAAABzcQB+ABYAAAABdwQAAAABc3IAIW9yZy5kcm9vbHMucnVsZS5M
+aXRlcmFsQ29uc3RyYWludAAAAAAAAAFAAgACTAAJZXh0cmFjdG9ydAAfTG9yZy9kcm9vbHMvc3Bp
+L0ZpZWxkRXh0cmFjdG9yO0wAC3Jlc3RyaWN0aW9udAAkTG9yZy9kcm9vbHMvcnVsZS9MaXRlcmFs
+UmVzdHJpY3Rpb247eHBzcgAjb3JnLmRyb29scy5iYXNlLkNsYXNzRmllbGRFeHRyYWN0b3IAAAAA
+AAABQAIAAkwABWNsYXp6dAARTGphdmEvbGFuZy9DbGFzcztMAAlmaWVsZE5hbWVxAH4ABHhwdnIA
+Em9yZy5kcm9vbHMuTWVzc2FnZQAAAAAAAAAAAAAAeHB0AAhtZXNzYWdlMXNyACJvcmcuZHJvb2xz
+LnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9uAAAAAAAAAUACAANMAAxjb250ZXh0RW50cnl0ADhMb3Jn
+L2Ryb29scy9ydWxlL0xpdGVyYWxSZXN0cmljdGlvbiRMaXRlcmFsQ29udGV4dEVudHJ5O0wACWV2
+YWx1YXRvcnQAGkxvcmcvZHJvb2xzL3NwaS9FdmFsdWF0b3I7TAAFZmllbGR0ABtMb3JnL2Ryb29s
+cy9zcGkvRmllbGRWYWx1ZTt4cHNyADZvcmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9u
+JExpdGVyYWxDb250ZXh0RW50cnkkYrwhVPFjKwIAA0wACWV4dHJhY3RvcnEAfgAgTAAEbmV4dHQA
+HkxvcmcvZHJvb2xzL3J1bGUvQ29udGV4dEVudHJ5O0wABm9iamVjdHQAEkxqYXZhL2xhbmcvT2Jq
+ZWN0O3hwcQB+ACVwcHNyAD1vcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5TdHJpbmdGYWN0b3J5
+JFN0cmluZ0VxdWFsRXZhbHVhdG9yAAAAAAAAAUACAAB4cgAdb3JnLmRyb29scy5iYXNlLkJhc2VF
+dmFsdWF0b3IqtHoO7bF+tgIAAkwACG9wZXJhdG9ydAAlTG9yZy9kcm9vbHMvYmFzZS9ldmFsdWF0
+b3JzL09wZXJhdG9yO0wABHR5cGV0ABtMb3JnL2Ryb29scy9iYXNlL1ZhbHVlVHlwZTt4cHNyACNv
+cmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5PcGVyYXRvcgAAAAAAAAFAAgABTAAIb3BlcmF0b3Jx
+AH4ABHhwdAACPT1zcgAZb3JnLmRyb29scy5iYXNlLlZhbHVlVHlwZQAAAAAAAAFAAgADTAAJY2xh
+c3NUeXBlcQB+ACRMABBldmFsdWF0b3JGYWN0b3J5dAAtTG9yZy9kcm9vbHMvYmFzZS9ldmFsdWF0
+b3JzL0V2YWx1YXRvckZhY3Rvcnk7TAAEbmFtZXEAfgAEeHB2cgAQamF2YS5sYW5nLlN0cmluZ6Dw
+pDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3RyaW5nRmFjdG9yeeeM
+/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRyb29scy5iYXNlLmZpZWxkLk9iamVjdEZpZWxk
+SW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AMHhwdAADT25leHBzcgAfb3JnLmRyb29scy5iYXNl
+LkNsYXNzT2JqZWN0VHlwZQAAAAAAAAFAAgAEWgANc2hhZG93RW5hYmxlZEwAD29iamVjdFR5cGVD
+bGFzc3EAfgAkTAALc2hhZG93Q2xhc3NxAH4AJEwACXZhbHVlVHlwZXEAfgA1eHABcQB+ACd2cgAd
+b3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwc3EAfgA6dnIAEGphdmEu
+bGFuZy5PYmplY3QAAAAAAAAAAAAAAHhwc3IAKG9yZy5kcm9vbHMuYmFzZS5ldmFsdWF0b3JzLk9i
+amVjdEZhY3RvcnmJYnOb3hlWOQIAAHhwdAAGT2JqZWN0c3EAfgAaAAAAAQAAAABzcQB+ABYAAAAB
+dwQAAAABc3EAfgAfc3EAfgAjcQB+ACd0AAhtZXNzYWdlMnNxAH4AKXNxAH4ALnEAfgBScHBxAH4A
+NnNxAH4AQnQAA1R3b3hwc3EAfgBFAXEAfgAndnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1By
+b3h5AAAAAAAAAAAAAAB4cHEAfgBJeHNyABJvcmcuZHJvb2xzLnJ1bGUuT3IVF4eAAV23IwIAAHhx
+AH4AEnNxAH4AFgAAAAJ3BAAAAApzcQB+ABoAAAACAAAAAHNxAH4AFgAAAAF3BAAAAAFzcQB+AB9x
+AH4AUnNxAH4AKXNxAH4ALnEAfgBScHBxAH4ANnNxAH4AQnEAfgBEeHBzcQB+AEUBcQB+ACd2cgAd
+b3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AElzcQB+ABFzcQB+
+ABYAAAACdwQAAAAKc3EAfgAaAAAAAwAAAABzcQB+ABYAAAABdwQAAAABc3EAfgAfc3EAfgAjdnIA
+EW9yZy5kcm9vbHMuQ2hlZXNl74UCETtF/fUCAAJJAAVwcmljZUwABHR5cGVxAH4ABHhwdAAEdHlw
+ZXNxAH4AKXNxAH4ALnEAfgBscHBxAH4ANnNxAH4AQnQAB3N0aWx0b254cHNxAH4ARQFxAH4AbnZy
+ABxvcmcuZHJvb2xzLkNoZWVzZVNoYWRvd1Byb3h5kNzUvXeQCr4CAAVJAAhnZXRQcmljZVoADWdl
+dFByaWNlSXNTZXRaAAxnZXRUeXBlSXNTZXRMAAhkZWxlZ2F0ZXQAE0xvcmcvZHJvb2xzL0NoZWVz
+ZTtMAAdnZXRUeXBlcQB+AAR4cQB+AG1xAH4ASXNxAH4AGgAAAAQAAAAAc3EAfgAWAAAAAXcEAAAA
+AXNxAH4AH3EAfgBsc3EAfgApc3EAfgAucQB+AGxwcHEAfgA2c3EAfgBCdAAEYnJpZXhwc3EAfgBF
+AXEAfgBudnIAHG9yZy5kcm9vbHMuQ2hlZXNlU2hhZG93UHJveHmQ3NS9d5AKvgIABUkACGdldFBy
+aWNlWgANZ2V0UHJpY2VJc1NldFoADGdldFR5cGVJc1NldEwACGRlbGVnYXRlcQB+AHZMAAdnZXRU
+eXBlcQB+AAR4cQB+AG1xAH4ASXh4c3EAfgBbc3EAfgAWAAAAAncEAAAACnNxAH4AGgAAAAUAAAAA
+c3EAfgAWAAAAAXcEAAAAAXNxAH4AH3NxAH4AI3EAfgAndAAIbWVzc2FnZTNzcQB+AClzcQB+AC5x
+AH4Ah3BwcQB+ADZzcQB+AEJxAH4ARHhwc3EAfgBFAXEAfgAndnIAHW9yZy5kcm9vbHMuTWVzc2Fn
+ZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBJc3EAfgAaAAAABv////9zcQB+ABYAAAABdwQA
+AAABc3EAfgAfcQB+AIdzcQB+AClzcQB+AC5xAH4Ah3BwcQB+ADZzcQB+AEJ0AAVUaHJlZXhwc3EA
+fgBFAXEAfgAndnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEA
+fgBJeHh0AA1IZWxsbyBXb3JsZCAxcHQAOG9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29y
+bGRfMl8wQ29uc2VxdWVuY2VJbnZva2Vyc3EAfgADAAAAAAAAAAACAAAAAAABcHEAfgALc3IAOG9y
+Zy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8wQ29uc2VxdWVuY2VJbnZva2VyAAAA
+AAAAAUACAAB4cHVxAH4ADgAAAAFzcgAbb3JnLmRyb29scy5ydWxlLkRlY2xhcmF0aW9uA3M8AfIg
+69YCAANMAAZjb2x1bW50ABhMb3JnL2Ryb29scy9ydWxlL0NvbHVtbjtMAAlleHRyYWN0b3J0ABpM
+b3JnL2Ryb29scy9zcGkvRXh0cmFjdG9yO0wACmlkZW50aWZpZXJxAH4ABHhwc3EAfgAaAAAAAAAA
+AABzcQB+ABYAAAACdwQAAAACcQB+AKJzcQB+AB9xAH4AJXNxAH4AKXNxAH4ALnEAfgAlcHBxAH4A
+NnNxAH4AQnEAfgBEeHBzcQB+AEUBcQB+ACd2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJv
+eHkAAAAAAAAAAAAAAHhwcQB+AElxAH4AJXQACSRtZXNzYWdlMXNxAH4AAD9AAAAAAAAMdwgAAAAQ
+AAAAAXEAfgCscQB+AKJ4cHNxAH4AEXNxAH4AFgAAAAR3BAAAAApzcQB+ABFzcQB+ABYAAAACdwQA
+AAAKcQB+AKNzcQB+ABoAAAABAAAAAHNxAH4AFgAAAAF3BAAAAAFzcQB+AB9xAH4AUnNxAH4AKXNx
+AH4ALnEAfgBScHBxAH4ANnNxAH4AQnEAfgBXeHBzcQB+AEUBcQB+ACd2cgAdb3JnLmRyb29scy5N
+ZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEl4c3EAfgBbc3EAfgAWAAAAAncEAAAA
+CnNxAH4AGgAAAAIAAAAAc3EAfgAWAAAAAXcEAAAAAXNxAH4AH3EAfgBSc3EAfgApc3EAfgAucQB+
+AFJwcHEAfgA2c3EAfgBCcQB+AER4cHNxAH4ARQFxAH4AJ3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VT
+aGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4ASXNxAH4AEXNxAH4AFgAAAAJ3BAAAAApzcQB+ABoA
+AAADAAAAAHNxAH4AFgAAAAF3BAAAAAFzcQB+AB9xAH4AbHNxAH4AKXNxAH4ALnEAfgBscHBxAH4A
+NnNxAH4AQnEAfgBzeHBzcQB+AEUBcQB+AG52cgAcb3JnLmRyb29scy5DaGVlc2VTaGFkb3dQcm94
+eZDc1L13kAq+AgAFSQAIZ2V0UHJpY2VaAA1nZXRQcmljZUlzU2V0WgAMZ2V0VHlwZUlzU2V0TAAI
+ZGVsZWdhdGVxAH4AdkwAB2dldFR5cGVxAH4ABHhxAH4AbXEAfgBJc3EAfgAaAAAABAAAAABzcQB+
+ABYAAAABdwQAAAABc3EAfgAfcQB+AGxzcQB+AClzcQB+AC5xAH4AbHBwcQB+ADZzcQB+AEJxAH4A
+fnhwc3EAfgBFAXEAfgBudnIAHG9yZy5kcm9vbHMuQ2hlZXNlU2hhZG93UHJveHmQ3NS9d5AKvgIA
+BUkACGdldFByaWNlWgANZ2V0UHJpY2VJc1NldFoADGdldFR5cGVJc1NldEwACGRlbGVnYXRlcQB+
+AHZMAAdnZXRUeXBlcQB+AAR4cQB+AG1xAH4ASXh4c3EAfgBbc3EAfgAWAAAAAncEAAAACnNxAH4A
+GgAAAAUAAAAAc3EAfgAWAAAAAXcEAAAAAXNxAH4AH3EAfgCHc3EAfgApc3EAfgAucQB+AIdwcHEA
+fgA2c3EAfgBCcQB+AER4cHNxAH4ARQFxAH4AJ3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQ
+cm94eQAAAAAAAAAAAAAAeHBxAH4ASXNxAH4AGgAAAAb/////c3EAfgAWAAAAAXcEAAAAAXNxAH4A
+H3EAfgCHc3EAfgApc3EAfgAucQB+AIdwcHEAfgA2c3EAfgBCcQB+AJV4cHNxAH4ARQFxAH4AJ3Zy
+AB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4ASXhzcQB+AFtz
+cQB+ABYAAAACdwQAAAAKc3EAfgAaAAAAB/////9zcQB+ABYAAAABdwQAAAABc3EAfgAfc3EAfgAj
+dnIAEW9yZy5kcm9vbHMuUGVyc29uJKQvAhefuGYCAAlJAANhZ2VaAAVhbGl2ZUMAA3NleEwACmJp
+Z0RlY2ltYWx0ABZMamF2YS9tYXRoL0JpZ0RlY2ltYWw7TAAKYmlnSW50ZWdlcnQAFkxqYXZhL21h
+dGgvQmlnSW50ZWdlcjtMAARoYWlycQB+AARMAAVsaWtlc3EAfgAETAAEbmFtZXEAfgAETAAGc3Rh
+dHVzcQB+AAR4cHQABG5hbWVzcQB+AClzcQB+AC5xAH4A83BwcQB+ADZzcQB+AEJ0AARtYXJreHBz
+cQB+AEUBcQB+APd2cgAcb3JnLmRyb29scy5QZXJzb25TaGFkb3dQcm94efJLXAslFf7PAgATSQAG
+Z2V0QWdlWgALZ2V0QWdlSXNTZXRaABJnZXRCaWdEZWNpbWFsSXNTZXRaABJnZXRCaWdJbnRlZ2Vy
+SXNTZXRaAAxnZXRIYWlySXNTZXRaAA1nZXRMaWtlc0lzU2V0WgAMZ2V0TmFtZUlzU2V0QwAGZ2V0
+U2V4WgALZ2V0U2V4SXNTZXRaAA5nZXRTdGF0dXNJc1NldFoAB2lzQWxpdmVaAAxpc0FsaXZlSXNT
+ZXRMAAhkZWxlZ2F0ZXQAE0xvcmcvZHJvb2xzL1BlcnNvbjtMAA1nZXRCaWdEZWNpbWFscQB+APVM
+AA1nZXRCaWdJbnRlZ2VycQB+APZMAAdnZXRIYWlycQB+AARMAAhnZXRMaWtlc3EAfgAETAAHZ2V0
+TmFtZXEAfgAETAAJZ2V0U3RhdHVzcQB+AAR4cQB+APRxAH4ASXNxAH4AGgAAAAj////+c3EAfgAW
+AAAAAXcEAAAAAXNyACJvcmcuZHJvb2xzLnJ1bGUuVmFyaWFibGVDb25zdHJhaW50AAAAAAAAAUAC
+AAJMAA5maWVsZEV4dHJhY3RvcnEAfgAgTAALcmVzdHJpY3Rpb250ACVMb3JnL2Ryb29scy9ydWxl
+L1ZhcmlhYmxlUmVzdHJpY3Rpb247eHBxAH4A83NyACNvcmcuZHJvb2xzLnJ1bGUuVmFyaWFibGVS
+ZXN0cmljdGlvbgAAAAAAAAFAAgAETAAMY29udGV4dEVudHJ5dAA6TG9yZy9kcm9vbHMvcnVsZS9W
+YXJpYWJsZVJlc3RyaWN0aW9uJFZhcmlhYmxlQ29udGV4dEVudHJ5O0wAC2RlY2xhcmF0aW9ucQB+
+ABtMAAlldmFsdWF0b3JxAH4AK1sAFHJlcXVpcmVkRGVjbGFyYXRpb25zcQB+AAZ4cHNyAD5vcmcu
+ZHJvb2xzLnJ1bGUuVmFyaWFibGVSZXN0cmljdGlvbiRPYmplY3RWYXJpYWJsZUNvbnRleHRFbnRy
+eTIPBL4GE40VAgACTAAEbGVmdHEAfgAwTAAFcmlnaHRxAH4AMHhyADhvcmcuZHJvb2xzLnJ1bGUu
+VmFyaWFibGVSZXN0cmljdGlvbiRWYXJpYWJsZUNvbnRleHRFbnRyeQD/dR3MmHnsAgAFTAALZGVj
+bGFyYXRpb25xAH4AG0wABWVudHJ5cQB+AC9MAAlleHRyYWN0b3JxAH4AIEwABm9iamVjdHEAfgAw
+TAAJcmV0ZVR1cGxldAAdTG9yZy9kcm9vbHMvcmV0ZW9vL1JldGVUdXBsZTt4cHEAfgCicHEAfgDz
+cHBwcHEAfgCicQB+ADZ1cQB+AA4AAAABcQB+AKJ4cHNxAH4ARQFxAH4A93ZyABxvcmcuZHJvb2xz
+LlBlcnNvblNoYWRvd1Byb3h58ktcCyUV/s8CABNJAAZnZXRBZ2VaAAtnZXRBZ2VJc1NldFoAEmdl
+dEJpZ0RlY2ltYWxJc1NldFoAEmdldEJpZ0ludGVnZXJJc1NldFoADGdldEhhaXJJc1NldFoADWdl
+dExpa2VzSXNTZXRaAAxnZXROYW1lSXNTZXRDAAZnZXRTZXhaAAtnZXRTZXhJc1NldFoADmdldFN0
+YXR1c0lzU2V0WgAHaXNBbGl2ZVoADGlzQWxpdmVJc1NldEwACGRlbGVnYXRlcQB+AP9MAA1nZXRC
+aWdEZWNpbWFscQB+APVMAA1nZXRCaWdJbnRlZ2VycQB+APZMAAdnZXRIYWlycQB+AARMAAhnZXRM
+aWtlc3EAfgAETAAHZ2V0TmFtZXEAfgAETAAJZ2V0U3RhdHVzcQB+AAR4cQB+APRxAH4ASXh4dAAN
+SGVsbG8gV29ybGQgMnB4</byte-array>
+        </org.drools.rule.PackageCompilationData>
+        <string>org.drools.reteoo</string>
+        <list>
+          <string>org.drools.Message</string>
+          <string>org.drools.Cheese</string>
+          <string>org.drools.Person</string>
+          <string>org.drools.reteoo.*</string>
+          <string>java.lang.*</string>
+        </list>
+        <java.util.Collections-EmptyList/>
+        <java.util.Collections-EmptyMap/>
+        <byte-array>rO0ABXNyABdqYXZhLnV0aWwuTGlua2VkSGFzaE1hcDTATlwQbMD7AgABWgALYWNjZXNzT3JkZXJ4
+cgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4
+cD9AAAAAAAAMdwgAAAAQAAAAAnQADUhlbGxvIFdvcmxkIDFzcgAUb3JnLmRyb29scy5ydWxlLlJ1
+bGUAAAAAAAABQAIADloACWF1dG9Gb2N1c0oACWxvYWRPcmRlcloABm5vTG9vcEkACHNhbGllbmNl
+WgARc2VtYW50aWNhbGx5VmFsaWRMAA9BY3RpdmF0aW9uR3JvdXB0ABJMamF2YS9sYW5nL1N0cmlu
+ZztMAAthZ2VuZGFHcm91cHEAfgAFTAALY29uc2VxdWVuY2V0ABxMb3JnL2Ryb29scy9zcGkvQ29u
+c2VxdWVuY2U7WwAQZGVjbGFyYXRpb25BcnJheXQAHltMb3JnL2Ryb29scy9ydWxlL0RlY2xhcmF0
+aW9uO0wADGRlY2xhcmF0aW9uc3QAD0xqYXZhL3V0aWwvTWFwO0wACGR1cmF0aW9udAAZTG9yZy9k
+cm9vbHMvc3BpL0R1cmF0aW9uO0wAB2xoc1Jvb3R0ABVMb3JnL2Ryb29scy9ydWxlL0FuZDtMAARu
+YW1lcQB+AAVMAANwa2dxAH4ABXhwAAAAAAAAAAABAAAAAAABcHQABE1BSU5zcgA4b3JnLmRyb29s
+cy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8xXzBDb25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIA
+AHhwdXIAHltMb3JnLmRyb29scy5ydWxlLkRlY2xhcmF0aW9uO/Wnzws0aCnjAgAAeHAAAAAAc3EA
+fgABP0AAAAAAAAx3CAAAABAAAAAAeHBzcgATb3JnLmRyb29scy5ydWxlLkFuZPz45yLwpsN2AgAA
+eHIAHG9yZy5kcm9vbHMucnVsZS5Hcm91cEVsZW1lbnTG3JO/b7XpWAIAAUwACGNoaWxkcmVudAAQ
+TGphdmEvdXRpbC9MaXN0O3hyACJvcmcuZHJvb2xzLnJ1bGUuQ29uZGl0aW9uYWxFbGVtZW50xgxz
+6WbzojYCAAB4cHNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAD
+dwQAAAAKc3EAfgASc3EAfgAXAAAAAncEAAAACnNyABZvcmcuZHJvb2xzLnJ1bGUuQ29sdW1uAAAA
+AAAAAUACAAVJAAVpbmRleEkABm9mZnNldEwAC2NvbnN0cmFpbnRzcQB+ABRMAAtkZWNsYXJhdGlv
+bnQAHUxvcmcvZHJvb2xzL3J1bGUvRGVjbGFyYXRpb247TAAKb2JqZWN0VHlwZXQAG0xvcmcvZHJv
+b2xzL3NwaS9PYmplY3RUeXBlO3hwAAAAAAAAAABzcQB+ABcAAAABdwQAAAABc3IAIW9yZy5kcm9v
+bHMucnVsZS5MaXRlcmFsQ29uc3RyYWludAAAAAAAAAFAAgACTAAJZXh0cmFjdG9ydAAfTG9yZy9k
+cm9vbHMvc3BpL0ZpZWxkRXh0cmFjdG9yO0wAC3Jlc3RyaWN0aW9udAAkTG9yZy9kcm9vbHMvcnVs
+ZS9MaXRlcmFsUmVzdHJpY3Rpb247eHBzcgAjb3JnLmRyb29scy5iYXNlLkNsYXNzRmllbGRFeHRy
+YWN0b3IAAAAAAAABQAIAAkwABWNsYXp6dAARTGphdmEvbGFuZy9DbGFzcztMAAlmaWVsZE5hbWVx
+AH4ABXhwdnIAEm9yZy5kcm9vbHMuTWVzc2FnZQAAAAAAAAAAAAAAeHB0AAhtZXNzYWdlMXNyACJv
+cmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJlc3RyaWN0aW9uAAAAAAAAAUACAANMAAxjb250ZXh0RW50
+cnl0ADhMb3JnL2Ryb29scy9ydWxlL0xpdGVyYWxSZXN0cmljdGlvbiRMaXRlcmFsQ29udGV4dEVu
+dHJ5O0wACWV2YWx1YXRvcnQAGkxvcmcvZHJvb2xzL3NwaS9FdmFsdWF0b3I7TAAFZmllbGR0ABtM
+b3JnL2Ryb29scy9zcGkvRmllbGRWYWx1ZTt4cHNyADZvcmcuZHJvb2xzLnJ1bGUuTGl0ZXJhbFJl
+c3RyaWN0aW9uJExpdGVyYWxDb250ZXh0RW50cnkkYrwhVPFjKwIAA0wACWV4dHJhY3RvcnEAfgAh
+TAAEbmV4dHQAHkxvcmcvZHJvb2xzL3J1bGUvQ29udGV4dEVudHJ5O0wABm9iamVjdHQAEkxqYXZh
+L2xhbmcvT2JqZWN0O3hwcQB+ACZwcHNyAD1vcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5TdHJp
+bmdGYWN0b3J5JFN0cmluZ0VxdWFsRXZhbHVhdG9yAAAAAAAAAUACAAB4cgAdb3JnLmRyb29scy5i
+YXNlLkJhc2VFdmFsdWF0b3IqtHoO7bF+tgIAAkwACG9wZXJhdG9ydAAlTG9yZy9kcm9vbHMvYmFz
+ZS9ldmFsdWF0b3JzL09wZXJhdG9yO0wABHR5cGV0ABtMb3JnL2Ryb29scy9iYXNlL1ZhbHVlVHlw
+ZTt4cHNyACNvcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5PcGVyYXRvcgAAAAAAAAFAAgABTAAI
+b3BlcmF0b3JxAH4ABXhwdAACPT1zcgAZb3JnLmRyb29scy5iYXNlLlZhbHVlVHlwZQAAAAAAAAFA
+AgADTAAJY2xhc3NUeXBlcQB+ACVMABBldmFsdWF0b3JGYWN0b3J5dAAtTG9yZy9kcm9vbHMvYmFz
+ZS9ldmFsdWF0b3JzL0V2YWx1YXRvckZhY3Rvcnk7TAAEbmFtZXEAfgAFeHB2cgAQamF2YS5sYW5n
+LlN0cmluZ6DwpDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3RyaW5n
+RmFjdG9yeeeM/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRyb29scy5iYXNlLmZpZWxkLk9i
+amVjdEZpZWxkSW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AMXhwdAADT25leHBzcgAfb3JnLmRy
+b29scy5iYXNlLkNsYXNzT2JqZWN0VHlwZQAAAAAAAAFAAgAEWgANc2hhZG93RW5hYmxlZEwAD29i
+amVjdFR5cGVDbGFzc3EAfgAlTAALc2hhZG93Q2xhc3NxAH4AJUwACXZhbHVlVHlwZXEAfgA2eHAB
+cQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwc3EAfgA7
+dnIAEGphdmEubGFuZy5PYmplY3QAAAAAAAAAAAAAAHhwc3IAKG9yZy5kcm9vbHMuYmFzZS5ldmFs
+dWF0b3JzLk9iamVjdEZhY3RvcnmJYnOb3hlWOQIAAHhwdAAGT2JqZWN0c3EAfgAbAAAAAQAAAABz
+cQB+ABcAAAABdwQAAAABc3EAfgAgc3EAfgAkcQB+ACh0AAhtZXNzYWdlMnNxAH4AKnNxAH4AL3EA
+fgBTcHBxAH4AN3NxAH4AQ3QAA1R3b3hwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMuTWVzc2Fn
+ZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBKeHNyABJvcmcuZHJvb2xzLnJ1bGUuT3IVF4eA
+AV23IwIAAHhxAH4AE3NxAH4AFwAAAAJ3BAAAAApzcQB+ABsAAAACAAAAAHNxAH4AFwAAAAF3BAAA
+AAFzcQB+ACBxAH4AU3NxAH4AKnNxAH4AL3EAfgBTcHBxAH4AN3NxAH4AQ3EAfgBFeHBzcQB+AEYB
+cQB+ACh2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEpz
+cQB+ABJzcQB+ABcAAAACdwQAAAAKc3EAfgAbAAAAAwAAAABzcQB+ABcAAAABdwQAAAABc3EAfgAg
+c3EAfgAkdnIAEW9yZy5kcm9vbHMuQ2hlZXNl74UCETtF/fUCAAJJAAVwcmljZUwABHR5cGVxAH4A
+BXhwdAAEdHlwZXNxAH4AKnNxAH4AL3EAfgBtcHBxAH4AN3NxAH4AQ3QAB3N0aWx0b254cHNxAH4A
+RgFxAH4Ab3ZyABxvcmcuZHJvb2xzLkNoZWVzZVNoYWRvd1Byb3h5kNzUvXeQCr4CAAVJAAhnZXRQ
+cmljZVoADWdldFByaWNlSXNTZXRaAAxnZXRUeXBlSXNTZXRMAAhkZWxlZ2F0ZXQAE0xvcmcvZHJv
+b2xzL0NoZWVzZTtMAAdnZXRUeXBlcQB+AAV4cQB+AG5xAH4ASnNxAH4AGwAAAAQAAAAAc3EAfgAX
+AAAAAXcEAAAAAXNxAH4AIHEAfgBtc3EAfgAqc3EAfgAvcQB+AG1wcHEAfgA3c3EAfgBDdAAEYnJp
+ZXhwc3EAfgBGAXEAfgBvdnIAHG9yZy5kcm9vbHMuQ2hlZXNlU2hhZG93UHJveHmQ3NS9d5AKvgIA
+BUkACGdldFByaWNlWgANZ2V0UHJpY2VJc1NldFoADGdldFR5cGVJc1NldEwACGRlbGVnYXRlcQB+
+AHdMAAdnZXRUeXBlcQB+AAV4cQB+AG5xAH4ASnh4c3EAfgBcc3EAfgAXAAAAAncEAAAACnNxAH4A
+GwAAAAUAAAAAc3EAfgAXAAAAAXcEAAAAAXNxAH4AIHNxAH4AJHEAfgAodAAIbWVzc2FnZTNzcQB+
+ACpzcQB+AC9xAH4AiHBwcQB+ADdzcQB+AENxAH4ARXhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9v
+bHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgBKc3EAfgAbAAAABv////9zcQB+
+ABcAAAABdwQAAAABc3EAfgAgcQB+AIhzcQB+ACpzcQB+AC9xAH4AiHBwcQB+ADdzcQB+AEN0AAVU
+aHJlZXhwc3EAfgBGAXEAfgAodnIAHW9yZy5kcm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAA
+AAAAAAB4cHEAfgBKeHhxAH4AA3B0AA1IZWxsbyBXb3JsZCAyc3EAfgAEAAAAAAAAAAACAAAAAAAB
+cHEAfgAMc3IAOG9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8wQ29uc2VxdWVu
+Y2VJbnZva2VyAAAAAAAAAUACAAB4cHVxAH4ADwAAAAFzcgAbb3JnLmRyb29scy5ydWxlLkRlY2xh
+cmF0aW9uA3M8AfIg69YCAANMAAZjb2x1bW50ABhMb3JnL2Ryb29scy9ydWxlL0NvbHVtbjtMAAll
+eHRyYWN0b3J0ABpMb3JnL2Ryb29scy9zcGkvRXh0cmFjdG9yO0wACmlkZW50aWZpZXJxAH4ABXhw
+c3EAfgAbAAAAAAAAAABzcQB+ABcAAAACdwQAAAACcQB+AKJzcQB+ACBxAH4AJnNxAH4AKnNxAH4A
+L3EAfgAmcHBxAH4AN3NxAH4AQ3EAfgBFeHBzcQB+AEYBcQB+ACh2cgAdb3JnLmRyb29scy5NZXNz
+YWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEpxAH4AJnQACSRtZXNzYWdlMXNxAH4AAT9A
+AAAAAAAMdwgAAAAQAAAAAXEAfgCscQB+AKJ4cHNxAH4AEnNxAH4AFwAAAAR3BAAAAApzcQB+ABJz
+cQB+ABcAAAACdwQAAAAKcQB+AKNzcQB+ABsAAAABAAAAAHNxAH4AFwAAAAF3BAAAAAFzcQB+ACBx
+AH4AU3NxAH4AKnNxAH4AL3EAfgBTcHBxAH4AN3NxAH4AQ3EAfgBYeHBzcQB+AEYBcQB+ACh2cgAd
+b3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+AEp4c3EAfgBcc3EA
+fgAXAAAAAncEAAAACnNxAH4AGwAAAAIAAAAAc3EAfgAXAAAAAXcEAAAAAXNxAH4AIHEAfgBTc3EA
+fgAqc3EAfgAvcQB+AFNwcHEAfgA3c3EAfgBDcQB+AEV4cHNxAH4ARgFxAH4AKHZyAB1vcmcuZHJv
+b2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4ASnNxAH4AEnNxAH4AFwAAAAJ3
+BAAAAApzcQB+ABsAAAADAAAAAHNxAH4AFwAAAAF3BAAAAAFzcQB+ACBxAH4AbXNxAH4AKnNxAH4A
+L3EAfgBtcHBxAH4AN3NxAH4AQ3EAfgB0eHBzcQB+AEYBcQB+AG92cgAcb3JnLmRyb29scy5DaGVl
+c2VTaGFkb3dQcm94eZDc1L13kAq+AgAFSQAIZ2V0UHJpY2VaAA1nZXRQcmljZUlzU2V0WgAMZ2V0
+VHlwZUlzU2V0TAAIZGVsZWdhdGVxAH4Ad0wAB2dldFR5cGVxAH4ABXhxAH4AbnEAfgBKc3EAfgAb
+AAAABAAAAABzcQB+ABcAAAABdwQAAAABc3EAfgAgcQB+AG1zcQB+ACpzcQB+AC9xAH4AbXBwcQB+
+ADdzcQB+AENxAH4Af3hwc3EAfgBGAXEAfgBvdnIAHG9yZy5kcm9vbHMuQ2hlZXNlU2hhZG93UHJv
+eHmQ3NS9d5AKvgIABUkACGdldFByaWNlWgANZ2V0UHJpY2VJc1NldFoADGdldFR5cGVJc1NldEwA
+CGRlbGVnYXRlcQB+AHdMAAdnZXRUeXBlcQB+AAV4cQB+AG5xAH4ASnh4c3EAfgBcc3EAfgAXAAAA
+AncEAAAACnNxAH4AGwAAAAUAAAAAc3EAfgAXAAAAAXcEAAAAAXNxAH4AIHEAfgCIc3EAfgAqc3EA
+fgAvcQB+AIhwcHEAfgA3c3EAfgBDcQB+AEV4cHNxAH4ARgFxAH4AKHZyAB1vcmcuZHJvb2xzLk1l
+c3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4ASnNxAH4AGwAAAAb/////c3EAfgAXAAAA
+AXcEAAAAAXNxAH4AIHEAfgCIc3EAfgAqc3EAfgAvcQB+AIhwcHEAfgA3c3EAfgBDcQB+AJZ4cHNx
+AH4ARgFxAH4AKHZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBx
+AH4ASnhzcQB+AFxzcQB+ABcAAAACdwQAAAAKc3EAfgAbAAAAB/////9zcQB+ABcAAAABdwQAAAAB
+c3EAfgAgc3EAfgAkdnIAEW9yZy5kcm9vbHMuUGVyc29uJKQvAhefuGYCAAlJAANhZ2VaAAVhbGl2
+ZUMAA3NleEwACmJpZ0RlY2ltYWx0ABZMamF2YS9tYXRoL0JpZ0RlY2ltYWw7TAAKYmlnSW50ZWdl
+cnQAFkxqYXZhL21hdGgvQmlnSW50ZWdlcjtMAARoYWlycQB+AAVMAAVsaWtlc3EAfgAFTAAEbmFt
+ZXEAfgAFTAAGc3RhdHVzcQB+AAV4cHQABG5hbWVzcQB+ACpzcQB+AC9xAH4A83BwcQB+ADdzcQB+
+AEN0AARtYXJreHBzcQB+AEYBcQB+APd2cgAcb3JnLmRyb29scy5QZXJzb25TaGFkb3dQcm94efJL
+XAslFf7PAgATSQAGZ2V0QWdlWgALZ2V0QWdlSXNTZXRaABJnZXRCaWdEZWNpbWFsSXNTZXRaABJn
+ZXRCaWdJbnRlZ2VySXNTZXRaAAxnZXRIYWlySXNTZXRaAA1nZXRMaWtlc0lzU2V0WgAMZ2V0TmFt
+ZUlzU2V0QwAGZ2V0U2V4WgALZ2V0U2V4SXNTZXRaAA5nZXRTdGF0dXNJc1NldFoAB2lzQWxpdmVa
+AAxpc0FsaXZlSXNTZXRMAAhkZWxlZ2F0ZXQAE0xvcmcvZHJvb2xzL1BlcnNvbjtMAA1nZXRCaWdE
+ZWNpbWFscQB+APVMAA1nZXRCaWdJbnRlZ2VycQB+APZMAAdnZXRIYWlycQB+AAVMAAhnZXRMaWtl
+c3EAfgAFTAAHZ2V0TmFtZXEAfgAFTAAJZ2V0U3RhdHVzcQB+AAV4cQB+APRxAH4ASnNxAH4AGwAA
+AAj////+c3EAfgAXAAAAAXcEAAAAAXNyACJvcmcuZHJvb2xzLnJ1bGUuVmFyaWFibGVDb25zdHJh
+aW50AAAAAAAAAUACAAJMAA5maWVsZEV4dHJhY3RvcnEAfgAhTAALcmVzdHJpY3Rpb250ACVMb3Jn
+L2Ryb29scy9ydWxlL1ZhcmlhYmxlUmVzdHJpY3Rpb247eHBxAH4A83NyACNvcmcuZHJvb2xzLnJ1
+bGUuVmFyaWFibGVSZXN0cmljdGlvbgAAAAAAAAFAAgAETAAMY29udGV4dEVudHJ5dAA6TG9yZy9k
+cm9vbHMvcnVsZS9WYXJpYWJsZVJlc3RyaWN0aW9uJFZhcmlhYmxlQ29udGV4dEVudHJ5O0wAC2Rl
+Y2xhcmF0aW9ucQB+ABxMAAlldmFsdWF0b3JxAH4ALFsAFHJlcXVpcmVkRGVjbGFyYXRpb25zcQB+
+AAd4cHNyAD5vcmcuZHJvb2xzLnJ1bGUuVmFyaWFibGVSZXN0cmljdGlvbiRPYmplY3RWYXJpYWJs
+ZUNvbnRleHRFbnRyeTIPBL4GE40VAgACTAAEbGVmdHEAfgAxTAAFcmlnaHRxAH4AMXhyADhvcmcu
+ZHJvb2xzLnJ1bGUuVmFyaWFibGVSZXN0cmljdGlvbiRWYXJpYWJsZUNvbnRleHRFbnRyeQD/dR3M
+mHnsAgAFTAALZGVjbGFyYXRpb25xAH4AHEwABWVudHJ5cQB+ADBMAAlleHRyYWN0b3JxAH4AIUwA
+Bm9iamVjdHEAfgAxTAAJcmV0ZVR1cGxldAAdTG9yZy9kcm9vbHMvcmV0ZW9vL1JldGVUdXBsZTt4
+cHEAfgCicHEAfgDzcHBwcHEAfgCicQB+ADd1cQB+AA8AAAABcQB+AKJ4cHNxAH4ARgFxAH4A93Zy
+ABxvcmcuZHJvb2xzLlBlcnNvblNoYWRvd1Byb3h58ktcCyUV/s8CABNJAAZnZXRBZ2VaAAtnZXRB
+Z2VJc1NldFoAEmdldEJpZ0RlY2ltYWxJc1NldFoAEmdldEJpZ0ludGVnZXJJc1NldFoADGdldEhh
+aXJJc1NldFoADWdldExpa2VzSXNTZXRaAAxnZXROYW1lSXNTZXRDAAZnZXRTZXhaAAtnZXRTZXhJ
+c1NldFoADmdldFN0YXR1c0lzU2V0WgAHaXNBbGl2ZVoADGlzQWxpdmVJc1NldEwACGRlbGVnYXRl
+cQB+AP9MAA1nZXRCaWdEZWNpbWFscQB+APVMAA1nZXRCaWdJbnRlZ2VycQB+APZMAAdnZXRIYWly
+cQB+AAVMAAhnZXRMaWtlc3EAfgAFTAAHZ2V0TmFtZXEAfgAFTAAJZ2V0U3RhdHVzcQB+AAV4cQB+
+APRxAH4ASnh4cQB+AJpweAA=</byte-array>
+      </org.drools.rule.Package>
+    </entry>
+  </map>
+  <byte-array>rO0ABXQAJDNmMTc5YWQyLWFjZjUtNGU2Zi1iYmY5LTdmOTk1MjcyYmZkNnNyAClvcmcuZHJvb2xz
+LnJldGVvby5SZXRlb29GYWN0SGFuZGxlRmFjdG9yeQAAAAAAAAEsAgAAeHIAK29yZy5kcm9vbHMu
+Y29tbW9uLkFic3RyYWN0RmFjdEhhbmRsZUZhY3RvcnlrwcaUre4SdAIAA0oAB2NvdW50ZXJKAAJp
+ZEwADmZhY3RIYW5kbGVQb29sdAAkTG9yZy9kcm9vbHMvdXRpbC9QcmltaXRpdmVMb25nU3RhY2s7
+eHAAAAAAAAAAAAAAAAAAAAAAc3IAIm9yZy5kcm9vbHMudXRpbC5QcmltaXRpdmVMb25nU3RhY2sP
+j6ttreBeeQIAA0kADWN1cnJlbnRQYWdlSWRJAAl0YWJsZVNpemVMAAtjdXJyZW50UGFnZXQAKUxv
+cmcvZHJvb2xzL3V0aWwvUHJpbWl0aXZlTG9uZ1N0YWNrJFBhZ2U7eHAAAAAAAAABAHNyACdvcmcu
+ZHJvb2xzLnV0aWwuUHJpbWl0aXZlTG9uZ1N0YWNrJFBhZ2Utnhd8IgiDlAIABUkAB2xhc3RLZXlJ
+AAZwYWdlSWRMAAtuZXh0U2libGluZ3EAfgAGTAAPcHJldmlvdXNTaWJsaW5ncQB+AAZbAAV0YWJs
+ZXQAAltKeHD/////AAAAAHBwdXIAAltKeCAEtRKxdZMCAAB4cAAAAQAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHNyABFqYXZhLnV0aWwuSGFzaE1h
+cAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAA
+eHNyACBvcmcuZHJvb2xzLlJ1bGVCYXNlQ29uZmlndXJhdGlvbgAAAAAAAAFAAgALWgALYWxwaGFN
+ZW1vcnlJABlhbHBoYU5vZGVIYXNoaW5nVGhyZXNob2xkSQARY29tcG9zaXRlS2V5RGVwdGhaAAlp
+bW11dGFibGVaABNpbmRleExlZnRCZXRhTWVtb3J5WgAUaW5kZXhSaWdodEJldGFNZW1vcnlaABBy
+ZW1vdmVJZGVudGl0aWVzWgAPc2hhcmVBbHBoYU5vZGVzWgAOc2hhcmVCZXRhTm9kZXNMAA9hc3Nl
+cnRCZWhhdmlvdXJ0ADJMb3JnL2Ryb29scy9SdWxlQmFzZUNvbmZpZ3VyYXRpb24kQXNzZXJ0QmVo
+YXZpb3VyO0wAD2xvZ2ljYWxPdmVycmlkZXQAMkxvcmcvZHJvb2xzL1J1bGVCYXNlQ29uZmlndXJh
+dGlvbiRMb2dpY2FsT3ZlcnJpZGU7eHAAAAAAAwAAAAMBAQEAAQFzcgAwb3JnLmRyb29scy5SdWxl
+QmFzZUNvbmZpZ3VyYXRpb24kQXNzZXJ0QmVoYXZpb3VyAAAAAAAAAUACAAFJAAV2YWx1ZXhwAAAA
+AHNyADBvcmcuZHJvb2xzLlJ1bGVCYXNlQ29uZmlndXJhdGlvbiRMb2dpY2FsT3ZlcnJpZGUAAAAA
+AAABQAIAAUkABXZhbHVleHAAAAABc3IAFm9yZy5kcm9vbHMucmV0ZW9vLlJldGUAAAAAAAABQAIA
+AUwAD29iamVjdFR5cGVOb2Rlc3QAH0xvcmcvZHJvb2xzL3V0aWwvT2JqZWN0SGFzaE1hcDt4cgAe
+b3JnLmRyb29scy5yZXRlb28uT2JqZWN0U291cmNlW528FtDzXo0CAANJABlhbHBoYU5vZGVIYXNo
+aW5nVGhyZXNob2xkTAAMb2JqZWN0U291cmNldAAgTG9yZy9kcm9vbHMvcmV0ZW9vL09iamVjdFNv
+dXJjZTtMAARzaW5rdAAoTG9yZy9kcm9vbHMvcmV0ZW9vL09iamVjdFNpbmtQcm9wYWdhdG9yO3hy
+ABpvcmcuZHJvb2xzLmNvbW1vbi5CYXNlTm9kZeK9dF1arM6UAgADWgAJaGFzTWVtb3J5SQACaWRJ
+AAtzaGFyZWRDb3VudHhwAAAAAAAAAAAAAAAAA3BzcgAob3JnLmRyb29scy5yZXRlb28uRW1wdHlP
+YmplY3RTaW5rQWRhcHRlctw8SkYUA/qZAgAAeHBzcgAdb3JnLmRyb29scy51dGlsLk9iamVjdEhh
+c2hNYXAM5rjKq4yAgQIAAHhyACFvcmcuZHJvb2xzLnV0aWwuQWJzdHJhY3RIYXNoVGFibGXzzroG
+hO24nAIABkYACmxvYWRGYWN0b3JJAARzaXplSQAJdGhyZXNob2xkTAAKY29tcGFyYXRvcnQANExv
+cmcvZHJvb2xzL3V0aWwvQWJzdHJhY3RIYXNoVGFibGUkT2JqZWN0Q29tcGFyYXRvcjtMAAhpdGVy
+YXRvcnQANUxvcmcvZHJvb2xzL3V0aWwvQWJzdHJhY3RIYXNoVGFibGUkSGFzaFRhYmxlSXRlcmF0
+b3I7WwAFdGFibGV0ABhbTG9yZy9kcm9vbHMvdXRpbC9FbnRyeTt4cD9AAAAAAAADAAAADHNyADBv
+cmcuZHJvb2xzLnV0aWwuQWJzdHJhY3RIYXNoVGFibGUkRXF1YWxpdHlFcXVhbHNvFs5QO+Qj0wIA
+AHhwcHVyABhbTG9yZy5kcm9vbHMudXRpbC5FbnRyeTtplR3hOYt48QIAAHhwAAAAEHBwcHBwc3IA
+KW9yZy5kcm9vbHMudXRpbC5PYmplY3RIYXNoTWFwJE9iamVjdEVudHJ5FcrE/UwCYfECAARJAAho
+YXNoQ29kZUwAA2tleXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABG5leHR0ABdMb3JnL2Ryb29scy91
+dGlsL0VudHJ5O0wABXZhbHVlcQB+ACt4cFLS5PVzcgAfb3JnLmRyb29scy5iYXNlLkNsYXNzT2Jq
+ZWN0VHlwZQAAAAAAAAFAAgAEWgANc2hhZG93RW5hYmxlZEwAD29iamVjdFR5cGVDbGFzc3QAEUxq
+YXZhL2xhbmcvQ2xhc3M7TAALc2hhZG93Q2xhc3NxAH4AL0wACXZhbHVlVHlwZXQAG0xvcmcvZHJv
+b2xzL2Jhc2UvVmFsdWVUeXBlO3hwAXZyABFvcmcuZHJvb2xzLkNoZWVzZe+FAhE7Rf31AgACSQAF
+cHJpY2VMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7eHB2cgAcb3JnLmRyb29scy5DaGVlc2VT
+aGFkb3dQcm94eZDc1L13kAq+AgAFSQAIZ2V0UHJpY2VaAA1nZXRQcmljZUlzU2V0WgAMZ2V0VHlw
+ZUlzU2V0TAAIZGVsZWdhdGV0ABNMb3JnL2Ryb29scy9DaGVlc2U7TAAHZ2V0VHlwZXEAfgAzeHEA
+fgAyc3IAGW9yZy5kcm9vbHMuYmFzZS5WYWx1ZVR5cGUAAAAAAAABQAIAA0wACWNsYXNzVHlwZXEA
+fgAvTAAQZXZhbHVhdG9yRmFjdG9yeXQALUxvcmcvZHJvb2xzL2Jhc2UvZXZhbHVhdG9ycy9FdmFs
+dWF0b3JGYWN0b3J5O0wABG5hbWVxAH4AM3hwdnIAEGphdmEubGFuZy5PYmplY3QAAAAAAAAAAAAA
+AHhwc3IAKG9yZy5kcm9vbHMuYmFzZS5ldmFsdWF0b3JzLk9iamVjdEZhY3RvcnmJYnOb3hlWOQIA
+AHhwdAAGT2JqZWN0c3EAfgAqpyvV1XNxAH4ALgF2cgASb3JnLmRyb29scy5NZXNzYWdlAAAAAAAA
+AAAAAAB4cHZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4A
+OnBzcgAgb3JnLmRyb29scy5yZXRlb28uT2JqZWN0VHlwZU5vZGUAAAAAAAABQAIAAkwACm9iamVj
+dFR5cGV0ABtMb3JnL2Ryb29scy9zcGkvT2JqZWN0VHlwZTtMAARyZXRldAAYTG9yZy9kcm9vbHMv
+cmV0ZW9vL1JldGU7eHEAfgAZAQAAAAEAAAApAAAAA3BzcgAsb3JnLmRyb29scy5yZXRlb28uQ29t
+cG9zaXRlT2JqZWN0U2lua0FkYXB0ZXIAAAAAAAABQAIABkkAGWFscGhhTm9kZUhhc2hpbmdUaHJl
+c2hvbGRMAAdoYXNoS2V5dAA2TG9yZy9kcm9vbHMvcmV0ZW9vL0NvbXBvc2l0ZU9iamVjdFNpbmtB
+ZGFwdGVyJEhhc2hLZXk7TAANaGFzaGFibGVTaW5rc3QAJkxvcmcvZHJvb2xzL3JldGVvby9PYmpl
+Y3RTaW5rTm9kZUxpc3Q7TAASaGFzaGVkRmllbGRJbmRleGVzdAAcTG9yZy9kcm9vbHMvdXRpbC9M
+aW5rZWRMaXN0O0wADWhhc2hlZFNpbmtNYXBxAH4AGEwACm90aGVyU2lua3NxAH4ATHhwAAAAA3Ny
+ADRvcmcuZHJvb2xzLnJldGVvby5Db21wb3NpdGVPYmplY3RTaW5rQWRhcHRlciRIYXNoS2V5Gwzr
+Gz2mwYICAAdaAAZidmFsdWVEAAZkdmFsdWVJAAhoYXNoQ29kZUkABWluZGV4SgAGbHZhbHVlQgAE
+dHlwZUwABm92YWx1ZXEAfgAreHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBzcgAkb3JnLmRy
+b29scy5yZXRlb28uT2JqZWN0U2lua05vZGVMaXN0AAAAAAAAAUACAANJAARzaXplTAAJZmlyc3RO
+b2RldAAiTG9yZy9kcm9vbHMvcmV0ZW9vL09iamVjdFNpbmtOb2RlO0wACGxhc3ROb2RlcQB+AFJ4
+cAAAAAVzcgAbb3JnLmRyb29scy5yZXRlb28uQWxwaGFOb2RlAAAAAAAAAUACAANMAApjb25zdHJh
+aW50dAApTG9yZy9kcm9vbHMvc3BpL0FscGhhTm9kZUZpZWxkQ29uc3RyYWludDtMABJuZXh0T2Jq
+ZWN0U2lua05vZGVxAH4AUkwAFnByZXZpb3VzT2JqZWN0U2lua05vZGVxAH4AUnhxAH4AGQEAAAAC
+AAAACwAAAANxAH4ASXNyAClvcmcuZHJvb2xzLnJldGVvby5TaW5nbGVPYmplY3RTaW5rQWRhcHRl
+cptJ9mSFK7YTAgABTAAEc2lua3QAHkxvcmcvZHJvb2xzL3JldGVvby9PYmplY3RTaW5rO3hwc3IA
+Jm9yZy5kcm9vbHMucmV0ZW9vLkxlZnRJbnB1dEFkYXB0ZXJOb2RlAAAAAAAAAUACAANMABJuZXh0
+T2JqZWN0U2lua05vZGVxAH4AUkwADG9iamVjdFNvdXJjZXEAfgAaTAAWcHJldmlvdXNPYmplY3RT
+aW5rTm9kZXEAfgBSeHIAHW9yZy5kcm9vbHMucmV0ZW9vLlR1cGxlU291cmNlPpqUHsCHHHsCAAFM
+AARzaW5rdAAnTG9yZy9kcm9vbHMvcmV0ZW9vL1R1cGxlU2lua1Byb3BhZ2F0b3I7eHEAfgAcAAAA
+AAMAAAALc3IAKG9yZy5kcm9vbHMucmV0ZW9vLlNpbmdsZVR1cGxlU2lua0FkYXB0ZXI0ZhEu4xJP
+SgIAAUwABHNpbmt0AB1Mb3JnL2Ryb29scy9yZXRlb28vVHVwbGVTaW5rO3hwc3IAGm9yZy5kcm9v
+bHMucmV0ZW9vLkpvaW5Ob2RlAAAAAAAAAUACAAB4cgAab3JnLmRyb29scy5yZXRlb28uQmV0YU5v
+ZGWX8ijmpSNu2AIAB0wAC2NvbnN0cmFpbnRzdAAjTG9yZy9kcm9vbHMvY29tbW9uL0JldGFDb25z
+dHJhaW50cztMAAlsZWZ0SW5wdXR0AB9Mb3JnL2Ryb29scy9yZXRlb28vVHVwbGVTb3VyY2U7TAAS
+bmV4dE9iamVjdFNpbmtOb2RlcQB+AFJMABFuZXh0VHVwbGVTaW5rTm9kZXQAIUxvcmcvZHJvb2xz
+L3JldGVvby9UdXBsZVNpbmtOb2RlO0wAFnByZXZpb3VzT2JqZWN0U2lua05vZGVxAH4AUkwAFXBy
+ZXZpb3VzVHVwbGVTaW5rTm9kZXEAfgBlTAAKcmlnaHRJbnB1dHEAfgAaeHEAfgBbAAAAAAUAAAAL
+c3IAK29yZy5kcm9vbHMucmV0ZW9vLkNvbXBvc2l0ZVR1cGxlU2lua0FkYXB0ZXKDYgZsMH6O6wIA
+AUwABXNpbmtzdAAlTG9yZy9kcm9vbHMvcmV0ZW9vL1R1cGxlU2lua05vZGVMaXN0O3hwc3IAI29y
+Zy5kcm9vbHMucmV0ZW9vLlR1cGxlU2lua05vZGVMaXN0AAAAAAAAAUACAANJAARzaXplTAAJZmly
+c3ROb2RlcQB+AGVMAAhsYXN0Tm9kZXEAfgBleHAAAAACc3EAfgBhAAAAAAcAAAAFc3EAfgBnc3EA
+fgBqAAAAAnNxAH4AYQAAAAAJAAAAAnNxAH4AZ3NxAH4AagAAAANzcgAeb3JnLmRyb29scy5yZXRl
+b28uVGVybWluYWxOb2RlAAAAAAAAAUACAARMABFuZXh0VHVwbGVTaW5rTm9kZXEAfgBlTAAVcHJl
+dmlvdXNUdXBsZVNpbmtOb2RlcQB+AGVMAARydWxldAAWTG9yZy9kcm9vbHMvcnVsZS9SdWxlO0wA
+C3R1cGxlU291cmNlcQB+AGR4cQB+ABwAAAAACgAAAABzcQB+AGEAAAAAGQAAAABzcQB+AF5zcQB+
+AHIAAAAAGgAAAABwcHNyABRvcmcuZHJvb2xzLnJ1bGUuUnVsZQAAAAAAAAFAAgAOWgAJYXV0b0Zv
+Y3VzSgAJbG9hZE9yZGVyWgAGbm9Mb29wSQAIc2FsaWVuY2VaABFzZW1hbnRpY2FsbHlWYWxpZEwA
+D0FjdGl2YXRpb25Hcm91cHEAfgAzTAALYWdlbmRhR3JvdXBxAH4AM0wAC2NvbnNlcXVlbmNldAAc
+TG9yZy9kcm9vbHMvc3BpL0NvbnNlcXVlbmNlO1sAEGRlY2xhcmF0aW9uQXJyYXl0AB5bTG9yZy9k
+cm9vbHMvcnVsZS9EZWNsYXJhdGlvbjtMAAxkZWNsYXJhdGlvbnN0AA9MamF2YS91dGlsL01hcDtM
+AAhkdXJhdGlvbnQAGUxvcmcvZHJvb2xzL3NwaS9EdXJhdGlvbjtMAAdsaHNSb290dAAVTG9yZy9k
+cm9vbHMvcnVsZS9BbmQ7TAAEbmFtZXEAfgAzTAADcGtncQB+ADN4cAAAAAAAAAAAAgAAAAAAAXB0
+AARNQUlOc3IAOG9yZy5kcm9vbHMucmV0ZW9vLlJ1bGVfSGVsbG9fV29ybGRfMl8wQ29uc2VxdWVu
+Y2VJbnZva2VyAAAAAAAAAUACAAB4cHVyAB5bTG9yZy5kcm9vbHMucnVsZS5EZWNsYXJhdGlvbjv1
+p88LNGgp4wIAAHhwAAAAAXNyABtvcmcuZHJvb2xzLnJ1bGUuRGVjbGFyYXRpb24DczwB8iDr1gIA
+A0wABmNvbHVtbnQAGExvcmcvZHJvb2xzL3J1bGUvQ29sdW1uO0wACWV4dHJhY3RvcnQAGkxvcmcv
+ZHJvb2xzL3NwaS9FeHRyYWN0b3I7TAAKaWRlbnRpZmllcnEAfgAzeHBzcgAWb3JnLmRyb29scy5y
+dWxlLkNvbHVtbgAAAAAAAAFAAgAFSQAFaW5kZXhJAAZvZmZzZXRMAAtjb25zdHJhaW50c3QAEExq
+YXZhL3V0aWwvTGlzdDtMAAtkZWNsYXJhdGlvbnQAHUxvcmcvZHJvb2xzL3J1bGUvRGVjbGFyYXRp
+b247TAAKb2JqZWN0VHlwZXEAfgBHeHAAAAAAAAAAAHNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHS
+HZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACcQB+AIdzcgAhb3JnLmRyb29scy5ydWxlLkxpdGVy
+YWxDb25zdHJhaW50AAAAAAAAAUACAAJMAAlleHRyYWN0b3J0AB9Mb3JnL2Ryb29scy9zcGkvRmll
+bGRFeHRyYWN0b3I7TAALcmVzdHJpY3Rpb250ACRMb3JnL2Ryb29scy9ydWxlL0xpdGVyYWxSZXN0
+cmljdGlvbjt4cHNyACNvcmcuZHJvb2xzLmJhc2UuQ2xhc3NGaWVsZEV4dHJhY3RvcgAAAAAAAAFA
+AgACTAAFY2xhenpxAH4AL0wACWZpZWxkTmFtZXEAfgAzeHBxAH4AQ3QACG1lc3NhZ2Uxc3IAIm9y
+Zy5kcm9vbHMucnVsZS5MaXRlcmFsUmVzdHJpY3Rpb24AAAAAAAABQAIAA0wADGNvbnRleHRFbnRy
+eXQAOExvcmcvZHJvb2xzL3J1bGUvTGl0ZXJhbFJlc3RyaWN0aW9uJExpdGVyYWxDb250ZXh0RW50
+cnk7TAAJZXZhbHVhdG9ydAAaTG9yZy9kcm9vbHMvc3BpL0V2YWx1YXRvcjtMAAVmaWVsZHQAG0xv
+cmcvZHJvb2xzL3NwaS9GaWVsZFZhbHVlO3hwc3IANm9yZy5kcm9vbHMucnVsZS5MaXRlcmFsUmVz
+dHJpY3Rpb24kTGl0ZXJhbENvbnRleHRFbnRyeSRivCFU8WMrAgADTAAJZXh0cmFjdG9ycQB+AI9M
+AARuZXh0dAAeTG9yZy9kcm9vbHMvcnVsZS9Db250ZXh0RW50cnk7TAAGb2JqZWN0cQB+ACt4cHEA
+fgCTcHBzcgA9b3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3RyaW5nRmFjdG9yeSRTdHJpbmdF
+cXVhbEV2YWx1YXRvcgAAAAAAAAFAAgAAeHIAHW9yZy5kcm9vbHMuYmFzZS5CYXNlRXZhbHVhdG9y
+KrR6Du2xfrYCAAJMAAhvcGVyYXRvcnQAJUxvcmcvZHJvb2xzL2Jhc2UvZXZhbHVhdG9ycy9PcGVy
+YXRvcjtMAAR0eXBlcQB+ADB4cHNyACNvcmcuZHJvb2xzLmJhc2UuZXZhbHVhdG9ycy5PcGVyYXRv
+cgAAAAAAAAFAAgABTAAIb3BlcmF0b3JxAH4AM3hwdAACPT1zcQB+ADh2cgAQamF2YS5sYW5nLlN0
+cmluZ6DwpDh6O7NCAgAAeHBzcgAob3JnLmRyb29scy5iYXNlLmV2YWx1YXRvcnMuU3RyaW5nRmFj
+dG9yeeeM/6nABRq+AgAAeHB0AAZTdHJpbmdzcgAlb3JnLmRyb29scy5iYXNlLmZpZWxkLk9iamVj
+dEZpZWxkSW1wbAAAAAAAAAFAAgABTAAFdmFsdWVxAH4AK3hwdAADT25leHBzcQB+AC4BcQB+AEN2
+cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADpxAH4Ak3QA
+CSRtZXNzYWdlMXNxAH4ADT9AAAAAAAAMdwgAAAAQAAAAAXEAfgCwcQB+AId4cHNyABNvcmcuZHJv
+b2xzLnJ1bGUuQW5k/PjnIvCmw3YCAAB4cgAcb3JnLmRyb29scy5ydWxlLkdyb3VwRWxlbWVudMbc
+k79vtelYAgABTAAIY2hpbGRyZW5xAH4AiXhyACJvcmcuZHJvb2xzLnJ1bGUuQ29uZGl0aW9uYWxF
+bGVtZW50xgxz6WbzojYCAAB4cHNxAH4AjAAAAAR3BAAAAApzcQB+ALJzcQB+AIwAAAACdwQAAAAK
+cQB+AItzcQB+AIgAAAABAAAAAHNxAH4AjAAAAAF3BAAAAAFzcQB+AI5zcQB+AJJxAH4AQ3QACG1l
+c3NhZ2Uyc3EAfgCVc3EAfgCacQB+ALxwcHEAfgCgc3EAfgCqdAADVHdveHBzcQB+AC4BcQB+AEN2
+cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADp4c3IAEm9y
+Zy5kcm9vbHMucnVsZS5PchUXh4ABXbcjAgAAeHEAfgCzc3EAfgCMAAAAAncEAAAACnNxAH4AiAAA
+AAIAAAAAc3EAfgCMAAAAAXcEAAAAAXNxAH4AjnEAfgC8c3EAfgCVc3EAfgCacQB+ALxwcHEAfgCg
+c3EAfgCqcQB+AKx4cHNxAH4ALgFxAH4AQ3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94
+eQAAAAAAAAAAAAAAeHBxAH4AOnNxAH4AsnNxAH4AjAAAAAJ3BAAAAApzcQB+AIgAAAADAAAAAHNx
+AH4AjAAAAAF3BAAAAAFzcQB+AI5zcQB+AJJxAH4ANHQABHR5cGVzcQB+AJVzcQB+AJpxAH4A1nBw
+cQB+AKBzcQB+AKp0AAdzdGlsdG9ueHBzcQB+AC4BcQB+ADR2cgAcb3JnLmRyb29scy5DaGVlc2VT
+aGFkb3dQcm94eZDc1L13kAq+AgAFSQAIZ2V0UHJpY2VaAA1nZXRQcmljZUlzU2V0WgAMZ2V0VHlw
+ZUlzU2V0TAAIZGVsZWdhdGVxAH4ANkwAB2dldFR5cGVxAH4AM3hxAH4AMnEAfgA6c3EAfgCIAAAA
+BAAAAABzcQB+AIwAAAABdwQAAAABc3EAfgCOcQB+ANZzcQB+AJVzcQB+AJpxAH4A1nBwcQB+AKBz
+cQB+AKp0AARicmlleHBzcQB+AC4BcQB+ADR2cgAcb3JnLmRyb29scy5DaGVlc2VTaGFkb3dQcm94
+eZDc1L13kAq+AgAFSQAIZ2V0UHJpY2VaAA1nZXRQcmljZUlzU2V0WgAMZ2V0VHlwZUlzU2V0TAAI
+ZGVsZWdhdGVxAH4ANkwAB2dldFR5cGVxAH4AM3hxAH4AMnEAfgA6eHhzcQB+AMVzcQB+AIwAAAAC
+dwQAAAAKc3EAfgCIAAAABQAAAABzcQB+AIwAAAABdwQAAAABc3EAfgCOc3EAfgCScQB+AEN0AAht
+ZXNzYWdlM3NxAH4AlXNxAH4AmnEAfgDucHBxAH4AoHNxAH4AqnEAfgCseHBzcQB+AC4BcQB+AEN2
+cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93UHJveHkAAAAAAAAAAAAAAHhwcQB+ADpzcQB+AIgA
+AAAG/////3NxAH4AjAAAAAF3BAAAAAFzcQB+AI5xAH4A7nNxAH4AlXNxAH4AmnEAfgDucHBxAH4A
+oHNxAH4AqnQABVRocmVleHBzcQB+AC4BcQB+AEN2cgAdb3JnLmRyb29scy5NZXNzYWdlU2hhZG93
+UHJveHkAAAAAAAAAAAAAAHhwcQB+ADp4c3EAfgDFc3EAfgCMAAAAAncEAAAACnNxAH4AiAAAAAf/
+////c3EAfgCMAAAAAXcEAAAAAXNxAH4AjnNxAH4AknZyABFvcmcuZHJvb2xzLlBlcnNvbiSkLwIX
+n7hmAgAJSQADYWdlWgAFYWxpdmVDAANzZXhMAApiaWdEZWNpbWFsdAAWTGphdmEvbWF0aC9CaWdE
+ZWNpbWFsO0wACmJpZ0ludGVnZXJ0ABZMamF2YS9tYXRoL0JpZ0ludGVnZXI7TAAEaGFpcnEAfgAz
+TAAFbGlrZXNxAH4AM0wABG5hbWVxAH4AM0wABnN0YXR1c3EAfgAzeHB0AARuYW1lc3EAfgCVc3EA
+fgCacQB+AQVwcHEAfgCgc3EAfgCqdAAEbWFya3hwc3EAfgAuAXEAfgEJdnIAHG9yZy5kcm9vbHMu
+UGVyc29uU2hhZG93UHJveHnyS1wLJRX+zwIAE0kABmdldEFnZVoAC2dldEFnZUlzU2V0WgASZ2V0
+QmlnRGVjaW1hbElzU2V0WgASZ2V0QmlnSW50ZWdlcklzU2V0WgAMZ2V0SGFpcklzU2V0WgANZ2V0
+TGlrZXNJc1NldFoADGdldE5hbWVJc1NldEMABmdldFNleFoAC2dldFNleElzU2V0WgAOZ2V0U3Rh
+dHVzSXNTZXRaAAdpc0FsaXZlWgAMaXNBbGl2ZUlzU2V0TAAIZGVsZWdhdGV0ABNMb3JnL2Ryb29s
+cy9QZXJzb247TAANZ2V0QmlnRGVjaW1hbHEAfgEHTAANZ2V0QmlnSW50ZWdlcnEAfgEITAAHZ2V0
+SGFpcnEAfgAzTAAIZ2V0TGlrZXNxAH4AM0wAB2dldE5hbWVxAH4AM0wACWdldFN0YXR1c3EAfgAz
+eHEAfgEGcQB+ADpzcQB+AIgAAAAI/////nNxAH4AjAAAAAF3BAAAAAFzcgAib3JnLmRyb29scy5y
+dWxlLlZhcmlhYmxlQ29uc3RyYWludAAAAAAAAAFAAgACTAAOZmllbGRFeHRyYWN0b3JxAH4Aj0wA
+C3Jlc3RyaWN0aW9udAAlTG9yZy9kcm9vbHMvcnVsZS9WYXJpYWJsZVJlc3RyaWN0aW9uO3hwcQB+
+AQVzcgAjb3JnLmRyb29scy5ydWxlLlZhcmlhYmxlUmVzdHJpY3Rpb24AAAAAAAABQAIABEwADGNv
+bnRleHRFbnRyeXQAOkxvcmcvZHJvb2xzL3J1bGUvVmFyaWFibGVSZXN0cmljdGlvbiRWYXJpYWJs
+ZUNvbnRleHRFbnRyeTtMAAtkZWNsYXJhdGlvbnEAfgCKTAAJZXZhbHVhdG9ycQB+AJdbABRyZXF1
+aXJlZERlY2xhcmF0aW9uc3EAfgB6eHBzcgA+b3JnLmRyb29scy5ydWxlLlZhcmlhYmxlUmVzdHJp
+Y3Rpb24kT2JqZWN0VmFyaWFibGVDb250ZXh0RW50cnkyDwS+BhONFQIAAkwABGxlZnRxAH4AK0wA
+BXJpZ2h0cQB+ACt4cgA4b3JnLmRyb29scy5ydWxlLlZhcmlhYmxlUmVzdHJpY3Rpb24kVmFyaWFi
+bGVDb250ZXh0RW50cnkA/3UdzJh57AIABUwAC2RlY2xhcmF0aW9ucQB+AIpMAAVlbnRyeXEAfgCb
+TAAJZXh0cmFjdG9ycQB+AI9MAAZvYmplY3RxAH4AK0wACXJldGVUdXBsZXQAHUxvcmcvZHJvb2xz
+L3JldGVvby9SZXRlVHVwbGU7eHBxAH4Ah3BxAH4BBXBwcHBxAH4Ah3EAfgCgdXEAfgCCAAAAAXEA
+fgCHeHBzcQB+AC4BcQB+AQl2cgAcb3JnLmRyb29scy5QZXJzb25TaGFkb3dQcm94efJLXAslFf7P
+AgATSQAGZ2V0QWdlWgALZ2V0QWdlSXNTZXRaABJnZXRCaWdEZWNpbWFsSXNTZXRaABJnZXRCaWdJ
+bnRlZ2VySXNTZXRaAAxnZXRIYWlySXNTZXRaAA1nZXRMaWtlc0lzU2V0WgAMZ2V0TmFtZUlzU2V0
+QwAGZ2V0U2V4WgALZ2V0U2V4SXNTZXRaAA5nZXRTdGF0dXNJc1NldFoAB2lzQWxpdmVaAAxpc0Fs
+aXZlSXNTZXRMAAhkZWxlZ2F0ZXEAfgERTAANZ2V0QmlnRGVjaW1hbHEAfgEHTAANZ2V0QmlnSW50
+ZWdlcnEAfgEITAAHZ2V0SGFpcnEAfgAzTAAIZ2V0TGlrZXNxAH4AM0wAB2dldE5hbWVxAH4AM0wA
+CWdldFN0YXR1c3EAfgAzeHEAfgEGcQB+ADp4eHQADUhlbGxvIFdvcmxkIDJwcQB+AHVzcgAmb3Jn
+LmRyb29scy5jb21tb24uRW1wdHlCZXRhQ29uc3RyYWludHMAAAAAAAABQAIAAHhwcQB+AG9zcQB+
+AGEAAAAAHQAAAABzcQB+AF5zcQB+AHIAAAAAHgAAAABwcHEAfgB+cQB+ASZxAH4BJXNxAH4AYQAA
+AAAMAAAAAnNxAH4AZ3NxAH4AagAAAANzcQB+AHIAAAAADQAAAABxAH4BJnBzcQB+AHgAAAAAAAAA
+AAEAAAAAAAFwcQB+AH9zcgA4b3JnLmRyb29scy5yZXRlb28uUnVsZV9IZWxsb19Xb3JsZF8xXzBD
+b25zZXF1ZW5jZUludm9rZXIAAAAAAAABQAIAAHhwdXEAfgCCAAAAAHNxAH4ADT9AAAAAAAAMdwgA
+AAAQAAAAAHhwc3EAfgCyc3EAfgCMAAAAA3cEAAAACnNxAH4AsnNxAH4AjAAAAAJ3BAAAAApzcQB+
+AIgAAAAAAAAAAHNxAH4AjAAAAAF3BAAAAAFzcQB+AI5xAH4Ak3NxAH4AlXNxAH4AmnEAfgCTcHBx
+AH4AoHNxAH4AqnEAfgCseHBxAH4AQXNxAH4AiAAAAAEAAAAAc3EAfgCMAAAAAXcEAAAAAXNxAH4A
+jnEAfgC8c3EAfgCVc3EAfgCacQB+ALxwcHEAfgCgc3EAfgCqcQB+AMF4cHNxAH4ALgFxAH4AQ3Zy
+AB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AOnhzcQB+AMVz
+cQB+AIwAAAACdwQAAAAKc3EAfgCIAAAAAgAAAABzcQB+AIwAAAABdwQAAAABc3EAfgCOcQB+ALxz
+cQB+AJVzcQB+AJpxAH4AvHBwcQB+AKBzcQB+AKpxAH4ArHhwc3EAfgAuAXEAfgBDdnIAHW9yZy5k
+cm9vbHMuTWVzc2FnZVNoYWRvd1Byb3h5AAAAAAAAAAAAAAB4cHEAfgA6c3EAfgCyc3EAfgCMAAAA
+AncEAAAACnNxAH4AiAAAAAMAAAAAc3EAfgCMAAAAAXcEAAAAAXNxAH4AjnEAfgDWc3EAfgCVc3EA
+fgCacQB+ANZwcHEAfgCgc3EAfgCqcQB+ANt4cHEAfgAxc3EAfgCIAAAABAAAAABzcQB+AIwAAAAB
+dwQAAAABc3EAfgCOcQB+ANZzcQB+AJVzcQB+AJpxAH4A1nBwcQB+AKBzcQB+AKpxAH4A5Xhwc3EA
+fgAuAXEAfgA0dnIAHG9yZy5kcm9vbHMuQ2hlZXNlU2hhZG93UHJveHmQ3NS9d5AKvgIABUkACGdl
+dFByaWNlWgANZ2V0UHJpY2VJc1NldFoADGdldFR5cGVJc1NldEwACGRlbGVnYXRlcQB+ADZMAAdn
+ZXRUeXBlcQB+ADN4cQB+ADJxAH4AOnh4c3EAfgDFc3EAfgCMAAAAAncEAAAACnNxAH4AiAAAAAUA
+AAAAc3EAfgCMAAAAAXcEAAAAAXNxAH4AjnEAfgDuc3EAfgCVc3EAfgCacQB+AO5wcHEAfgCgc3EA
+fgCqcQB+AKx4cHNxAH4ALgFxAH4AQ3ZyAB1vcmcuZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAA
+AAAAAAAAAAAAeHBxAH4AOnNxAH4AiAAAAAb/////c3EAfgCMAAAAAXcEAAAAAXNxAH4AjnEAfgDu
+c3EAfgCVc3EAfgCacQB+AO5wcHEAfgCgc3EAfgCqcQB+APx4cHNxAH4ALgFxAH4AQ3ZyAB1vcmcu
+ZHJvb2xzLk1lc3NhZ2VTaGFkb3dQcm94eQAAAAAAAAAAAAAAeHBxAH4AOnh4dAANSGVsbG8gV29y
+bGQgMXBxAH4BKXNxAH4AYQAAAAAfAAAAAHNxAH4AXnNxAH4AcgAAAAAgAAAAAHBwcQB+AH5xAH4B
+dnNyACdvcmcuZHJvb2xzLmNvbW1vbi5TaW5nbGVCZXRhQ29uc3RyYWludHMAAAAAAAABQAIABFoA
+B2luZGV4ZWRMAARjb25mdAAiTG9yZy9kcm9vbHMvUnVsZUJhc2VDb25maWd1cmF0aW9uO0wACmNv
+bnN0cmFpbnR0AChMb3JnL2Ryb29scy9zcGkvQmV0YU5vZGVGaWVsZENvbnN0cmFpbnQ7TAAHY29u
+dGV4dHEAfgCbeHABcQB+ABJxAH4BF3EAfgEecQB+ASlzcQB+AGEAAAAAIwAAAABzcQB+AF5zcQB+
+AHIAAAAAJAAAAABwcHEAfgB+cQB+AX1zcQB+AXkBcQB+ABJxAH4BF3EAfgEec3EAfgBhAAAAABMA
+AAACc3EAfgBnc3EAfgBqAAAAA3NxAH4AcgAAAAAUAAAAAHNxAH4AYQAAAAAhAAAAAHNxAH4AXnNx
+AH4AcgAAAAAiAAAAAHBwcQB+AH5xAH4BhXEAfgElcQB+AYFzcQB+AGEAAAAAJQAAAABzcQB+AF5z
+cQB+AHIAAAAAJgAAAABwcHEAfgB+cQB+AYhxAH4BJXNxAH4AYQAAAAAVAAAAAnNxAH4AZ3NxAH4A
+agAAAANzcQB+AHIAAAAAFgAAAABxAH4BiHBxAH4BLXEAfgGLc3EAfgBhAAAAACcAAAAAc3EAfgBe
+c3EAfgByAAAAACgAAAAAcHBxAH4AfnEAfgGPc3EAfgF5AXEAfgAScQB+ARdxAH4BHnEAfgGLcHBx
+AH4BfXEAfgGIc3EAfgBGAQAAABcAAAAHAAAAA3BzcQB+AEoAAAADc3EAfgBPAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAABwc3EAfgBRAAAAAXNxAH4AVAEAAAAYAAAAAwAAAANxAH4Bk3NxAH4ASgAA
+AANzcQB+AE8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBwcHBzcQB+AFEAAAAEcQB+AHVxAH4B
+iHEAfgEEcHBxAH4Bl3NyABpvcmcuZHJvb2xzLnV0aWwuTGlua2VkTGlzdAAAAAAAAAFAAgAESQAE
+c2l6ZUwACWZpcnN0Tm9kZXQAIExvcmcvZHJvb2xzL3V0aWwvTGlua2VkTGlzdE5vZGU7TAAIaXRl
+cmF0b3J0AC9Mb3JnL2Ryb29scy91dGlsL0xpbmtlZExpc3QkTGlua2VkTGlzdEl0ZXJhdG9yO0wA
+CGxhc3ROb2RlcQB+AZx4cAAAAAFzcgA3b3JnLmRyb29scy5yZXRlb28uQ29tcG9zaXRlT2JqZWN0
+U2lua0FkYXB0ZXIkRmllbGRJbmRleDV7H+K3TvCUAgAGSQAFY291bnRaAAZoYXNoZWRJAAVpbmRl
+eEwADWZpZWxkRXh0YWN0b3JxAH4Aj0wABG5leHRxAH4BnEwACHByZXZpb3VzcQB+AZx4cAAAAAEA
+AAAAAnEAfgEFcHBzcgAtb3JnLmRyb29scy51dGlsLkxpbmtlZExpc3QkTGlua2VkTGlzdEl0ZXJh
+dG9y/MXgPNEGp/kCAANMAAdjdXJyZW50cQB+AZxMAARsaXN0cQB+AE1MAAZ0aGlzJDBxAH4ATXhw
+cHBxAH4BnnEAfgGgcHNxAH4AUQAAAARzcQB+AGEAAAAAGwAAAABzcQB+AF5zcQB+AHIAAAAAHAAA
+AABwcHEAfgB+cQB+AaRzcQB+AXkBcQB+ABJxAH4BF3EAfgEecQB+AG9xAH4BdnBwcQB+AHVxAH4B
+k3EAfgGPcQB+AQ9xAH4AHXEAfgElc3EAfgBhAAAAABIAAAAFc3EAfgBnc3EAfgBqAAAAAnEAfgGB
+cQB+AYtxAH4BJXNxAH4AYQAAAAAQAAAABXNxAH4AXnEAfgGocQB+ASVxAH4AZnBwcHEAfgBsc3EA
+fgBUAQAAAA8AAAAFAAAAA3NxAH4ARgEAAAAOAAAACwAAAANwc3EAfgBKAAAAA3NxAH4ATwAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAcHNxAH4AUQAAAAJxAH4BrXNxAH4AVAEAAAARAAAABQAAAANx
+AH4BrnNxAH4AV3EAfgGocQB+AVpwcQB+Aa1zcQB+AZsAAAABc3EAfgGfAAAAAgAAAAABcQB+ANZw
+cHNxAH4BoXBwcQB+AbRxAH4BtXBwcQB+ADFxAH4AHXNxAH4AV3EAfgGrcQB+AVRxAH4BsnBwcHBw
+cQB+AbJwcHEAfgEpcQB+AYFzcQB+AFQBAAAACwAAAAUAAAADcQB+AElzcQB+AEoAAAADc3EAfgBP
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwcHBwc3EAfgBRAAAAAnEAfgEpcQB+AYtxAH4BbnBz
+cQB+AFQBAAAACAAAAAUAAAADcQB+AElzcQB+AEoAAAADc3EAfgBPAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAABwcHBwc3EAfgBRAAAAAnEAfgBvcQB+AYFxAH4BZXEAfgG4c3EAfgBUAQAAAAYAAAAF
+AAAAA3EAfgBJc3EAfgBXcQB+AGxxAH4BSXEAfgG8c3EAfgBUAQAAAAQAAAALAAAAA3EAfgBJc3EA
+fgBXcQB+AGZxAH4BPnEAfgHAcQB+AFZwcQB+AY9xAH4BhXEAfgGOcQB+AZdxAH4BfXEAfgEmcQB+
+AYRxAH4Bl3BxAH4BLXEAfgGBcQB+AX1xAH4BJXEAfgGocHEAfgGLcQB+AG9wcQB+AbxxAH4Bj3Bx
+AH4BdnEAfgGFcQB+AZNwcQB+AaRxAH4BJnEAfgGTcQB+ASVxAH4AbHEAfgGLcHBxAH4Ab3EAfgG4
+cQB+AYVxAH4BdnEAfgB1cQB+ASxxAH4Bl3EAfgGkcHEAfgB0cQB+AZdwcQB+AS1xAH4Ab3EAfgGk
+cQB+ASVxAH4AbHEAfgGBcQB+ASlwcHEAfgG8cQB+ASlxAH4BJXEAfgBmcHEAfgGrcHBxAH4BwHEA
+fgGrcQB+ASVxAH4AXXBwcHBxAH4BwnBxAH4AVnBxAH4BOHEAfgHCcHEAfgG4c3EAfgGbAAAAA3Nx
+AH4BnwAAAAEAAAAAAnEAfgCTc3EAfgGfAAAAAgAAAAADcQB+ALxzcQB+AZ8AAAACAAAAAARxAH4A
+7nBxAH4BxnEAfgHFcHNxAH4BoXBwcQB+AcRxAH4Bx3BwcQB+AEFxAH4AHXEAfgGucHBwcHNxAH4A
+KiPZSEpxAH4BD3BxAH4Bk3BwcHBwc3IAH29yZy5kcm9vbHMucmV0ZW9vLlJldGVvb0J1aWxkZXIY
+HVn7j8gD8AIACUkAF2N1cnJlbnRPZmZzZXRBZGp1c3RtZW50SQACaWRaABByZW1vdmVJZGVudGl0
+aWVzTAANYXR0YWNoZWROb2Rlc3EAfgB7TAAMZGVjbGFyYXRpb25zcQB+AHtMAAxvYmplY3RTb3Vy
+Y2VxAH4AGkwACm9iamVjdFR5cGVxAH4Ae0wABXJ1bGVzcQB+AHtMAAt0dXBsZVNvdXJjZXEAfgBk
+eHAAAAAAAAAAKQBzcQB+AA0/QAAAAAAAMHcIAAAAQAAAABxxAH4Bj3EAfgGPcQB+AYFxAH4BgXEA
+fgEpcQB+ASlxAH4BfXEAfgF9cQB+Aa5xAH4BrnEAfgEmcQB+ASZxAH4BiHEAfgGIcQB+AZdxAH4B
+l3EAfgGFcQB+AYVxAH4BpHEAfgGkcQB+AF1xAH4AXXEAfgBWcQB+AFZxAH4BuHEAfgG4cQB+AcBx
+AH4BwHEAfgHCcQB+AcJxAH4BrXEAfgGtcQB+AG9xAH4Ab3EAfgF2cQB+AXZxAH4Bq3EAfgGrcQB+
+AGZxAH4AZnEAfgBJcQB+AElxAH4BsnEAfgGycQB+AGxxAH4AbHEAfgGocQB+AahxAH4Bi3EAfgGL
+cQB+AZNxAH4Bk3EAfgG8cQB+AbxxAH4AdXEAfgB1eHNxAH4ADT9AAAAAAAAMdwgAAAAQAAAAAXEA
+fgCwcQB+AId4cQB+AZNzcgAXamF2YS51dGlsLkxpbmtlZEhhc2hNYXA0wE5cEGzA+wIAAVoAC2Fj
+Y2Vzc09yZGVyeHEAfgANP0AAAAAAAAx3CAAAABAAAAAAeABzcQB+AA0/QAAAAAAADHcIAAAAEAAA
+AAJxAH4BLXVyAB1bTG9yZy5kcm9vbHMuY29tbW9uLkJhc2VOb2RlO3gP5nV9Cv4lAgAAeHAAAAAE
+cQB+AHRxAH4BLHEAfgGEcQB+AY5xAH4AfnVxAH4B0QAAAAhxAH4Ad3EAfgGmcQB+AShxAH4BeHEA
+fgGHcQB+AX9xAH4BinEAfgGReHEAfgGP</byte-array>
+</org.drools.reteoo.ReteooRuleBase>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrs.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrs.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrs.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,22 @@
+package org.drools.reteoo;
+
+import org.drools.Message;
+ 
+rule "Hello World 1"
+    when
+        Message(  message1 =="One") &&     Message(  message2 =="Two")
+        Message(  message2 =="One") ||     Message(  message2 =="Two")
+        Message(  message3 =="One") ||     Message(  message3 =="Three")
+    then
+        System.out.println( "done 1" ); 
+end
+
+rule "Hello World 2"
+    when
+        Message(  message1 =="One") &&     Message(  message2 =="Two")
+        Message(  message2 =="One") ||     Message(  message2 =="Two")
+        Message(  message3 =="One") ||     Message(  message3 =="Three")
+        eval( true );
+    then
+        System.out.println( "done 2" ); 
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrsPerson.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrsPerson.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_OneAndTwoOrsPerson.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package org.drools.reteoo;
+
+import org.drools.Message
+import org.drools.Cheese
+import org.drools.Person
+ 
+rule "Hello World 1"
+    when
+        Message(  message1 =="One") &&     Message(  message2 =="Two")
+        Message(  message2 =="One") ||  ( Cheese( type == "stilton") && Cheese( type == "brie")  )
+        Message(  message3 =="One") ||     Message(  message3 =="Three")
+    then
+        System.out.println( "done 1" ); 
+end
+
+rule "Hello World 2"
+    when
+        Message(  $message1 : message1 =="One") &&     Message(  message2 =="Two")
+        Message(  message2 =="One") ||  ( Cheese( type == "stilton") && Cheese( type == "brie")  )
+        Message(  message3 =="One") ||     Message(  message3 =="Three")
+        Person( name=="mark" ) || Person( name == $message1 )
+    then
+        System.out.println( "done 1" ); 
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_ThreePatternsWithConstraints.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_ThreePatternsWithConstraints.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/reteoo/test_ThreePatternsWithConstraints.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,23 @@
+package org.drools.compiler;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+rule "three patterns with constraints 1"
+  when  		  	
+    $cheese1 : Cheese( $type : type == "cheddar", $price1 : price )
+    $cheese2 : Cheese( type == $type, $price2 : price -> ( $price1 == $price2 ) )    
+    Person( name == $type )
+  then
+	System.out.println( "done 1" );
+end
+
+
+rule "three patterns with constraints 2"
+  when  		  	
+    $cheese1 : Cheese( $type : type == "cheddar", $price1 : price )
+    $cheese2 : Cheese( type == $type, $price2 : price -> ( $price1 == $price2 ) )   
+  then
+	System.out.println( "done 2" );
+
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/java/nestedConditionalElements.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/java/nestedConditionalElements.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/java/nestedConditionalElements.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+package org.drools;
+
+global java.util.List results
+
+rule "test nested CEs"	
+	when
+	    $st : State( $spstate : state == "SP" )
+	    not ( State( $state : state ) and
+	          not( Person( status == $state, $likes : likes ) and
+	               Cheese( type == $likes ) ) )
+	then 
+		results.add("OK");		
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/javaonly.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/javaonly.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/javaonly.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+rule "Hello World"
+	dialect "java"
+	when
+	then
+		System.out.println( "java" ); 
+end
+
+rule "GoodBye"
+	dialect "java"
+	when
+	then 
+		System.out.println( "java" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvel/mvel_rule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvel/mvel_rule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvel/mvel_rule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+
+rule simple_rule 
+  dialect "mvel"
+  when
+
+  then 
+	  System.out.println( "a1" );
+	  System.out.println( "a2" );
+	  System.out.println( "a3" );
+	  System.out.println( "a4" );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mveljavarules.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mveljavarules.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mveljavarules.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+rule "Hello World"
+	dialect "java"
+	when
+	then
+		System.out.println( "java" ); 
+end
+
+rule "GoodBye"
+	dialect "mvel"
+	when
+	then 
+		System.out.println( "mvel" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvelonly.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvelonly.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/rule/builder/dialect/mvelonly.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package org.drools;
+
+rule "Hello World"
+	dialect "mvel"
+	when
+	then
+		System.out.println( "mvel" ); 
+end
+
+rule "GoodBye"
+	dialect "mvel"
+	when
+	then 
+		System.out.println( "mvel" );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,39 @@
+package foo.bar
+
+import org.drools.Cheese
+
+global java.util.List list
+
+rule "rule1"
+	when
+		c: Cheese()
+	then
+		System.out.println("rule1---");
+		c.setType("rule1");
+end
+
+rule "rule2"
+	when
+		c: Cheese()
+	then
+		c.setType("rule2");
+		System.out.println("rule2---");
+end
+
+rule "rule3"
+	when
+		c: Cheese()
+	then
+		//we are not using a list, but thats cool, we won't fire this rule...
+		list.add("rule3");
+		c.setType("rule3");
+		System.out.println("rule3---");
+end
+
+rule "rule4"
+	when
+		not Cheese()
+	then
+		System.err.println("whee");
+end
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules2.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules2.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_rules2.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+package foo.bar
+
+import org.drools.Cheese
+import org.drools.Person
+
+global Person p
+
+rule "rule1"
+	when
+		c: Cheese()
+	then
+		p.setName("rule1");
+end
+
+rule "rule2"
+	when
+		c: Cheese()
+	then
+		p.setStatus("rule2");
+end
+
+rule "rule3"
+	when
+		c: Cheese()
+	then
+	    p.setAge(42);
+
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_stateful.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_stateful.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/testframework/test_stateful.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,37 @@
+package foo.bar
+
+import org.drools.Cheese
+
+
+rule "rule1"
+	when
+		c1: Cheese(price == 1)
+	then
+		c1.setType("rule1");
+end
+
+rule "rule2"
+	when
+		c1: Cheese(price == 1)
+		c2: Cheese(price == 2)
+	then
+		c1.setType("rule2");
+		c2.setType("rule2");
+end
+
+rule "rule3"
+	when
+		c1: Cheese(price == 42)
+    then
+    	c1.setType("rule3");
+end
+
+rule "rule4"
+	when
+		c1 : Cheese(price == 46)
+		not Cheese(price == 42)
+	then
+		c1.setType("rule4");
+end
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlDslTest.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlDslTest.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlDslTest.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,33 @@
+<process  xmlns="http://drools.org/drools-4.0/process"
+          xmlns:mydsl="http://domain/org/mydsl"
+	      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+	      xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd" 
+          name="process name" id="process name" type="RuleFlow" package-name="org.domain" >
+          
+    <header>
+        <imports>
+    		<import name="java.util.List" />    
+        </imports>        					
+	        
+        <globals>
+            <global identifier="list" type="List" />        
+        </globals>
+    </header>      
+    
+    <nodes>              
+	    <start name="start node" />
+	    
+	    <action name="action node" dialect="java">list.add( "action node was here" );</action>	    
+	    
+	    <mydsl:store name="store node">dsl was here</mydsl:store>
+	    
+	    <end name="end node" />
+    </nodes>
+    
+    <connections>
+        <connection from="start node" to="action node" />
+        <connection from="action node" to="store node" />
+        <connection from="store node" to="end node" />
+    </connections>
+    
+</process>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlTest.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlTest.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/XmlTest.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+<process  xmlns="http://drools.org/drools-4.0/process"
+	      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+	      xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd" 
+          name="process name" id="process name" package-name="org.domain" >
+          
+    <header>
+        <imports>
+    		<import name="java.util.List" />    
+        </imports>        					
+	        
+        <globals>
+            <global identifier="list" type="List" />        
+        </globals>
+    </header>      
+    
+    <nodes>              
+	    <start name="start node" />
+	    
+	    <action name="action node" dialect="java">list.add( "action node was here" );</action>	    
+	    
+	    <end name="end node" />
+    </nodes>
+    
+    <connections>
+        <connection from="start node" to="action node" />
+        <connection from="action node" to="end node" />
+    </connections>
+    
+</process>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,31 @@
+<process  xmlns="http://drools.org/drools-4.0/process"
+	      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+	      xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd" 
+          name="process name" id="process name" type="RuleFlow" package-name="org.domain" >
+    <header>
+        <imports>
+    		<import name="java.util.List" />    
+        </imports>        					
+	        
+        <globals>
+            <global identifier="list" type="List" />        
+        </globals>
+    </header>      
+    
+    <nodes>              
+	    <start name="start node">
+	    </start>
+	    
+	    <action name="action node" dialect="java">
+	    	list.add( "action node was here" );
+	    </action>
+	    
+	    <end name="end node">
+	    </end>
+    </nodes>
+    
+    <connections>
+        <connection from="start node" to="action node" />
+        <connection from="action node" to="end node" />
+    </connections>    
+</process>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_Dump.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_Dump.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_Dump.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,24 @@
+package foo;
+
+rule "simple_rule"
+  salience 10
+  no-loop true
+  agenda-group "agenda-group"
+  activation-group "activation-group"
+  when
+    foo2 : Bar( a ( > 60 && < 70 ) || ( > 50 && < 55 ) && a3 == "black" || a == 40 && a3 == "pink" || a == 12 && a3 == "yellow" || a3 == "blue")
+    foo3 : Bar( a == 3 || == 4, a3 == "hello", a4 == null )    
+    foo4 : Bar( a4 : a != 4 && != 5)
+    foo5 : Bar( b == (a4 + 1) || > a4)    
+    foo6 : Bar( a4 : a, b == 6)    
+    foo7 : Bar( a4 : a, b4 : b)    
+    $cheeseList  : ArrayList(size > 2) from collect( Cheese( type == $likes ) );    
+    Baz()
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+
+	<import name="import java.util.List"/>
+    <import name="org.drools.Person" />
+    <import name="org.drools.Cheese" />
+	<import name="org.drools.Cheesery" />
+
+	<global identifier="cheesery" type="Cheesery" />
+	<global identifier="list1" type="List" />
+
+    <rule name="simple_rule">
+        <rule-attribute name="salience" value="10" />
+        <rule-attribute name="no-loop" value="true" />
+        <rule-attribute name="agenda-group" value="agenda-group" />
+        <rule-attribute name="activation-group" value="activation-group" />
+
+        <lhs>
+            <pattern identifier="cheese" object-type="Cheese">
+                <from>
+                    <accumulate>
+                        <pattern object-type="Person"></pattern>
+                        <init>
+                            int total = 0;
+                        </init>
+                        <action>
+                            total += $cheese.getPrice();
+                        </action>
+                        <result>
+                            new Integer( total ) );
+                        </result>
+                    </accumulate>
+                </from>
+            </pattern>
+			
+            <pattern identifier="max" object-type="Number">
+                <from>
+                    <accumulate>
+                        <pattern identifier="cheese" object-type="Cheese"></pattern>
+                        <external-function evaluator="max" expression="$price"/>
+                    </accumulate>
+                </from>
+            </pattern>
+        </lhs>
+        <rhs>
+            list1.add( $cheese );
+        </rhs>
+    </rule>
+
+    <rule name="multipatternaccumulate_rule">
+        <rule-attribute name="salience" value="10" />
+        <lhs>
+            <pattern identifier="cheese" object-type="Cheese">
+                <from>
+                    <accumulate>
+                        <and-conditional-element>
+                            <pattern object-type="Milk"></pattern>
+                            <pattern object-type="Cup"></pattern>
+                        </and-conditional-element>
+
+                        <init>
+                            int total = 0;
+                        </init>
+                        <action>
+                            total += $cheese.getPrice();
+                        </action>
+                        <result>
+                            new Integer( total ) );
+                        </result>
+                    </accumulate>
+                </from>
+            </pattern>
+        </lhs>
+        <rhs>
+            list1.add( $cheese );
+        </rhs>
+    </rule>
+
+
+
+</package>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample" xmlns="http://drools.org/drools-4.0"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+	xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+
+	<import name="import java.util.List"/>
+	<import name="org.drools.Cheese"/>
+	<import name="org.drools.Cheesery"/>
+
+	<global identifier="cheesery" type="Cheesery"/>
+	<global identifier="list" type="List"/>
+
+	<rule name="simple_rule">
+		<rule-attribute name="salience" value="10"/>
+		<rule-attribute name="no-loop" value="true"/>
+		<rule-attribute name="agenda-group" value="agenda-group"/>
+		<rule-attribute name="activation-group" value="activation-group"/>
+
+		<lhs>
+            <pattern identifier="cheese" object-type="Cheese" >
+				<field-constraint field-name="type">
+                    <literal-restriction evaluator="==" value="1"/>
+                </field-constraint>
+                <from>
+                    <collect>
+                        <pattern object-type="Person">
+                            <field-constraint field-name="hair">
+                                <literal-restriction evaluator="==" value="pink" />
+                            </field-constraint>
+                        </pattern>
+                    </collect>
+                </from>
+            </pattern>
+		</lhs>
+		<rhs> list.add( $cheese ); </rhs>
+	</rule>
+
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="pt.inescporto.cec.rules"
+    xmlns="http://drools.org/drools-4.0"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+    <import name="pt.inescporto.cec.entities.SetupInUse"/>
+    <import name="pt.inescporto.cec.entities.SetupUse"/>
+    <import name="pt.inescporto.cec.entities.ArtigoProducao"/>
+    <import name="pt.inescporto.cec.entities.Parameter"/>
+    <import name="pt.inescporto.cec.entities.BestParms"/>
+    <import name="pt.inescporto.cec.entities.AccaoInspeccaoOperacao"/>
+    <import name="pt.inescporto.cec.entities.MelhorEmNaoConformidades"/>
+    <import name="pt.inescporto.cec.entities.OtherInspectionMethod"/>
+    <import name="pt.inescporto.cec.entities.AccaoInspeccao"/>
+    <rule name="ruleBestProductionOrderCreator">
+        <lhs>
+            <pattern object-type="AccaoInspeccao">
+                <field-binding field-name="recursoID" identifier="resource"/>
+                <field-constraint field-name="artigoID">
+                    <literal-restriction evaluator="==" value="3"/>
+                </field-constraint>
+                <field-binding field-name="operacaoID" identifier="operation"/>
+                <field-binding field-name="ordemProducaoID" identifier="ProductionOrder"/>
+                <field-binding field-name="recursoID" identifier="resourceID"/>
+                <field-binding field-name="accaoInspeccaoID" identifier="InspectionAction"/>
+            </pattern>
+            <pattern object-type="AccaoInspeccaoOperacao">
+                <field-binding field-name="inspAccaoOperacaoID" identifier="inspectionActionOperation"/>
+                <field-constraint field-name="inspectionActionID">
+                    <variable-restriction evaluator="==" identifier="InspectionAction"/>
+                </field-constraint>
+            </pattern>
+            <pattern object-type="OtherInspectionMethod">
+                <field-binding field-name="numeroNaoConformidades" identifier="NCNumber"/>
+                <field-constraint field-name="inspAccaoOperacaoID">
+                    <variable-restriction evaluator="==" identifier="inspectionActionOperation"/>
+                </field-constraint>
+            </pattern>
+            <not>
+                <pattern object-type="MelhorEmNaoConformidades">
+                    <field-constraint field-name="operacaoID">
+                        <variable-restriction evaluator="==" identifier="operation"/>
+                    </field-constraint>
+                    <field-constraint field-name="recursoID">
+                        <variable-restriction evaluator="==" identifier="resource"/>
+                    </field-constraint>
+                </pattern>
+            </not>
+        </lhs>
+        <rhs>insert(new MelhorEmNaoConformidades(ProductionOrder,NCNumber,operation,resource));</rhs>
+    </rule>
+    <rule name="Best Checker">
+        <lhs>
+            <pattern object-type="AccaoInspeccao">
+                <field-constraint field-name="artigoID">
+                    <literal-restriction evaluator="==" value="3"/>
+                </field-constraint>
+                <field-binding field-name="recursoID" identifier="resource"/>
+                <field-binding field-name="operacaoID" identifier="operation"/>
+                <field-binding field-name="ordemProducaoID" identifier="ProductionOrder"/>
+                <field-binding field-name="recursoID" identifier="resourceID"/>
+                <field-binding field-name="accaoInspeccaoID" identifier="InspectionAction"/>
+            </pattern>
+            <pattern object-type="AccaoInspeccaoOperacao">
+                <field-binding field-name="inspAccaoOperacaoID" identifier="inspectionActionOperation"/>
+                <field-constraint field-name="inspectionActionID">
+                    <variable-restriction evaluator="==" identifier="InspectionAction"/>
+                </field-constraint>
+            </pattern>
+            <pattern object-type="OtherInspectionMethod">
+                <field-binding field-name="numeroNaoConformidades" identifier="NCNumber"/>
+                <field-constraint field-name="inspAccaoOperacaoID">
+                    <variable-restriction evaluator="==" identifier="inspectionActionOperation"/>
+                </field-constraint>
+            </pattern>
+            <pattern identifier="TheBest" object-type="MelhorEmNaoConformidades">
+                <field-constraint field-name="operacaoID">
+                    <variable-restriction evaluator="==" identifier="operation"/>
+                </field-constraint>
+                <field-constraint field-name="recursoID">
+                    <variable-restriction evaluator="==" identifier="resource"/>
+                </field-constraint>
+                <field-constraint field-name="numeroDefeitos">
+                    <variable-restriction evaluator="&gt;" identifier="NCNumber"/>
+                </field-constraint>
+            </pattern>
+        </lhs>
+        <rhs>TheBest.setNumeroDefeitos(NCNumber);
+TheBest.setOrdemProducaoID(ProductionOrder);
+update(TheBest);
+</rhs>
+    </rule>
+    <rule name="ruleBestParametersCreator">
+        <rule-attribute name="salience" value="-100"/>
+        <lhs>
+            <pattern object-type="MelhorEmNaoConformidades">
+                <field-binding field-name="ordemProducaoID" identifier="$poID"/>
+                <field-binding field-name="numeroDefeitos" identifier="$NC"/>
+            </pattern>
+            <pattern object-type="SetupInUse">
+                <field-binding field-name="setupUseID" identifier="$setup"/>
+                <field-constraint field-name="productionOrderID">
+                    <variable-restriction evaluator="==" identifier="$poID"/>
+                </field-constraint>
+            </pattern>
+            <pattern identifier="$p" object-type="Parameter">
+                <field-binding field-name="parameterID" identifier="$parID"/>
+                <field-constraint field-name="setupUseID">
+                    <variable-restriction evaluator="==" identifier="$setup"/>
+                </field-constraint>
+            </pattern>
+            <not>
+                <pattern object-type="BestParms">
+                    <field-constraint field-name="parameterID">
+                        <variable-restriction evaluator="==" identifier="$parID"/>
+                    </field-constraint>
+                </pattern>
+            </not>
+        </lhs>
+        <rhs>BestParms newBest=new BestParms();
+newBest.setParameterID($parID);
+newBest.setNominalValue(new Float($p.getNominalValue()));
+newBest.setMaxLimit(new Float($p.getMaxLimit()));
+newBest.setMinLimit(new Float($p.getMinLimit()));
+newBest.setMaxLimitAlarm(new Float($p.getMaxLimitAlarm()));
+newBest.setMinLimitAlarm(new Float($p.getMinLimitAlarm()));
+newBest.setNonConformities(new Float($NC));
+insert(newBest);
+</rhs>
+    </rule>
+    <rule name="ruleBestParametersChecker">
+        <rule-attribute name="salience" value="-100"/>
+        <lhs>
+            <pattern object-type="MelhorEmNaoConformidades">
+                <field-binding field-name="ordemProducaoID" identifier="$poID"/>
+                <field-binding field-name="numeroDefeitos" identifier="$NC"/>
+            </pattern>
+            <pattern object-type="SetupInUse">
+                <field-binding field-name="setupUseID" identifier="$setup"/>
+                <field-constraint field-name="productionOrderID">
+                    <variable-restriction evaluator="==" identifier="$poID"/>
+                </field-constraint>
+            </pattern>
+            <pattern identifier="$p" object-type="Parameter">
+                <field-binding field-name="parameterID" identifier="$parID"/>
+                <field-constraint field-name="setupUseID">
+                    <variable-restriction evaluator="==" identifier="$setup"/>
+                </field-constraint>
+            </pattern>
+            <pattern identifier="$newBest" object-type="Parameter">
+                <field-constraint field-name="parameterID">
+                    <variable-restriction evaluator="==" identifier="$parID"/>
+                </field-constraint>
+                <field-constraint field-name="nonConformities">
+                    <variable-restriction evaluator="&gt;" identifier="$NC"/>
+                </field-constraint>
+            </pattern>
+        </lhs>
+        <rhs>$newBest.setNominalValue(new Float(p.getNominalValue()));
+$newBest.setMaxLimit(new Float(p.getMaxLimit()));
+$newBest.setMinLimit(new Float(p.getMinLimit()));
+$newBest.setMaxLimitAlarm(new Float(p.getMaxLimitAlarm()));
+$newBest.setMinLimitAlarm(new Float(p.getMinLimitAlarm()));
+$newBest.setNonConformities(new Float($NC));
+update($newBest);
+</rhs>
+    </rule>
+    <rule name="print">
+        <rule-attribute name="salience" value="-110"/>
+        <lhs>
+            <pattern identifier="bp" object-type="BestParms"> </pattern>
+        </lhs>
+        <rhs>System.out.println("Parameter: "+bp.getParameterID()+" Value: "+bp.getNominalValue()+" NC: "+bp.getNonConformities());
+</rhs>
+    </rule>
+</package>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseExists.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseExists.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseExists.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample" xmlns="http://drools.org/drools-4.0"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+	xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+	
+	<rule name="simple_rule">
+		<lhs>
+			<exists>
+				<pattern object-type="Person">
+					<field-constraint field-name="likes">
+						<variable-restriction evaluator="==" identifier="type"/>
+					</field-constraint>
+				</pattern>
+			</exists>
+
+            <not>
+                <exists>
+                    <pattern object-type="Cheese">
+                        <field-constraint field-name="likes">
+                            <variable-restriction evaluator="==" identifier="type"/>
+                        </field-constraint>
+                    </pattern>
+                </exists>
+            </not>
+		</lhs>
+		<rhs> list.add( $cheese ); </rhs>
+	</rule>
+	
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseForall.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseForall.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseForall.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+
+	<global identifier="results" type="java.util.List" />
+
+<rule name="simple_rule">
+	<rule-attribute name="salience" value="10" />
+	<rule-attribute name="no-loop" value="true" />
+	<rule-attribute name="agenda-group" value="agenda-group" />
+	<rule-attribute name="activation-group" value="activation-group" />
+
+	<lhs>
+        <forall>
+            <pattern object-type="State">
+                <field-binding field-name="state" identifier="state" />
+            </pattern>
+
+            <pattern object-type="Person">
+                <field-constraint field-name="status">
+                    <variable-restriction evaluator="==" identifier="state" />
+                </field-constraint>
+                <field-binding field-name="likes" identifier="likes" />
+            </pattern>
+
+            <pattern object-type="Cheese">
+                <field-binding field-name="type" identifier="likes" />
+            </pattern>
+        </forall>
+
+    </lhs>
+    <rhs>
+		results.add("OK");
+	</rhs>
+</rule>
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+
+	<import name="import java.util.List"/>
+	<import name="org.drools.Cheese" />
+	<import name="org.drools.Cheesery" />
+
+	<global identifier="cheesery" type="Cheesery" />		
+	<global identifier="list1" type="List" />
+
+<rule name="simple_rule">
+	<rule-attribute name="salience" value="10" />
+	<rule-attribute name="no-loop" value="true" />
+	<rule-attribute name="agenda-group" value="agenda-group" />
+	<rule-attribute name="activation-group" value="activation-group" />
+
+	<lhs>
+        <pattern identifier="cheese" object-type="Cheese" >
+            <from>
+                <expression>
+                    cheesery.getCheeses(i+4)
+                 </expression>
+            </from>
+        </pattern>
+    </lhs>
+	<rhs>
+		list1.add( $cheese );
+	</rhs>
+</rule>
+
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+         
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />	
+	
+	<global identifier="x" type="com.sample.X" />		
+	<global identifier="yada" type="com.sample.Yada" />
+	
+	<function return-type="void" name="myFunc">
+	    <parameter identifier="foo" type="Bar" />
+	    <parameter identifier="bada" type="Bing" />
+	    	    
+	    <body>
+	    	System.out.println("hello world");
+		</body>		
+	</function>
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+         
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />	
+	
+	
+	<global identifier="x" type="com.sample.X" />		
+	<global identifier="yada" type="com.sample.Yada" />		
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseImport.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseImport.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseImport.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+         
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />
+    <importfunction name="org.drools.function" />
+    
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+         
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />	
+	
+	<global identifier="x" type="com.sample.X" />		
+	<global identifier="yada" type="com.sample.Yada" />
+	
+	<function return-type="void" name="myFunc">
+	    <parameter identifier="foo" type="Bar" />
+	    <parameter identifier="bada" type="Bing" />
+	    	    
+	    <body>
+	    	System.out.println("hello world");
+		</body>		
+	</function>
+	
+	<rule name="my rule">
+		<lhs>
+
+            <and-conditional-element></and-conditional-element>
+
+            <or-conditional-element></or-conditional-element>
+
+            <pattern object-type="Foo" >
+			</pattern>							
+				
+			<pattern identifier="bar" object-type="Bar" >			
+			</pattern>		
+									
+			<pattern object-type="Foo">
+			    <field-constraint field-name="field1">
+				    <literal-restriction       evaluator="==" value="value1" />
+    				<return-value-restriction  evaluator="==">1==1</return-value-restriction>				    
+	    			<variable-restriction      evaluator="==" identifier="var1" />								
+				</field-constraint>
+											
+				<predicate field-name="field1" identifier="var1">1==1</predicate>
+														
+				<field-binding field-name="field1" identifier="var1" />				
+			</pattern>		
+			
+			<not>
+				<pattern object-type="Bar" />			
+			</not>
+			
+			<exists>
+				<pattern object-type="Bar" />							
+			</exists>		
+			
+			<and-conditional-element>
+                <pattern object-type="Yada"/>
+                <or-conditional-element>
+                    <pattern object-type="Bar"/>
+                </or-conditional-element>
+
+            </and-conditional-element>
+
+            <or-conditional-element>
+                <pattern object-type="Zaa"/>
+                <and-conditional-element>
+                    <pattern object-type="Foo"/>
+                </and-conditional-element>
+            </or-conditional-element>
+			<eval>1==1</eval>
+		</lhs>
+		
+	    <rhs>
+		</rhs>
+	</rule>
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />
+	
+	<global identifier="x" type="com.sample.X" />		
+	<global identifier="yada" type="com.sample.Yada" />
+	
+	<function return-type="void" name="myFunc">
+	    <parameter identifier="foo" type="Bar" />
+	    <parameter identifier="bada" type="Bing" />
+	    	    
+	    <body>
+	    	System.out.println("hello world");
+		</body>		
+	</function>
+	
+	<query name="my query">
+		<lhs>
+	       <pattern object-type="Foo" />							
+		</lhs>		
+	</query>
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+         
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />	
+	
+	<global identifier="x" type="com.sample.X" />		
+	<global identifier="yada" type="com.sample.Yada" />
+	
+	<function return-type="void" name="myFunc">
+	    <parameter identifier="foo" type="Bar" />
+	    <parameter identifier="bada" type="Bing" />
+	    	    
+	    <body>
+	    	System.out.println("hello world");
+		</body>		
+	</function>
+	
+	<rule name="my rule">
+		<lhs>							
+		</lhs>
+		
+	    <rhs>
+	    	System.out.println( "hello" );	    
+		</rhs>
+	</rule>
+</package>
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRule.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRule.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_ParseRule.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<package name="com.sample"
+         xmlns="http://drools.org/drools-4.0"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+
+	<import name="java.util.HashMap" />
+	<import name="org.drools.*" />
+
+	<global identifier="x" type="com.sample.X" />
+	<global identifier="yada" type="com.sample.Yada" />
+
+	<function return-type="void" name="myFunc">
+	    <parameter identifier="foo" type="Bar" />
+	    <parameter identifier="bada" type="Bing" />
+
+	    <body>
+	    	System.out.println("hello world");
+		</body>
+	</function>
+
+<rule name="simple_rule">
+	<rule-attribute name="salience" value="10" />
+	<rule-attribute name="no-loop" value="true" />
+	<rule-attribute name="agenda-group" value="agenda-group" />
+	<rule-attribute name="activation-group" value="activation-group" />
+
+	<lhs>
+		<pattern identifier="foo2" object-type="Bar" >
+            <or-constraint-connective>
+                <and-constraint-connective>
+					<field-constraint field-name="a">
+                        <or-restriction-connective>
+                            <and-restriction-connective>
+                                <literal-restriction evaluator="&gt;" value="60" />
+                                <literal-restriction evaluator="&lt;" value="70" />
+                            </and-restriction-connective>
+                            <and-restriction-connective>
+                                <literal-restriction evaluator="&lt;" value="50" />
+                                <literal-restriction evaluator="&gt;" value="55" />
+                            </and-restriction-connective>
+                        </or-restriction-connective>
+					</field-constraint>
+
+					<field-constraint field-name="a3">
+                        <literal-restriction evaluator="==" value="black" />
+                    </field-constraint>
+                </and-constraint-connective>
+
+                <and-constraint-connective>
+                    <field-constraint field-name="a">
+                        <literal-restriction evaluator="==" value="40" />
+                    </field-constraint>
+
+                    <field-constraint field-name="a3">
+                        <literal-restriction evaluator="==" value="pink" />
+                    </field-constraint>
+                </and-constraint-connective>
+
+                <and-constraint-connective>
+                    <field-constraint field-name="a">
+                        <literal-restriction evaluator="==" value="12"/>
+                    </field-constraint>
+
+                    <field-constraint field-name="a3">
+                        <or-restriction-connective>
+                            <literal-restriction evaluator="==" value="yellow"/>
+                            <literal-restriction evaluator="==" value="blue" />
+                        </or-restriction-connective>
+                    </field-constraint>
+                </and-constraint-connective>
+            </or-constraint-connective>
+        </pattern>
+
+        <not>
+            <pattern object-type="Person">
+                <field-constraint field-name="likes">
+                    <variable-restriction evaluator="==" identifier="type"/>
+                </field-constraint>
+            </pattern>
+
+            <exists>
+                <pattern object-type="Person">
+                    <field-constraint field-name="likes">
+                        <variable-restriction evaluator="==" identifier="type"/>
+                    </field-constraint>
+                </pattern>
+            </exists>
+        </not>
+
+        <or-conditional-element>
+            <pattern identifier="foo3" object-type="Bar" >
+                <field-constraint field-name="a">
+                    <or-restriction-connective>
+                        <literal-restriction evaluator="==" value="3" />
+                        <literal-restriction evaluator="==" value="4" />
+                    </or-restriction-connective>
+                </field-constraint>
+                <field-constraint field-name="a3">
+                    <literal-restriction evaluator="==" value="hello" />
+                </field-constraint>
+                <field-constraint field-name="a4">
+                    <literal-restriction evaluator="==" value="null" />
+                </field-constraint>
+            </pattern>
+
+            <pattern identifier="foo4" object-type="Bar" >
+                <field-binding field-name="a" identifier="a4" />
+                <field-constraint field-name="a">
+                    <literal-restriction evaluator="!=" value="4" />
+                    <literal-restriction evaluator="!=" value="5" />
+                </field-constraint>
+            </pattern>
+        </or-conditional-element>
+
+        <pattern identifier="foo5" object-type="Bar" >
+            <field-constraint field-name="b">
+                <or-restriction-connective>
+                    <return-value-restriction evaluator="==" >a4 + 1</return-value-restriction>
+                    <variable-restriction evaluator="&gt;" identifier="a4" />
+                    <qualified-identifier-restriction evaluator="==">
+                        org.drools.Bar.BAR_ENUM_VALUE
+                    </qualified-identifier-restriction>
+                </or-restriction-connective>
+            </field-constraint>
+        </pattern>
+
+        <pattern identifier="foo6" object-type="Bar" >
+			<field-binding field-name="a" identifier="a4" />
+			<field-constraint field-name="b">
+				<literal-restriction evaluator="==" value="6" />
+			</field-constraint>
+		</pattern>
+
+		<pattern identifier="foo7" object-type="Bar" >
+			<field-binding field-name="a" identifier="a4" />
+			<field-binding field-name="b" identifier="b4" />
+		</pattern>
+		<pattern object-type="Baz" > </pattern>
+	</lhs>
+	<rhs>
+		  if ( a == b ) {
+		    assert( foo3 );
+		  } else {
+		    retract( foo4 );
+		  }
+		  System.out.println( a4 );
+	</rhs>
+</rule>
+
+<rule name="Check_NotNullof_rfqId">
+
+<rule-attribute name="agenda-group" value="Check" />
+
+<lhs><pattern object-type="RFQBean" >
+
+<or-constraint-connective><field-constraint field-name="m_rfqId">
+
+<literal-restriction evaluator="==" value="null" />
+
+</field-constraint>
+
+<field-constraint field-name="m_rfqId">
+
+<literal-restriction evaluator="==" value="" />
+
+</field-constraint>
+
+</or-constraint-connective>
+
+</pattern>
+
+</lhs><rhs> response.setStatus("For RFQ Bean: The value of m_rfqId is null.");
+
+System.out.println(response.getStatus());
+
+</rhs>
+
+</rule>
+
+</package>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,61 @@
+package foo;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.utilArrayList;
+
+global HashMap m;
+global HashSet s;
+global org.drools.Person p;
+
+import function org.drools.xml.DumperTest.testStaticMethod1;
+import function org.drools.xml.DumperTest.testStaticMethod2;
+import function org.drools.xml.DumperTest.testStaticMethod3;
+
+rule "simple_rule"
+  salience 10
+  no-loop true
+  agenda-group "agenda-group"
+  activation-group "activation-group"
+  ruleflow-group "xxx"
+  lock-on-active true
+  auto-focus true
+  date-effective "01-Jan-2007"
+  date-expires "01-Feb-2007"    
+  when
+    foo2 : Bar( a ( > 60 && < 70 ) || ( > 50 && < 55 ) && a3 == "black" || a == 40 && a3 == "pink" || a == 12 && a3 == "yellow" || a3 == "blue")
+    foo3 : Bar( a == 3 || == 4, a3 == "hello", a4 == null )    
+    foo4 : Bar( a4 : a != 4 && != 5)
+    foo5 : Bar( b == (a4 + 1) || > a4)    
+    foo6 : Bar( a4 : a, b == 6)    
+    foo7 : Bar( a4 : a, b4 : b)    
+    $cheeseList  : ArrayList(size > 2) from collect( Cheese( type == $likes ) );    
+    Baz()
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+  testStaticMethod1();
+  testStaticMethod2();
+  testStaticMethod3();
+end
+
+rule "simple_rule2"
+  salience (10 + a)
+  dialect "mvel"    
+  when    
+    foo4 : Bar( a4 : a != 4 && != 5)
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+  testStaticMethod1();  
+  testStaticMethod2();
+  testStaticMethod3();  
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<package name="foo"  
+	xmlns="http://drools.org/drools-4.0" 
+	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
+	xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd"> 
+<import name="java.util.HashMap" /> 
+<import name="java.util.HashSet" /> 
+<import name="java.utilArrayList" /> 
+
+<global identifier="m" type="HashMap" />
+<global identifier="s" type="HashSet" />
+<global identifier="p" type="org.drools.Person" />
+
+<importfunction name="org.drools.xml.DumperTest.testStaticMethod1"/>
+<importfunction name="org.drools.xml.DumperTest.testStaticMethod2"/>
+<importfunction name="org.drools.xml.DumperTest.testStaticMethod3"/>
+
+
+<rule name="simple_rule">
+<rule-attribute name="salience" value="10" />
+<rule-attribute name="no-loop" value="true" />
+<rule-attribute name="agenda-group" value="agenda-group" />
+<rule-attribute name="activation-group" value="activation-group" />
+<rule-attribute name="ruleflow-group" value="xxx" />
+<rule-attribute name="lock-on-active" value="true" />
+<rule-attribute name="auto-focus" value="true" />
+<rule-attribute name="date-effective" value="01-Jan-2007" />
+<rule-attribute name="date-expires" value="01-Feb-2007" />
+
+<lhs><pattern identifier="foo2" object-type="Bar" >
+<or-constraint-connective><and-constraint-connective><field-constraint field-name="a"> 
+<or-restriction-connective><and-restriction-connective><literal-restriction evaluator="&gt;" value="60" />
+
+<literal-restriction evaluator="&lt;" value="70" />
+
+
+</and-restriction-connective>
+<and-restriction-connective><literal-restriction evaluator="&gt;" value="50" />
+
+<literal-restriction evaluator="&lt;" value="55" />
+
+
+</and-restriction-connective>
+
+</or-restriction-connective>
+</field-constraint>
+<field-constraint field-name="a3"> 
+<literal-restriction evaluator="==" value="black" />
+
+</field-constraint>
+
+</and-constraint-connective>
+<and-constraint-connective><field-constraint field-name="a"> 
+<literal-restriction evaluator="==" value="40" />
+
+</field-constraint>
+<field-constraint field-name="a3"> 
+<literal-restriction evaluator="==" value="pink" />
+
+</field-constraint>
+
+</and-constraint-connective>
+<and-constraint-connective><field-constraint field-name="a"> 
+<literal-restriction evaluator="==" value="12" />
+
+</field-constraint>
+<field-constraint field-name="a3"> 
+<literal-restriction evaluator="==" value="yellow" />
+
+</field-constraint>
+
+</and-constraint-connective>
+<field-constraint field-name="a3"> 
+<literal-restriction evaluator="==" value="blue" />
+
+</field-constraint>
+
+</or-constraint-connective>
+
+
+</pattern>
+
+<pattern identifier="foo3" object-type="Bar" >
+<field-constraint field-name="a"> 
+<or-restriction-connective><literal-restriction evaluator="==" value="3" />
+
+<literal-restriction evaluator="==" value="4" />
+
+
+</or-restriction-connective>
+</field-constraint>
+<field-constraint field-name="a3"> 
+<literal-restriction evaluator="==" value="hello" />
+
+</field-constraint>
+<field-constraint field-name="a4"> 
+<literal-restriction evaluator="==" value="null" />
+
+</field-constraint>
+
+
+</pattern>
+
+<pattern identifier="foo4" object-type="Bar" >
+<field-binding field-name="a" identifier="a4" />
+
+<field-constraint field-name="a"> 
+<literal-restriction evaluator="!=" value="4" />
+<literal-restriction evaluator="!=" value="5" />
+
+</field-constraint>
+
+
+</pattern>
+
+<pattern identifier="foo5" object-type="Bar" >
+<field-constraint field-name="b"> 
+<or-restriction-connective><return-value-restriction evaluator="==" >a4 + 1</return-value-restriction>
+
+<variable-restriction evaluator="&gt;" identifier="a4" />
+
+
+</or-restriction-connective>
+</field-constraint>
+
+
+</pattern>
+
+<pattern identifier="foo6" object-type="Bar" >
+<field-binding field-name="a" identifier="a4" />
+
+<field-constraint field-name="b"> 
+<literal-restriction evaluator="==" value="6" />
+
+</field-constraint>
+
+
+</pattern>
+
+<pattern identifier="foo7" object-type="Bar" >
+<field-binding field-name="a" identifier="a4" />
+
+<field-binding field-name="b" identifier="b4" />
+
+
+
+</pattern>
+
+<pattern identifier="$cheeseList" object-type="ArrayList" >
+<field-constraint field-name="size"> 
+<literal-restriction evaluator="&gt;" value="2" />
+
+</field-constraint>
+
+
+<from> <collect><pattern object-type="Cheese" >
+<field-constraint field-name="type"> 
+<variable-restriction evaluator="==" identifier="$likes" />
+
+</field-constraint>
+
+
+</pattern>
+ </collect> </from> </pattern>
+
+<pattern object-type="Baz" >
+
+
+</pattern>
+
+
+</lhs>
+
+<rhs>  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+  testStaticMethod1();
+  testStaticMethod2();
+  testStaticMethod3();
+</rhs>
+
+
+</rule>
+
+<rule name="simple_rule2">
+<rule-attribute name="salience" value="(10 + a)" />
+<rule-attribute name="dialect" value="mvel" />
+
+<lhs><pattern identifier="foo4" object-type="Bar" >
+<field-binding field-name="a" identifier="a4" />
+
+<field-constraint field-name="a"> 
+<literal-restriction evaluator="!=" value="4" />
+<literal-restriction evaluator="!=" value="5" />
+
+</field-constraint>
+
+
+</pattern>
+
+
+</lhs><rhs>  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+  testStaticMethod1();  
+  testStaticMethod2();
+  testStaticMethod3();  
+</rhs>
+</rule>
+</package>

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_accumulateall.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_accumulateall.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_accumulateall.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,79 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+import org.drools.Cheesery;
+
+global java.util.List results;
+
+rule "AccumulateTest" salience 100
+    when
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println("Total amount = US$ "+$totalAmount );
+        results.add($totalAmount);
+end  
+
+rule "Accumulate with Bindings" salience 90
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes ),
+                                                  init( int total = 0; ),
+   	                                          action( total += $cheese.getPrice(); ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end  
+
+rule "Constraints everywhere" salience 80
+    when
+        $person      : Person( $likes : likes )
+    	$cheesery    : Cheesery( totalAmount > 100 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes ),
+                                                init( Cheesery cheesery = new Cheesery(); ),
+    	                                        action( cheesery.addCheese( $cheese ); ),
+                                                result( cheesery ) );
+    then
+        //System.out.println($person.getName() +" is spending a lot buying cheese ( US$ "+$cheesery.getTotalAmount()+" )!");
+        results.add(new Integer($cheesery.getTotalAmount()));
+end  
+
+rule "Source pattern binds" salience 70
+    when
+        $person      : Person( name == "Bob", $likes : likes )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price: price ),
+                                                  init( int total = 0; ),
+    	                                          action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        //System.out.println($person.getName() +" will spend US$ "+ $totalAmount + " buying cheese");
+        results.add($totalAmount);
+end
+
+rule "Accumulate with previous Bindings" salience 60
+    when
+        $person      : Person( name == "Bob", $likes : likes, $age : age )
+    	$totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                  init( int total = $age * 10; ),
+   	                                              action( total += $price; ),
+                                                  result( new Integer( total ) ) );
+    then
+        results.add($totalAmount);
+end  
+
+
+rule "External Function" salience 80
+    when
+        $person : Person( $likes : likes )
+    	$max    : Number( intValue >= 5 ) 
+    	                       from accumulate( $cheese : Cheese( type == $likes, $price : price ),
+                                                max( $price ) );
+    then
+        results.add( $max );
+end  
+
+

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_complex.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_complex.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_complex.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,83 @@
+package rules;
+
+
+import pt.inescporto.cec.entities.SetupUse;
+import pt.inescporto.cec.entities.SetupInUse;
+import pt.inescporto.cec.entities.Parameter;
+import pt.inescporto.cec.entities.OrdemFabrico;
+import pt.inescporto.cec.entities.AccaoInspeccao;
+import pt.inescporto.cec.entities.AccaoInspeccaoOperacao;
+import pt.inescporto.cec.entities.MelhorEmNaoConformidades;
+import pt.inescporto.cec.entities.OtherInspectionMethod;
+import pt.inescporto.cec.entities.BestParms;
+
+
+rule "ruleBestProductionOrderCreator"
+when
+		AccaoInspeccao( artigoID == 3 , $operID: operacaoID , $resourceID: recursoID, $ProdOrderID: ordemProducaoID, $IAID: accaoInspeccaoID  )
+		AccaoInspeccaoOperacao( inspectionActionID == $IAID, $tmp: inspAccaoOperacaoID  )
+		OtherInspectionMethod(inspActionOperacaoID == $tmp, $NCNumber: numeroNaoConformidades   )
+		not (MelhorEmNaoConformidades( operacaoID == $operID, recursoID == $resourceID ) ) 
+	then
+		insert(new MelhorEmNaoConformidades($ProdOrderID,$NCNumber,$operID,$resourceID));
+end
+	
+rule "ruleBestProductionOrderChecker"
+when
+		AccaoInspeccao( artigoID ==3 , $operID: operacaoID, $resourceID: recursoID, $ProdOrderID: ordemProducaoID, $IAID: accaoInspeccaoID  )
+		AccaoInspeccaoOperacao( inspectionActionID == $IAID, $tmp: inspAccaoOperacaoID  )
+		OtherInspectionMethod( inspActionOperacaoID == $tmp, $NCNumber: numeroNaoConformidades   )
+		$t: MelhorEmNaoConformidades( operacaoID == $operID, recursoID == $resourceID, numeroDefeitos > $NCNumber )
+	then
+		$t.setNumeroDefeitos($NCNumber);
+		$t.setOrdemProducaoID($ProdOrderID);
+		update($t);
+end
+
+rule "ruleBestParametersCreator"
+salience -100
+when
+	MelhorEmNaoConformidades($poID: ordemProducaoID, $nonConformities: numeroDefeitos )	
+	SetupInUse( $setup: setupUseID , productionOrderID == $poID )
+	p: Parameter( $parID: parameterID,  setupUseID == $setup )
+	not (BestParms( parameterID == $parID ))
+then
+	BestParms newBest=new BestParms();
+	newBest.setParameterID($parID);
+	newBest.setNominalValue(new Float(p.getNominalValue()));
+	newBest.setMaxLimit(new Float(p.getMaxLimit()));
+	newBest.setMinLimit(new Float(p.getMinLimit()));
+	newBest.setMaxLimitAlarm(new Float(p.getMaxLimitAlarm()));
+	newBest.setMinLimitAlarm(new Float(p.getMinLimitAlarm()));
+	newBest.setNonConformities($nonConformities);
+	insert(newBest);
+end
+
+rule "ruleBestParametersChecker"
+salience -10
+when
+	MelhorEmNaoConformidades($poID: ordemProducaoID, $NC: numeroDefeitos )	
+	SetupInUse( $setup: setupUseID , productionOrderID == $poID )
+	p: Parameter( $parID: parameterID,  setupUseID == $setup )
+	newBest: BestParms( parameterID == $parID, nonConformities > $NC )
+then
+	newBest.setNominalValue(new Float(p.getNominalValue()));
+	newBest.setMaxLimit(new Float(p.getMaxLimit()));
+	newBest.setMinLimit(new Float(p.getMinLimit()));
+	newBest.setMaxLimitAlarm(new Float(p.getMaxLimitAlarm()));
+	newBest.setMinLimitAlarm(new Float(p.getMinLimitAlarm()));
+	newBest.setNonConformities($NC);
+	update(newBest);
+end
+
+rule "print"
+salience -20
+when 
+	bp: BestParms(  )
+then
+	System.out.println("Parameter: "+bp.getParameterID()+" Value: "+bp.getNominalValue()+" NC: "+bp.getNonConformities());
+end
+
+query "get results"
+		mnc: BestParms(  )
+end
\ No newline at end of file

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_from.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_from.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_from.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,25 @@
+package org.drools.test;
+ 
+import org.drools.Cheese;
+import org.drools.Cheesery;
+import java.util.List;
+
+global List list1;
+global List list2;
+global List list3;
+global Cheesery cheesery;
+
+rule "test from using a global"
+	when
+		$cheese : Cheese() from cheesery.getCheeses()		
+	then
+		list1.add( $cheese );
+end
+
+rule "test from using a global against a map lookup"
+	when
+	    Person( $stilton : type == "stilton" )
+		$cheese : Cheese( type == $stilton ) from cheesery.getCheeseMap["stilton"]	
+	then
+		list1.add( $cheese );
+end

Added: labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_simplerule.drl
===================================================================
--- labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_simplerule.drl	                        (rev 0)
+++ labs/jbossrules/branches/temporal_rete/drools-compiler-window/src/test/resources/org/drools/xml/rules/test_simplerule.drl	2008-04-21 09:22:48 UTC (rev 19663)
@@ -0,0 +1,15 @@
+package foo;
+
+rule "simple_rule" 
+  when
+    foo3 : Bar(a==3)
+    foo4 : Bar(a4:a==4)
+    Baz()
+  then
+  if ( a == b ) {
+    assert( foo3 );
+  } else {
+    retract( foo4 );
+  } 
+  System.out.println( a4 );
+end
\ No newline at end of file




More information about the jboss-svn-commits mailing list