Java Doc for Variable.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) 


java.lang.Object
   org.ofbiz.rules.engine.Variable

All known Subclasses:   org.ofbiz.rules.logikus.Anonymous,  org.ofbiz.rules.engine.Anonymous,
Variable
public class Variable implements ArithmeticTerm,ComparisonTerm(Code)

Title: Variable

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.

A variable is a named term that can unify with other terms.

A variable has a name, such as "X" or "Person", and an instantiation. When a variable unifies with a term, it "instantiates" to it, taking the term as its value. The instantiation of a variable may be another variable, or a structure.

The scope of a variable is the rule in which it is contained. For example, consider the member program:

 member(X, [X | Rest]);
 member(X, [Y | Rest]) :- member(X, Rest);
 
In this program, the variable "X" in the first rule is the same variable both times it appears in the rule. However, this variable is completely independent of the variable named "X" in the second rule. Variables with the same name in a rule are the same variable, but variables with the same name in different rules are different variables. This is another way of saying that a variable's scope is the rule in which it appears.

To be more specific, the scope of a variable is the dynamic rule in which the variable appears. Since rules may execute recursively, dynamic rules each need an independent copy of a defining rule's variables. In the member program, for example, the second rule may prove itself by reinvoking itself, with a (slightly) different set of variable instantiations.

Consider the query member(c, [a, b, c]). This query will unify with the second rule, and try to prove the second rule's tail, which will be member(c, [b, c]). This structure will try to prove itself, and it too will unify with the second rule. At this point, the proof of member(c, [a, b, c]) will be waiting upon the proof of member(c, [b, c]). That is, the two dynamic copies of the rule, will be in different states, because of their variables. For example, the instantiation of Rest in the first execution of the rule will be [b, c], and the value of Rest in the second rule will [c].

Variables have a name and an instantiation which is unique within a scope; each dynamic version of a rule has a unique Scope.
author:
   Steven J. Metsker
version:
   1.0



Field Summary
protected  Terminstantiation
    
final public  Stringname
    

Constructor Summary
public  Variable(String name)
     Create a variable with the given name.

Method Summary
public  TermcopyForProof(AxiomSource ignored, Scope scope)
     Create a copy that uses the provided scope.
public  StringdefinitionString()
     Returns string representation of this variable, showing both its name and its value.
public  booleanequals(Object o)
     Returns true if the supplied object is an equivalent variable.
public  Objecteval()
     Returns the value of this variable.
public  booleanisList()
     Returns true if this variable is uninstantiated, or if it contains a list.
public  StringlistTailString()
     Returns a string representation of this variable as the tail of a list.
public  StringtoString()
     Returns a string representation of this variable.
public  voidunbind()
     Marks this variable as no longer having an instantiated value.
public  Unificationunify(Structure s)
     Instantiates this variable with the supplied structure, or forwards the request to its instantiation if it already has one.
Parameters:
  Structure - a structure to unify with a unification.
public  Unificationunify(Term t)
     Unifies this variable with the supplied term.

This method dispatches the unify request to either a structure or a variable.

public  Unificationunify(Variable v)
     Instantiates this variable with the supplied variable, or forwards the request to its instantiation if it already has one.
public  Unificationvariables()
     Returns a unification containing just this variable.

Field Detail
instantiation
protected Term instantiation(Code)



name
final public String name(Code)




Constructor Detail
Variable
public Variable(String name)(Code)
Create a variable with the given name.




Method Detail
copyForProof
public Term copyForProof(AxiomSource ignored, Scope scope)(Code)
Create a copy that uses the provided scope.
Parameters:
  AxiomSource - ignored
Parameters:
  Scope - the scope to use for variables in thecopy a copy that uses the provided scope



definitionString
public String definitionString()(Code)
Returns string representation of this variable, showing both its name and its value. a string representation of this variable, showingboth its name and its value.



equals
public boolean equals(Object o)(Code)
Returns true if the supplied object is an equivalent variable.
Parameters:
  object - the object to compare true, if the supplied object has the samename, and it the two variables' instantiationsare equal



eval
public Object eval()(Code)
Returns the value of this variable. the value of this variable
exception:
  EvaluationException - if this variable'svalue is undefined



isList
public boolean isList()(Code)
Returns true if this variable is uninstantiated, or if it contains a list.



listTailString
public String listTailString()(Code)
Returns a string representation of this variable as the tail of a list. a string representation of this variable as thetail of a list



toString
public String toString()(Code)
Returns a string representation of this variable. a string representation of this variable



unbind
public void unbind()(Code)
Marks this variable as no longer having an instantiated value.



unify
public Unification unify(Structure s)(Code)
Instantiates this variable with the supplied structure, or forwards the request to its instantiation if it already has one.
Parameters:
  Structure - a structure to unify with a unification. If this variable is alreadyinstantiated, the unification is the result ofunifying with the input structure. Otherwise, theresult is a new unification containing just thisvariable, instantiated to the input structure.



unify
public Unification unify(Term t)(Code)
Unifies this variable with the supplied term.

This method dispatches the unify request to either a structure or a variable. The receiver will get a signature match from this object as a Variable, not just a Term.
Parameters:
  Term - a term to unify with the sum of the variables that bind to values tomake the unification work; Returns null if theunification fails.




unify
public Unification unify(Variable v)(Code)
Instantiates this variable with the supplied variable, or forwards the request to its instantiation if it already has one.
Parameters:
  Variable - a variable to unify with the sum of the variables that bind to values to makethe unification work; Returns null if theunification fails.



variables
public Unification variables()(Code)
Returns a unification containing just this variable. a unification containing just this variable



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.