Source Code Cross Referenced for ArrayExtractor.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » base » extractors » 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 » drolls Rule Engine » org.drools.base.extractors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.base.extractors;
002:
003:        import java.lang.reflect.Method;
004:
005:        import org.drools.base.ValueType;
006:        import org.drools.common.InternalWorkingMemory;
007:        import org.drools.spi.Extractor;
008:        import org.drools.util.ClassUtils;
009:
010:        public class ArrayExtractor implements  Extractor {
011:            private final Extractor arrayExtractor;
012:            private final int index;
013:            private final Class type;
014:
015:            public ArrayExtractor(Extractor arrayExtractor, int index,
016:                    Class type) {
017:                this .arrayExtractor = arrayExtractor;
018:                this .index = index;
019:                this .type = type;
020:            }
021:
022:            public Class getExtractToClass() {
023:                return type;
024:            }
025:
026:            public String getExtractToClassName() {
027:                return ClassUtils.canonicalName(type);
028:            }
029:
030:            public boolean getBooleanValue(InternalWorkingMemory workingMemory,
031:                    Object object) {
032:                Object[] array = (Object[]) this .arrayExtractor.getValue(
033:                        workingMemory, object);
034:                return ((Boolean) array[this .index]).booleanValue();
035:            }
036:
037:            public byte getByteValue(InternalWorkingMemory workingMemory,
038:                    Object object) {
039:                Object[] array = (Object[]) this .arrayExtractor.getValue(
040:                        workingMemory, object);
041:                return ((Byte) array[this .index]).byteValue();
042:            }
043:
044:            public char getCharValue(InternalWorkingMemory workingMemory,
045:                    Object object) {
046:                Object[] array = (Object[]) this .arrayExtractor.getValue(
047:                        workingMemory, object);
048:                return ((Character) array[this .index]).charValue();
049:            }
050:
051:            public double getDoubleValue(InternalWorkingMemory workingMemory,
052:                    Object object) {
053:                Object[] array = (Object[]) this .arrayExtractor.getValue(
054:                        workingMemory, object);
055:                return ((Double) array[this .index]).doubleValue();
056:            }
057:
058:            public float getFloatValue(InternalWorkingMemory workingMemory,
059:                    Object object) {
060:                Object[] array = (Object[]) this .arrayExtractor.getValue(
061:                        workingMemory, object);
062:                return ((Float) array[this .index]).floatValue();
063:            }
064:
065:            public int getIntValue(InternalWorkingMemory workingMemory,
066:                    Object object) {
067:                Object[] array = (Object[]) this .arrayExtractor.getValue(
068:                        workingMemory, object);
069:                return ((Integer) array[this .index]).intValue();
070:            }
071:
072:            public long getLongValue(InternalWorkingMemory workingMemory,
073:                    Object object) {
074:                Object[] array = (Object[]) this .arrayExtractor.getValue(
075:                        workingMemory, object);
076:                return ((Long) array[this .index]).longValue();
077:            }
078:
079:            public Method getNativeReadMethod() {
080:                throw new UnsupportedOperationException(
081:                        "cannot call a method on an array extractor");
082:            }
083:
084:            public short getShortValue(InternalWorkingMemory workingMemory,
085:                    Object object) {
086:                Object[] array = (Object[]) this .arrayExtractor.getValue(
087:                        workingMemory, object);
088:                return ((Short) array[this .index]).shortValue();
089:            }
090:
091:            public Object getValue(InternalWorkingMemory workingMemory,
092:                    Object object) {
093:                Object[] array = (Object[]) this .arrayExtractor.getValue(
094:                        workingMemory, object);
095:                return array[this .index];
096:            }
097:
098:            public ValueType getValueType() {
099:                return ValueType.OBJECT_TYPE;
100:            }
101:
102:            public boolean isNullValue(InternalWorkingMemory workingMemory,
103:                    Object object) {
104:                Object[] array = (Object[]) this .arrayExtractor.getValue(
105:                        workingMemory, object);
106:                return array[this .index] == null;
107:            }
108:
109:            public int getHashCode(InternalWorkingMemory workingMemory,
110:                    Object object) {
111:                Object[] array = (Object[]) this .arrayExtractor.getValue(
112:                        workingMemory, object);
113:                return array[this .index].hashCode();
114:            }
115:
116:            public int hashCode() {
117:                final int PRIME = 31;
118:                int result = 1;
119:                result = PRIME
120:                        * result
121:                        + ((arrayExtractor == null) ? 0 : arrayExtractor
122:                                .hashCode());
123:                result = PRIME * result + index;
124:                return result;
125:            }
126:
127:            public boolean equals(Object obj) {
128:                if (this  == obj)
129:                    return true;
130:                if (obj == null)
131:                    return false;
132:                if (getClass() != obj.getClass())
133:                    return false;
134:                final ArrayExtractor other = (ArrayExtractor) obj;
135:                if (arrayExtractor == null) {
136:                    if (other.arrayExtractor != null)
137:                        return false;
138:                } else if (!arrayExtractor.equals(other.arrayExtractor))
139:                    return false;
140:                if (index != other.index)
141:                    return false;
142:                return true;
143:            }
144:
145:            public boolean isGlobal() {
146:                return false;
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.