Source Code Cross Referenced for DeathObjectBuffer.java in  » Database-DBMS » Ozone-1.1 » org » ozoneDB » core » classicStore » 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.core.classicStore 
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 Core 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: DeathObjectBuffer.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
008:
009:        package org.ozoneDB.core.classicStore;
010:
011:        import org.ozoneDB.core.*;
012:        import org.ozoneDB.util.*;
013:        import org.ozoneDB.DxLib.*;
014:
015:        public class DeathObjectBuffer extends Object {
016:
017:            /** all objects ordered by their ObjectID */
018:            public DxMap objects;
019:
020:            /** head and tail of the double linked list */
021:            DeathObject head;
022:            DeathObject tail;
023:
024:            int bufferSize = 0;
025:
026:            /** the constructor */
027:            public DeathObjectBuffer() {
028:                objects = new DxHashMap();
029:                head = new DeathObject();
030:                tail = new DeathObject();
031:                head.previous = tail;
032:                tail.next = head;
033:            }
034:
035:            /** returns the current size of the buffer */
036:            public final int size() {
037:                return bufferSize;
038:            }
039:
040:            /** returns the current count of objects of the buffer */
041:            public final int count() {
042:                return objects.count();
043:            }
044:
045:            /**
046:             */
047:            public void updateSize(DeathObject obj, boolean sub) {
048:                bufferSize += sub ? -obj.size() : obj.size();
049:            }
050:
051:            /**
052:             * adds the object to the bottom of the stack
053:             */
054:            public boolean add(DeathObject obj) {
055:                boolean result = objects.addForKey(obj, obj.objID());
056:                if (result) {
057:                    popOnTop(obj);
058:                    bufferSize += obj.size();
059:                }
060:                return result;
061:            }
062:
063:            /**
064:             * removes the object from the stack
065:             */
066:            public DeathObject remove(ObjectID oid) {
067:                //env.logWriter.newEntry ("DeathObjectBuffer.remove: " + oid, LogWriter.DEBUG3);
068:                DeathObject obj = (DeathObject) objects.removeForKey(oid);
069:                if (obj != null) {
070:                    removeFromStack(obj);
071:                    bufferSize -= obj.size();
072:                }
073:                return obj;
074:            }
075:
076:            /**
077:             * moves the specified object to the top of the stack
078:             */
079:            public boolean moveToTop(ObjectID oid) {
080:                DeathObject obj = (DeathObject) objects.elementForKey(oid);
081:                if (obj != null) {
082:                    removeFromStack(obj);
083:                    popOnTop(obj);
084:                }
085:                return obj != null;
086:            }
087:
088:            /**
089:             * removes and returns the object at the bottom
090:             */
091:            public DeathObject pushFromBottom() {
092:                DeathObject obj = tail.next;
093:                if (obj == head) {
094:                    return null;
095:                }
096:                return remove(obj.objID());
097:            }
098:
099:            /**
100:             * returns the DeathObject for the specified ObjectID
101:             */
102:            public DeathObject objectForId(ObjectID oid) {
103:                return (DeathObject) objects.elementForKey(oid);
104:            }
105:
106:            /**
107:             * pops the object on the top of the stack
108:             */
109:            private void popOnTop(DeathObject obj) {
110:                head.previous.next = obj;
111:                obj.previous = head.previous;
112:                obj.next = head;
113:                head.previous = obj;
114:            }
115:
116:            /**
117:             * pops the object on the bottom of the stack
118:             */
119:            private void popOnBottom(DeathObject obj) {
120:                tail.next.previous = obj;
121:                obj.next = tail.next;
122:                obj.previous = tail;
123:                tail.next = obj;
124:            }
125:
126:            /**
127:             * removes the object from the stack
128:             */
129:            private void removeFromStack(DeathObject obj) {
130:                obj.previous.next = obj.next;
131:                obj.next.previous = obj.previous;
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.