Source Code Cross Referenced for DxDiskHashNodeLeaf.java in  » Database-DBMS » Ozone-1.1 » org » ozoneDB » DxLib » 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 » Database DBMS » Ozone 1.1 » org.ozoneDB.DxLib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // You can redistribute this software and/or modify it under the terms of
002:        // the Ozone Library License version 1 published by ozone-db.org.
003:        //
004:        // The original code and portions created by SMB are
005:        // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006:        //
007:        // $Id: DxDiskHashNodeLeaf.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
008:
009:        package org.ozoneDB.DxLib;
010:
011:        import java.io.*;
012:
013:        /**
014:         * Knoten als blatt des baumes. Enthaelt keine verzweigungen aber eventuell
015:         * mehrere key-data-paare.
016:         */
017:        public class DxDiskHashNodeLeaf extends DxDiskHashNode implements 
018:                Externalizable {
019:
020:            final static long serialVersionUID = 1;
021:
022:            protected DxDiskHashMap grandParent;
023:
024:            protected DxKeyData element;
025:
026:            public DxDiskHashNodeLeaf(DxDiskHashMap _grandParent) {
027:                grandParent = _grandParent;
028:            }
029:
030:            public void empty() {
031:                element = null;
032:            }
033:
034:            public DxKeyData element() {
035:                return element;
036:            }
037:
038:            public boolean addForKey(Object data, Object key) {
039:                //es ist noch kein element drin
040:                if (element == null) {
041:                    element = grandParent.newKeyData();
042:                    element.set(key, data);
043:                    return true;
044:                } else {
045:                    //es sind schon elemente da
046:                    DxKeyData elem = element;
047:                    while (elem != null) {
048:                        if (elem.key.equals(key)) {
049:                            break;
050:                        }
051:                        elem = elem.next;
052:                    }
053:                    //key ist noch nicht drin
054:                    if (elem == null) {
055:                        DxKeyData newElement = grandParent.newKeyData();
056:                        newElement.set(key, data);
057:                        newElement.next = element;
058:                        element = newElement;
059:                        return true;
060:                    } else {
061:                        //key ist schon da :(
062:                        return false;
063:                    }
064:                }
065:            }
066:
067:            public Object elementForKey(Object key, int hashCode) {
068:                DxKeyData elem = element;
069:                while (elem != null) {
070:                    if (elem.key.equals(key)) {
071:                        return elem.data;
072:                    }
073:                    elem = elem.next;
074:                }
075:                return null;
076:            }
077:
078:            public Object removeForKey(Object key) {
079:                DxKeyData elem = element;
080:                while (elem != null) {
081:                    if (elem.key.equals(key)) {
082:                        break;
083:                    }
084:                    elem = elem.next;
085:                }
086:
087:                Object answer = null;
088:                if (elem != null) {
089:                    answer = elem.data;
090:                    //daten vom ersten element der liste hier eintragen
091:                    elem.data = element.data;
092:                    elem.key = element.key;
093:                    //erstes element loeschen; evtl gibt es nur noch das eine
094:                    element = element.next;
095:                }
096:                return answer;
097:            }
098:
099:            public void writeExternal(ObjectOutput out) throws IOException {
100:                byte c = 0;
101:                for (DxKeyData elem = element; elem != null; elem = elem.next) {
102:                    c++;
103:                }
104:                out.writeByte(c);
105:
106:                DxKeyData elem = element;
107:                while (elem != null) {
108:                    out.writeObject(elem.key);
109:                    out.writeObject(elem.data);
110:                    elem = elem.next;
111:                }
112:            }
113:
114:            public void readExternal(ObjectInput in) throws IOException,
115:                    ClassNotFoundException {
116:                byte c = in.readByte();
117:
118:                element = grandParent.newKeyData();
119:                element.set(in.readObject(), in.readObject());
120:
121:                DxKeyData elem = element;
122:                for (int i = 1; i < c; i++) {
123:                    elem.next = grandParent.newKeyData();
124:                    elem.next.set(in.readObject(), in.readObject());
125:                    elem = elem.next;
126:                }
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.