Source Code Cross Referenced for DxArrayBag.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: DxArrayBag.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
008:
009:        package org.ozoneDB.DxLib;
010:
011:        import java.util.*;
012:        import java.io.*;
013:
014:        /**
015:         * 
016:         * 
017:         * @author <a href="http://www.softwarebuero.de/">SMB</a>
018:         * @version $Revision: 1.1 $Date: 2001/12/18 10:31:30 $
019:         */
020:        public class DxArrayBag extends DxAbstractBag implements  DxVector,
021:                DxVectorCollection {
022:
023:            final static long serialVersionUID = 1L;
024:
025:            private transient Vector vector;
026:
027:            private transient int itemCount = 0;
028:
029:            public DxArrayBag() {
030:                this (32);
031:            }
032:
033:            public DxArrayBag(int initSpace) {
034:                vector = new Vector(initSpace);
035:                itemCount = 0;
036:            }
037:
038:            public synchronized boolean addFront(Object obj) {
039:                insertAtIndex(obj, 0);
040:                return true;
041:            }
042:
043:            public synchronized boolean addBack(Object obj) {
044:                insertAtIndex(obj, size());
045:                return true;
046:            }
047:
048:            /**
049:             * Sets the component at the specified index of this vector to be the
050:             * specified object. The previous component at that position is returned.
051:             * The index must be a value greater than or equal to 0. The size of the
052:             * array will grow if the specified index is greater than the current size.
053:             */
054:            public synchronized Object addAtIndex(Object obj, int index) {
055:                if (index >= vector.size()) {
056:                    vector.setSize(index + 1);
057:                }
058:                Object old = vector.elementAt(index);
059:                vector.setElementAt(obj, index);
060:                if (old == null) {
061:                    itemCount++;
062:                }
063:                return old;
064:            }
065:
066:            public Object elementAtIndex(int index) {
067:                return vector.elementAt(index);
068:            }
069:
070:            /**
071:             * Sets the component at the specified index to be null. The previous
072:             * component at that position is returned. The index must be a value
073:             * greater than or equal to 0 and less than the current size.
074:             */
075:            public synchronized Object removeAtIndex(int index) {
076:                Object old = vector.elementAt(index);
077:                vector.setElementAt(null, index);
078:                if (old != null) {
079:                    itemCount--;
080:                }
081:                return old;
082:            }
083:
084:            /**
085:             * Inserts the specified object as a component at the specified index. Each
086:             * component with an index greater or equal to the specified index is
087:             * shifted upward to have an index one greater than the value it had
088:             * previously. The index must be a value greater than or equal to 0 and less
089:             * than or equal to the current size of the vector.
090:             */
091:            public synchronized void insertAtIndex(Object obj, int index) {
092:                if (index >= vector.size()) {
093:                    vector.setSize(index);
094:                }
095:                vector.insertElementAt(obj, index);
096:                itemCount++;
097:            }
098:
099:            /**
100:             * Deletes the component at the specified index. Each component in this
101:             * array with an index greater or equal to the specified index is shifted
102:             * downward to have an index one smaller than the value it had previously.
103:             * The index must be a value greater than or equal to 0 and less than the
104:             * current size.
105:             */
106:            public synchronized Object deleteAtIndex(int index) {
107:                Object old = vector.elementAt(index);
108:                if (old != null) {
109:                    itemCount--;
110:                }
111:                vector.removeElementAt(index);
112:                return old;
113:            }
114:
115:            public int space() {
116:                return vector.capacity();
117:            }
118:
119:            public DxIterator iterator() {
120:                return new DxVectorIterator(this );
121:            }
122:
123:            public int count() {
124:                return itemCount;
125:            }
126:
127:            public int size() {
128:                return vector.size();
129:            }
130:
131:            public boolean isEmpty() {
132:                return vector.isEmpty();
133:            }
134:
135:            public synchronized void clear() {
136:                vector.removeAllElements();
137:                itemCount = 0;
138:            }
139:
140:            public Vector internalVector() {
141:                return vector;
142:            }
143:
144:            public void decCounter() {
145:                itemCount--;
146:            }
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.