Source Code Cross Referenced for SearchResult.java in  » Project-Management » XPlanner-0.7b7 » com » technoetic » xplanner » domain » 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 » Project Management » XPlanner 0.7b7 » com.technoetic.xplanner.domain 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.technoetic.xplanner.domain;
002:
003:        import com.technoetic.xplanner.util.StringUtilities;
004:
005:        /**
006:         * Created by IntelliJ IDEA.
007:         * User: tkmower
008:         * Date: Nov 29, 2004
009:         * Time: 4:47:59 PM
010:         */
011:        public class SearchResult extends Object {
012:            private String matchPrefix = "";
013:            private String matchSuffix = "";
014:            private String matchingText = "";
015:            private String resultType;
016:            private Nameable matchingObject;
017:            private boolean matchInDescription = false;
018:            private String attachedToId;
019:            private String attachedToDomainType;
020:
021:            public SearchResult(Nameable matchingObject, String resultType) {
022:                this .matchingObject = matchingObject;
023:                this .resultType = resultType;
024:            }
025:
026:            public boolean equals(Object o) {
027:                if (this  == o)
028:                    return true;
029:                if (!(o instanceof  SearchResult))
030:                    return false;
031:
032:                final SearchResult searchResult = (SearchResult) o;
033:
034:                if (getDomainObjectId() != searchResult.getDomainObjectId())
035:                    return false;
036:
037:                return true;
038:            }
039:
040:            public String getMatchPrefix() {
041:                return matchPrefix;
042:            }
043:
044:            public void setMatchPrefix(String matchPrefix) {
045:                this .matchPrefix = matchPrefix;
046:            }
047:
048:            public String getMatchSuffix() {
049:                return matchSuffix;
050:            }
051:
052:            public void setMatchSuffix(String matchSuffix) {
053:                this .matchSuffix = matchSuffix;
054:            }
055:
056:            public Object getMatchingObject() {
057:                return matchingObject;
058:            }
059:
060:            public String getMatchingText() {
061:                return matchingText;
062:            }
063:
064:            public void setMatchingText(String matchingText) {
065:                this .matchingText = matchingText;
066:            }
067:
068:            public String getResultType() {
069:                return resultType;
070:            }
071:
072:            public String getTitle() {
073:                return matchingObject.getName();
074:            }
075:
076:            public int hashCode() {
077:                return getDomainObjectId();
078:            }
079:
080:            public int getDomainObjectId() {
081:                return matchingObject.getId();
082:            }
083:
084:            public boolean isMatchInDescription() {
085:                return matchInDescription;
086:            }
087:
088:            public void setMatchInDescription(boolean matchInDescription) {
089:                this .matchInDescription = matchInDescription;
090:            }
091:
092:            public void populate(String searchCriteria,
093:                    int desiredDescriptionLines, int maxSuffixLength) {
094:                if (getLocationOfCriteria(searchCriteria) < 0) {
095:                    populateResultWithNoDescriptionMatch(desiredDescriptionLines);
096:                } else {
097:                    populateResultWithPrefixSuffixAndResult(searchCriteria,
098:                            maxSuffixLength);
099:                }
100:            }
101:
102:            private int getLocationOfCriteria(String searchCriteria) {
103:                return matchingObject.getDescription().toLowerCase().indexOf(
104:                        searchCriteria.toLowerCase());
105:            }
106:
107:            private void populateResultWithNoDescriptionMatch(
108:                    int desiredDescriptionLines) {
109:                setMatchingText(StringUtilities.getFirstNLines(matchingObject
110:                        .getDescription(), desiredDescriptionLines));
111:            }
112:
113:            private void populateResultWithPrefixSuffixAndResult(
114:                    String searchCriteria, int maxSuffixLength) {
115:                populate(searchCriteria, maxSuffixLength);
116:            }
117:
118:            public void populate(String searchCriteria, int maxSuffixLength) {
119:                setMatchInDescription(true);
120:                String description = matchingObject.getDescription();
121:                setMatchPrefix(StringUtilities.computePrefix(description,
122:                        searchCriteria, maxSuffixLength));
123:
124:                int beginIndex = getLocationOfCriteria(searchCriteria);
125:                setMatchingText(description.substring(beginIndex, beginIndex
126:                        + searchCriteria.length()));
127:
128:                setMatchSuffix(StringUtilities.computeSuffix(description,
129:                        searchCriteria, maxSuffixLength));
130:            }
131:
132:            public void setAttachedToId(String attachedToId) {
133:                this .attachedToId = attachedToId;
134:            }
135:
136:            public String getAttachedToId() {
137:                return attachedToId;
138:            }
139:
140:            public void setAttachedToDomainType(String attachedToDomainType) {
141:                this .attachedToDomainType = attachedToDomainType;
142:            }
143:
144:            public String getAttachedToDomainType() {
145:                return attachedToDomainType;
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.