Source Code Cross Referenced for PjArray.java in  » PDF » pjx » com » etymon » pj » object » 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 » PDF » pjx » com.etymon.pj.object 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.etymon.pj.object;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import com.etymon.pj.*;
006:
007:        /**
008:         A representation of the PDF array type.
009:         @author Nassib Nassar
010:         */
011:        public class PjArray extends PjObject {
012:
013:            /**
014:               Creates an empty array.
015:             */
016:            public PjArray() {
017:                _v = new Vector();
018:            }
019:
020:            /**
021:               Creates an array as a wrapper around a Vector.
022:               @param v the Vector to use for this array.
023:             */
024:            public PjArray(Vector v) {
025:                _v = v;
026:            }
027:
028:            /**
029:               Returns the Vector used to represent this array.
030:               @return the Vector used to represent this array.
031:             */
032:            public Vector getVector() {
033:                return _v;
034:            }
035:
036:            /**
037:               Writes this array to a stream in PDF format.
038:               @param os the stream to write to.
039:               @return the number of bytes written.
040:               @exception IOException if an I/O error occurs.
041:             */
042:            public long writePdf(OutputStream os) throws IOException {
043:                long z = writeln(os, "[");
044:                int size = _v.size();
045:                for (int x = 0; x < size; x++) {
046:                    z = z + ((PjObject) (_v.elementAt(x))).writePdf(os);
047:                    z = z + writeln(os, "");
048:                }
049:                z = z + write(os, "]");
050:                return z;
051:            }
052:
053:            /**
054:               Returns a deep copy of this object.
055:               @return a deep copy of this object.
056:               @exception CloneNotSupportedException if the instance can not be cloned.
057:             */
058:            public Object clone() throws CloneNotSupportedException {
059:                return new PjArray(cloneVector());
060:            }
061:
062:            protected Vector cloneVector() throws CloneNotSupportedException {
063:                Vector v = new Vector(_v.size());
064:                Enumeration m = _v.elements();
065:                while (m.hasMoreElements()) {
066:                    Object value = m.nextElement();
067:                    if (value instanceof  PjObject) {
068:                        v.addElement(((PjObject) value).clone());
069:                    } else {
070:                        throw new CloneNotSupportedException(
071:                                "Object in array is not a PjObject.");
072:                    }
073:                }
074:                return v;
075:            }
076:
077:            /**
078:               Renumbers object references within this object.  This
079:               method calls itself recursively to comprehensively renumber
080:               all objects contained within this object.
081:               @param map the table of object number mappings.  Each
082:               object number is looked up by key in the hash table, and
083:               the associated value is assigned as the new object number.
084:               The map hash table should consist of PjNumber keys and
085:               PjReference values.
086:             */
087:            public void renumber(Hashtable map) {
088:                PjObject obj;
089:                Object r;
090:                int size = _v.size();
091:                for (int x = 0; x < size; x++) {
092:                    try {
093:                        obj = (PjObject) (_v.elementAt(x));
094:                        if (obj instanceof  PjReference) {
095:                            r = map.get(((PjReference) obj).getObjNumber());
096:                            if (r != null) {
097:                                _v.setElementAt(r, x);
098:                            }
099:                        } else {
100:                            obj.renumber(map);
101:                        }
102:                    } catch (ClassCastException e) {
103:                        // ignore bad objects
104:                    }
105:                }
106:            }
107:
108:            protected Vector _v;
109:
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.