Source Code Cross Referenced for Result.java in  » Content-Management-System » contineo » org » contineo » core » searchengine » search » 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 » Content Management System » contineo » org.contineo.core.searchengine.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Result.java
003:         * 
004:         * Created on 6. November 2003, 16:21
005:         */
006:        package org.contineo.core.searchengine.search;
007:
008:        import java.io.Serializable;
009:        import java.util.Date;
010:
011:        /**
012:         * @author Michael Scholz
013:         */
014:        public class Result implements  Serializable {
015:            private static final long serialVersionUID = 1L;
016:
017:            private Integer docId = new Integer(0);
018:
019:            /**
020:             * @uml.property name="name"
021:             */
022:            private String name = "";
023:
024:            /**
025:             * @uml.property name="summary"
026:             */
027:            private String summary = "";
028:
029:            /**
030:             * @uml.property name="path"
031:             */
032:            private String path = "";
033:
034:            private int menuId = -1;
035:
036:            /**
037:             * @uml.property name="type"
038:             */
039:            private String type = "";
040:
041:            /**
042:             * @uml.property name="icon"
043:             */
044:            private String icon = "";
045:
046:            /**
047:             * @uml.property name="size"
048:             */
049:            private int size = 0;
050:
051:            private Date date = new Date();
052:
053:            private Integer length = new Integer(0);
054:
055:            /**
056:             * @uml.property name="green"
057:             */
058:            private Integer green = new Integer(0);
059:
060:            /**
061:             * @uml.property name="red"
062:             */
063:            private Integer red = new Integer(0);
064:
065:            /** Creates a new instance of Result */
066:            public Result() {
067:            } // end ctor Result
068:
069:            /**
070:             * @return Returns the docId.
071:             * @uml.property name="docId"
072:             */
073:            public Integer getDocId() {
074:                return docId;
075:            } // end method getDocId
076:
077:            /**
078:             * @param docId The docId to set.
079:             * @uml.property name="docId"
080:             */
081:            public void setDocid(Integer docId) {
082:                this .docId = docId;
083:            } // end method setDocid
084:
085:            /**
086:             * 
087:             * @uml.property name="name"
088:             */
089:            public String getName() {
090:                return name;
091:            } // end method getName
092:
093:            /**
094:             * 
095:             * @uml.property name="summary"
096:             */
097:            public String getSummary() {
098:                return summary;
099:            } // end method getSummary
100:
101:            /**
102:             * 
103:             * @uml.property name="path"
104:             */
105:            public String getPath() {
106:                return path;
107:            } // end method getPath
108:
109:            public int getMenuId() {
110:                return menuId;
111:            }
112:
113:            /**
114:             * 
115:             * @uml.property name="type"
116:             */
117:            public String getType() {
118:                return type;
119:            } // end method getType
120:
121:            /**
122:             * 
123:             * @uml.property name="icon"
124:             */
125:            public String getIcon() {
126:                return icon;
127:            } // end method getIcon
128:
129:            public int getSize() {
130:                return size;
131:            }
132:
133:            /**
134:             * 
135:             * @uml.property name="green"
136:             */
137:            /*
138:             * public float getScore() { return score; }
139:             */
140:
141:            public Integer getGreen() {
142:                return green;
143:            } // end method getGreen
144:
145:            /**
146:             * 
147:             * @uml.property name="red"
148:             */
149:            public Integer getRed() {
150:                return red;
151:            } // end method getRed
152:
153:            /**
154:             * 
155:             * @uml.property name="name"
156:             */
157:            public void setName(String nme) {
158:                name = nme;
159:            } // end method setName
160:
161:            /**
162:             * 
163:             * @uml.property name="summary"
164:             */
165:            public void setSummary(String summ) {
166:                summary = summ;
167:            } // end method setSummary
168:
169:            /**
170:             * 
171:             * @uml.property name="path"
172:             */
173:            public void setPath(String pth) {
174:                path = pth;
175:            } // end method setPath
176:
177:            public void setMenuId(int id) {
178:                menuId = id;
179:            }
180:
181:            /**
182:             * @return Returns the length.
183:             * @uml.property name="length"
184:             */
185:            public Integer getLength() {
186:                return length;
187:            } // end method getLength
188:
189:            /**
190:             * @param length The length to set.
191:             * @uml.property name="length"
192:             */
193:            public void setLength(Integer length) {
194:                this .length = length;
195:            } // end method setLength
196:
197:            /**
198:             * 
199:             * @uml.property name="type"
200:             */
201:            public void setType(String typ) {
202:                type = typ;
203:                icon = "";
204:
205:                if (type.equals("PDF")) {
206:                    icon = "pdf.gif";
207:                } else if (type.equals("DOC") || type.equals("DOT")
208:                        || type.equals("RTF") || type.equals("SXW")
209:                        || type.equals("TXT") || type.equals("WPD")
210:                        || type.equals("KWD") || type.equals("ABW")
211:                        || type.equals("ZABW") || type.equals("ODT")) {
212:                    icon = "textdoc.gif";
213:                } else if (type.equals("XLS") || type.equals("XLT")
214:                        || type.equals("SXC") || type.equals("DBF")
215:                        || type.equals("KSP") || type.equals("ODS")
216:                        || type.equals("ODB")) {
217:                    icon = "tabledoc.gif";
218:                } else if (type.equals("PPT") || type.equals("PPS")
219:                        || type.equals("POT") || type.equals("SXI")
220:                        || type.equals("KPR") || type.equals("ODP")) {
221:                    icon = "presentdoc.gif";
222:                } else if (type.equals("APF") || type.equals("BMP")
223:                        || type.equals("JPEG") || type.equals("DIB")
224:                        || type.equals("GIF") || type.equals("JPG")
225:                        || type.equals("PSD") || type.equals("TIF")
226:                        || type.equals("TIFF")) {
227:                    icon = "picture.gif";
228:                } else if (type.equals("HTM") || type.equals("HTML")
229:                        || type.equals("XML")) {
230:                    icon = "internet.gif";
231:                } else {
232:                    icon = "document.gif";
233:                }
234:            } // end method setType
235:
236:            public void setSize(int sze) {
237:                size = sze;
238:            }
239:
240:            public void createScore(float score) {
241:                float temp = score * 100;
242:                int tgreen = Math.round(temp);
243:
244:                if (tgreen < 1) {
245:                    tgreen = 1;
246:                }
247:
248:                green = new Integer(tgreen);
249:                temp = 100 - (score * 100);
250:
251:                int tred = Math.round(temp);
252:
253:                if (tred > 99) {
254:                    tred = 99;
255:                }
256:
257:                red = new Integer(tred);
258:            } // end method createScore
259:
260:            /**
261:             * 
262:             * @uml.property name="green"
263:             */
264:            public void setGreen(Integer grn) {
265:                green = grn;
266:            } // end method setGreen
267:
268:            /**
269:             * 
270:             * @uml.property name="red"
271:             */
272:            public void setRed(Integer rd) {
273:                red = rd;
274:            } // end method setRed
275:
276:            public boolean isRelevant(SearchOptions opt, String refdate) {
277:                boolean result = true;
278:
279:                if ((opt.getFormat() != null) && !opt.getFormat().equals("all")) {
280:                    if (!type.toLowerCase().equals(opt.getFormat())) {
281:                        result = false;
282:                    }
283:                }
284:
285:                if (opt.getLength() != null) {
286:                    if (opt.getRelation().equals("gt")) {
287:                        if (size <= opt.getLength().intValue()) {
288:                            result = false;
289:                        }
290:                    } else {
291:                        if (opt.getRelation().equals("lt")) {
292:                            if (size >= opt.getLength().intValue()) {
293:                                result = false;
294:                            }
295:                        } else {
296:                            if (size != opt.getLength().intValue()) {
297:                                result = false;
298:                            }
299:                        }
300:                    }
301:                }
302:
303:                if (opt.getDate() != null) {
304:                    long diff = Long.parseLong(refdate)
305:                            - opt.getDate().getTime();
306:
307:                    if (opt.getDateRelation().equals("gt")) {
308:                        if (diff >= 0) {
309:                            result = false;
310:                        }
311:                    } else {
312:                        if (opt.getDateRelation().equals("lt")) {
313:                            if (diff <= 0) {
314:                                result = false;
315:                            }
316:                        } else {
317:                            if (diff != 0) {
318:                                result = false;
319:                            }
320:                        }
321:                    }
322:                }
323:                return result;
324:            }
325:
326:            public int getLengthCategory() {
327:                int len = length.intValue();
328:
329:                if (len > 60000) {
330:                    return 5;
331:                }
332:
333:                if (len > 18000) {
334:                    return 4;
335:                }
336:
337:                if (len > 3000) {
338:                    return 3;
339:                }
340:
341:                if (len > 600) {
342:                    return 2;
343:                }
344:
345:                return 1;
346:            } // end method getLengthCategory
347:
348:            /**
349:             * @param date The date to set.
350:             * @uml.property name="date"
351:             */
352:            public void setDate(Date d) {
353:                date = d;
354:            } // end method setDate
355:
356:            /**
357:             * @return Returns the date.
358:             * @uml.property name="date"
359:             */
360:            public Date getDate() {
361:                return date;
362:            } // end method getDate
363:
364:            public int getDateCategory() {
365:                long diff = new Date().getTime() - date.getTime();
366:                long days = diff / 1000 / 60 / 60 / 24; // 1000-sec , 60-min , 60-h ,
367:                // 24-day
368:
369:                if (days < 8) {
370:                    return 0;
371:                }
372:
373:                if (days < 29) {
374:                    return 1;
375:                }
376:
377:                if (days < 92) {
378:                    return 2;
379:                }
380:
381:                if (days < 366) {
382:                    return 3;
383:                }
384:
385:                return 4;
386:            } // end method getDateCategory
387:
388:            public int getDocType() {
389:                if (type.equals("PDF") || type.equals("DOC")
390:                        || type.equals("TXT") || type.equals("RTF")
391:                        || type.equals("HTML") || type.equals("HTM")
392:                        || type.equals("SXW") || type.equals("WPD")
393:                        || type.equals("PS") || type.equals("KWD")) {
394:                    return 0;
395:                }
396:
397:                if (type.equals("XLS") || type.equals("SXC")
398:                        || type.equals("KSP")) {
399:                    return 1;
400:                }
401:
402:                if (type.equals("PPT") || type.equals("PPS")
403:                        || type.equals("SXI") || type.equals("KPR")) {
404:                    return 2;
405:                }
406:
407:                return 3;
408:            } // end method getDocType
409:
410:        } // end class Result
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.