Java Doc for Term.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » rules » engine » 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 » ERP CRM Financial » SourceTap CRM » org.ofbiz.rules.engine 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.ofbiz.rules.engine.Term

All known Subclasses:   org.ofbiz.rules.engine.Structure,
Term
public interface Term (Code)

Title: Term

Description: None

Copyright (c) 1999 Steven J. Metsker.

Copyright (c) 2001 The Open For Business Project - www.ofbiz.org

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The Term interface defines the core elements of the logic engine.

Terms are the central objects in the logic programming data model, which is basically as follows:

  • A Program is a collection of Rules.
  • A Rule is a series of Structures.
  • A Structure is an Object associated with a collection of Terms.
  • Structures and Variables are Terms.

The statement that "Structures and Variables are Terms" has both a loose meaning and a literal meaning. Loosely, the statement means that the contents of a structure are other structures and variables. For example, the terms of plays(jim, Game) are the structure jim and the variable Game. The literal meaning is that class Structure and class Variable implement the interface Term.

In addition to residing at the core of the data model, the Term interface also defines unification. Unification is a kind of matching, and is the basic step in the execution of a logic program. Roughly speaking, two structures can unify if their variables can take on values to make the structures equal. To prove itself against a program, a Structure:

  • Unifies with the head of a Rule.
  • Asks the Rule to prove its remaining structures.
This simple algorithm is the execution model of a logic engine. A structure can unify with another structure if their functors are equal, and if their terms can unify. An uninstantiated variable unifies with a term by instantiating to it. An instantiated variable can unify with another term if its instantiation can unify with the term.

The other methods declared by the Term interface define behavior that must exist in all terms, whether they are structures or variables. This behavior includes a method for creating provable version of a term, and a method for returning the value of term in a function.
author:
   Steven J. Metsker
version:
   1.0





Method Summary
 TermcopyForProof(AxiomSource as, Scope scope)
     Returns a copy of the term for use in a proof.

When a structure proves itself against a program, it unifies with the head of a rule in the program, and then asks the remaining structures in that rule to prove themselves.

 Objecteval()
     The value that this term should present to an evaluating function.
 booleanisList()
    
 StringlistTailString()
     Returns a string representation of this listTailTerm.
 Unificationunify(Structure s)
     Returns a collection of variables that allow this term to unify with a structure.
 Unificationunify(Term t)
     Returns a set of variable instantiations that allow two terms to unify.

When a term unifies with another term, the necessary behavior can be different depending on whether the objects involved are structures or variables.

 Unificationunify(Variable v)
     Returns a collection of variables that allow this term to unify with a variable.
 Unificationvariables()
     Returns the variables associated with this term.

For a variable, this method returns a unification that contains just the variable itself.




Method Detail
copyForProof
Term copyForProof(AxiomSource as, Scope scope)(Code)
Returns a copy of the term for use in a proof.

When a structure proves itself against a program, it unifies with the head of a rule in the program, and then asks the remaining structures in that rule to prove themselves. For this to work, the rule has to provide a proving copy, which has a new Scope. To provide a proving copy, a rule needs proving copies of its structures, and ultimately every term needs to be able to produce such a copy.
Parameters:
  PosultateSource - where the term can look for rules
Parameters:
  Scope - variables for the provable rule copy a provable copy of this Term, that will use thesupplied axiom source and scope




eval
Object eval()(Code)
The value that this term should present to an evaluating function. the value that this term should present to anevaluating function, such as an ArithmeticOperator.



isList
boolean isList()(Code)
Return true, if this term is a list true, if this term is a list



listTailString
String listTailString()(Code)
Returns a string representation of this listTailTerm. That is, return a string representation of this term, given that it is the tail of a list. a string representation of this listTailTerm



unify
Unification unify(Structure s)(Code)
Returns a collection of variables that allow this term to unify with a structure.
Parameters:
  Structure - the structure to unify with a collection of variables that allow this termto unify with a structure



unify
Unification unify(Term t)(Code)
Returns a set of variable instantiations that allow two terms to unify.

When a term unifies with another term, the necessary behavior can be different depending on whether the objects involved are structures or variables. To allow the right behavior to occur, the Term interface defines two unify methods. This allows an implementing class to use a "double dispatching" scheme to get the right behavior for unification.

Structure.unify(Term t) employs double dispatching by returning t.unify(this). This is a call to an implementation of unify(Structure s), which is a different method from than unify(Term t). The receiver thus knows it is unifying with a Structure and can act accordingly.

Structure implements unify(Structure s) to provide the unification of two structures. That is, it returns the combined unification of its terms with the other structure's terms, provided both have the same functor.

Variable implements both its unify() methods the same way. If the variable is uninstantiated, is instantiates to the supplied term. If the variable is already instantiated, it returns the unification of its instantiation with the supplied term.

Unification of an uninstantiated variable always succeeds. If a variable is instantiated, its success at unification depends on its instantiation. Unification of two structures succeeds if the structures have equal functors, the same number of terms, and if all their terms unify successfully. When unification fails, the unify methods return null.
Parameters:
  Term - a term to unify with Unification a collection of variable assignmentsthat allow the unification to succeed




unify
Unification unify(Variable v)(Code)
Returns a collection of variables that allow this term to unify with a variable.
Parameters:
  Variable - the variable to unify with a collection of variables that allow this term tounify with a variable



variables
Unification variables()(Code)
Returns the variables associated with this term.

For a variable, this method returns a unification that contains just the variable itself. For a structure, this method returns a collection of the variables from each of its terms. For example, the variables in

 address(street(Street), city(City), state(State))
 
are Street, City, State. the variables associated with this term



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