Source Code Cross Referenced for Anonymous.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.ofbiz.rules.engine;
002:
003:        /**
004:         * <p><b>Title:</b> Anonymous Variable
005:         * <p><b>Description:</b> None
006:         * <p>Copyright (c) 1999 Steven J. Metsker.
007:         * <p>Copyright (c) 2001 The Open For Business Project - www.ofbiz.org
008:         *
009:         * <p>Permission is hereby granted, free of charge, to any person obtaining a
010:         *  copy of this software and associated documentation files (the "Software"),
011:         *  to deal in the Software without restriction, including without limitation
012:         *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
013:         *  and/or sell copies of the Software, and to permit persons to whom the
014:         *  Software is furnished to do so, subject to the following conditions:
015:         *
016:         * <p>The above copyright notice and this permission notice shall be included
017:         *  in all copies or substantial portions of the Software.
018:         *
019:         * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
020:         *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
021:         *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
022:         *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
023:         *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
024:         *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
025:         *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
026:         *
027:         * <br>
028:         * <p>An anonymous variable unifies successfully with any other
029:         * term, without binding to the term.
030:         * <p>
031:         * Anonymous variables are useful for screening out unwanted
032:         * terms. For example, if a program describes a marriage in
033:         * terms of an id, the husband, wife, and the beginning and
034:         * end dates of the marriage, its facts might look something
035:         * like:
036:         * <blockquote><pre>
037:         *     marriage(001, balthasar, grimelda, 14560512, 14880711);
038:         *     // ...
039:         *     marriage(257, kevin, karla, 19790623, present);
040:         * </pre></blockquote>
041:         * A rule that extracts just the husband from
042:         * <code>marriage</code> facts is:
043:         * <blockquote><pre>
044:         *     husband(Id, Hub) :- marriage(Id, Hub, _, _, _);
045:         * </pre></blockquote>
046:         * The underscores in this rule represent anonymous variables.
047:         * When the rule executes, it will unify its
048:         * <code>marriage</code> structure with <code>marriage</code>
049:         * facts, without regard to the last three terms of those
050:         * facts.
051:         * <p>
052:         * Without anonymous variables, the <code>husband</code> rule
053:         * would need three unused variables. Note that the following
054:         * approach would fail:
055:         * <blockquote><pre>
056:         *     husband(Id, Hub) :-
057:         *         marriage(Id, Hub, Anon, Anon, Anon); // wrong
058:         * </pre></blockquote>
059:         * This approach, while tempting, will not work because the
060:         * variable <code>Anon</code> will bind to the structures it
061:         * encounters. Issued against the example program,
062:         * <code>Anon</code> will first bind to <code>grimelda</code>.
063:         * Next, <code>Anon</code> will attempt to bind to
064:         * <code>14560512</code>. This will fail, since
065:         * <code>Anon</code> will already be bound to
066:         * <code>grimelda</code>.
067:         * <p>
068:         * The essential behavior anonymous variables provide is that
069:         * they unify successfully without binding.
070:         *
071:         * @author Steven J. Metsker
072:         * @version 1.0
073:         */
074:
075:        public class Anonymous extends Variable {
076:
077:            /**
078:             * Constructs an anonymous variable.
079:             */
080:            public Anonymous() {
081:                super ("_");
082:            }
083:
084:            /**
085:             * Returns this anonymous variable, which does not unify
086:             * with anything and thus does not need to copy itself.
087:             *
088:             * @return this anonymous variable
089:             *
090:             * @param AxiomSource ignored
091:             *
092:             * @param Scope ignored
093:             */
094:            public Term copyForProof(AxiomSource ignored, Scope ignored2) {
095:                return this ;
096:            }
097:
098:            /**
099:             * Return the value of this anonymous variable to use in
100:             * functions; this is meaningless in logic programming,
101:             * but the method returns the name of this variable.
102:             *
103:             * @return the name of the anonymous variable
104:             */
105:            public Object eval() {
106:                return name;
107:            }
108:
109:            /**
110:             * Returns an empty unification.
111:             * <p>
112:             * The <code>unify</code> methods indicate failure by
113:             * returning <code>null</code>. Anonymous variables succeed
114:             * without binding, so they always return empty unifications.
115:             *
116:             * @param Structure ignored
117:             *
118:             * @return A successful, but empty, unification
119:             */
120:            public Unification unify(Structure ignored) {
121:                return Unification.empty;
122:            }
123:
124:            /**
125:             * Returns an empty unification.
126:             *
127:             * @param Term ignored
128:             *
129:             * @return an empty unification
130:             */
131:            public Unification unify(Term ignored) {
132:                return Unification.empty;
133:            }
134:
135:            /**
136:             * Returns an empty unification.
137:             *
138:             * @param Variable ignored
139:             *
140:             * @return an empty unification
141:             */
142:            public Unification unify(Variable ignored) {
143:                return Unification.empty;
144:            }
145:
146:            /**
147:             * Returns an empty unification.
148:             *
149:             * @return   an empty unification
150:             */
151:            public Unification variables() {
152:                return Unification.empty;
153:            }
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.