Java Doc for GenericEventHandler.java in  » Rule-Engine » zilonis » org » zilonis » shell » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Rule Engine » zilonis » org.zilonis.shell 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.zilonis.shell.GenericEventHandler

All known Subclasses:   org.zilonis.tool.ui.AnalysisToolParserEventHandler,
GenericEventHandler
public class GenericEventHandler implements ParserEventHandler(Code)


Field Summary
protected  PrintStreamconsole
    
final protected static  Loggerlogger
    
protected  booleanprettyPrint
    
protected  Reterete
    
protected  Scopescope
    
protected  PrintStreamstderr
    

Constructor Summary
public  GenericEventHandler(Rete rete)
    
public  GenericEventHandler(Rete rete, PrintStream console)
    

Method Summary
protected  ActionactionTemplate(String strId, int type, String clazz, AST child)
    
protected  ActionactionTemplateForClass(String strId, int type, String clazz, AST child)
    
public  voidaddProduction(String name, int salience, Condition condition, Action action)
    
protected  ConditionaddRemainingAttributes(String id, LinkedList<AttributeValuePair> attributesList, Condition condition)
    
public  voidassertTriplet(Triplet triplet)
    
protected  ConditionconditionTemplate(String id, String clazz, AST child)
    
protected  ConditionconditionTemplateForClass(String id, String clazz, AST child)
    
public  voiddefineAnonymousFact(String id, String clazz, AST template)
    
public  voiddefineClassFact(String id, String clazz, AST template)
    
public  voiddefineFact(AST template)
    
public  ConditiondefineRule(String name, int salience, AST conditionList, AST actionList)
    
public  voidendDocument()
    
public  voiderror(Exception e, String message)
    
protected  ActiongetAction(int id, AST action, HashMap<String, Entity> symbolTable)
    
protected  ActiongetActionList(AST actionList, HashMap<String, Entity> symbolTable)
    
protected  ActiongetActionTemplate(int id, int type, AST actionTemplate)
    
