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


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