protected  ConditiongetAssignmentCondition(String id, AST condition, AST action, HashMap<String, Entity> symbolTable)
     generates the conditions for an assignment on the left hand side example: (defrule wholesalerPricing ?x <- (SKU (wholesalerOnly true) (sellPrice ?price)) => (modify ?x (sellPrice 0) (listPrice (* ?price 0.75) (discountPrice (* 0.5 ?price)))) needs to be: (defrule wholesalerPricing (?id clazz SKU) // getConditionTemplate returns from here (?id wholesalerOnly true) (?id sellPrice ?price) // to here (?id listPrice ?id_var_1) (?id discountPrice ?id_var_2) => (retract (?id listPrice ?id_var_1)) (retract (?id discountPrice ?id_var_2)) (retract (?id sellPrice ?price)) (assert (?id sellPrice 0)) (assert (?id listPrice (* ?price 0.75))) (assert (?id discountPrice (* ?price 0.5)))) for achieving that, we first iterate over the actions to select the attributes that will be modified on the selected object.
protected  LinkedList<AttributeValuePair>getAttributesThatModifyActionsUseFromVariable(String id, String variable, AST action)
    
protected  ConditiongetCondition(IdGenerator idGenerator, AST condition, AST action, HashMap<String, Entity> symbolTable)
    
protected  ConditiongetConditionList(AST conditionList, AST actionList, HashMap<String, Entity> symbolTable)
    
protected  ConditiongetConditionList(IdGenerator idGenerator, AST conditionList, AST actionList, HashMap<String, Entity> symbolTable)
    
protected  ConditiongetConditionTemplate(String id, AST conditionTemplate)
    
protected  ActiongetExpressionAction(int id, AST action, HashMap<String, Entity> symbolTable)
    
protected  ActiongetModifyAction(AST action, HashMap<String, Entity> symbolTable)
    
public  RetegetRete()
    
protected  ActiongetRetractAction(Condition c)
    
public  ScopegetScope()
    
public  ConditiongetTestCondition(AST condition)
    
public  String[]getVariables(AST ast)
    
public  WMEjumpUntilNewId(WME wme)
    
public  voidlink()
    
public  voidlistFacts()
    
public  voidloadFile(AST filename)
    
public  voidnoPrettyPrint()
    
public  voidprettyPrint()
    
protected  voidreplace(LinkedList<AttributeValuePair> attributesList, String attribute, String value)
    
protected  voidreplaceAttributesThatAreInConditions(LinkedList<AttributeValuePair> attributesList, Condition condition)
    
public  voidretractAllFacts()
    
public  voidretractTriplet(Triplet triplet)
    
public  voidrun()
    
protected  voidsetConditionsAndSalienceTo(Action action, Condition earlierCondition, int salience)
    
public  voidsetConsole(PrintStream console)
    
public  voidsetScope(Scope scope)
    
public  voidstartDocument()
    
public  voidunlink()
    

Field Detail
console
protected PrintStream console(Code)



logger
final protected static Logger logger(Code)



prettyPrint
protected boolean prettyPrint(Code)



rete
protected Rete rete(Code)



scope
protected Scope scope(Code)



stderr
protected PrintStream stderr(Code)




Constructor Detail
GenericEventHandler
public GenericEventHandler(Rete rete)(Code)



GenericEventHandler
public GenericEventHandler(Rete rete, PrintStream console)(Code)




Method Detail
actionTemplate
protected Action actionTemplate(String strId, int type, String clazz, AST child)(Code)



actionTemplateForClass
protected Action actionTemplateForClass(String strId, int type, String clazz, AST child)(Code)



addProduction
public void addProduction(String name, int salience, Condition condition, Action action)(Code)



addRemainingAttributes
protected Condition addRemainingAttributes(String id, LinkedList<AttributeValuePair> attributesList, Condition condition)(Code)
This method adds the new required conditions to allow the modify actions remove the correct WME



assertTriplet
public void assertTriplet(Triplet triplet)(Code)



conditionTemplate
protected Condition conditionTemplate(String id, String clazz, AST child)(Code)



conditionTemplateForClass
protected Condition conditionTemplateForClass(String id, String clazz, AST child)(Code)



defineAnonymousFact
public void defineAnonymousFact(String id, String clazz, AST template)(Code)



defineClassFact
public void defineClassFact(String id, String clazz, AST template)(Code)



defineFact
public void defineFact(AST template)(Code)



defineRule
public Condition defineRule(String name, int salience, AST conditionList, AST actionList)(Code)



endDocument
public void endDocument()(Code)



error
public void error(Exception e, String message)(Code)



getAction
protected Action getAction(int id, AST action, HashMap<String, Entity> symbolTable)(Code)



getActionList
protected Action getActionList(AST actionList, HashMap<String, Entity> symbolTable)(Code)



getActionTemplate
protected Action getActionTemplate(int id, int type, AST actionTemplate)(Code)



getAssignmentCondition
protected Condition getAssignmentCondition(String id, AST condition, AST action, HashMap<String, Entity> symbolTable)(Code)
generates the conditions for an assignment on the left hand side example: (defrule wholesalerPricing ?x <- (SKU (wholesalerOnly true) (sellPrice ?price)) => (modify ?x (sellPrice 0) (listPrice (* ?price 0.75) (discountPrice (* 0.5 ?price)))) needs to be: (defrule wholesalerPricing (?id clazz SKU) // getConditionTemplate returns from here (?id wholesalerOnly true) (?id sellPrice ?price) // to here (?id listPrice ?id_var_1) (?id discountPrice ?id_var_2) => (retract (?id listPrice ?id_var_1)) (retract (?id discountPrice ?id_var_2)) (retract (?id sellPrice ?price)) (assert (?id sellPrice 0)) (assert (?id listPrice (* ?price 0.75))) (assert (?id discountPrice (* ?price 0.5)))) for achieving that, we first iterate over the actions to select the attributes that will be modified on the selected object. From those actions we get the variables. In the above example that would include listPrice and discountPrice. This operation is done in getAttributesThatModifyActionsUseFromVariable After that, we modify the attributes that are already in use in the conditions. Then we add the attributes that were left as another condition to the condition list. and finally creating the entity for the symbol table to be use when generating the actions



getAttributesThatModifyActionsUseFromVariable
protected LinkedList<AttributeValuePair> getAttributesThatModifyActionsUseFromVariable(String id, String variable, AST action)(Code)
this method returns the that the modify actions modify on the specified variables the values are generated dynamically based on the id



getCondition
protected Condition getCondition(IdGenerator idGenerator, AST condition, AST action, HashMap<String, Entity> symbolTable)(Code)



getConditionList
protected Condition getConditionList(AST conditionList, AST actionList, HashMap<String, Entity> symbolTable)(Code)



getConditionList
protected Condition getConditionList(IdGenerator idGenerator, AST conditionList, AST actionList, HashMap<String, Entity> symbolTable)(Code)



getConditionTemplate
protected Condition getConditionTemplate(String id, AST conditionTemplate)(Code)



getExpressionAction
protected Action getExpressionAction(int id, AST action, HashMap<String, Entity> symbolTable)(Code)



getModifyAction
protected Action getModifyAction(AST action, HashMap<String, Entity> symbolTable)(Code)



getRete
public Rete getRete()(Code)



getRetractAction
protected Action getRetractAction(Condition c)(Code)



getScope
public Scope getScope()(Code)



getTestCondition
public Condition getTestCondition(AST condition)(Code)



getVariables
public String[] getVariables(AST ast)(Code)



jumpUntilNewId
public WME jumpUntilNewId(WME wme)(Code)



link
public void link()(Code)



listFacts
public void listFacts()(Code)



loadFile
public void loadFile(AST filename)(Code)



noPrettyPrint
public void noPrettyPrint()(Code)



prettyPrint
public void prettyPrint()(Code)



replace
protected void replace(LinkedList<AttributeValuePair> attributesList, String attribute, String value)(Code)



replaceAttributesThatAreInConditions
protected void replaceAttributesThatAreInConditions(LinkedList<AttributeValuePair> attributesList, Condition condition)(Code)
We check each condition to make sure that the conditions that were already in the rule are not define twice



retractAllFacts
public void retractAllFacts()(Code)



retractTriplet
public void retractTriplet(Triplet triplet)(Code)



run
public void run()(Code)



setConditionsAndSalienceTo
protected void setConditionsAndSalienceTo(Action action, Condition earlierCondition, int salience)(Code)



setConsole
public void setConsole(PrintStream console)(Code)



setScope
public void setScope(Scope scope)(Code)



startDocument
public void startDocument()(Code)



unlink
public void unlink()(Code)
Used by the UI tools To unlink the creation of rules from the UI



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.