Source Code Cross Referenced for PjNumber.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:
005:        /**
006:         A representation of the PDF number type.
007:         @author Nassib Nassar
008:         */
009:        public class PjNumber extends PjObject {
010:
011:            /**
012:               Creates a number object.
013:               @param f the numeric value to initialize this object to.
014:             */
015:            public PjNumber(float f) {
016:                _f = f;
017:            }
018:
019:            /**
020:               Returns the floating point value of this object.
021:               @return the floating point value of this object.
022:             */
023:            public float getFloat() {
024:                return _f;
025:            }
026:
027:            /**
028:               Returns the integer value of this object.
029:               @return the integer value of this object.
030:             */
031:            public int getInt() {
032:                return new Float(_f).intValue();
033:            }
034:
035:            /**
036:               Returns the long value of this object.
037:               @return the long value of this object.
038:             */
039:            public long getLong() {
040:                return new Float(_f).longValue();
041:            }
042:
043:            /**
044:               Determines whether this number is an integer.
045:               @return true if this number has no fractions.
046:             */
047:            public boolean isInteger() {
048:                return (((float) (new Float(_f).intValue())) == _f);
049:            }
050:
051:            /**
052:               Writes this number object to a stream in PDF format.
053:               @param os the stream to write to.
054:               @return the number of bytes written.
055:               @exception IOException if an I/O error occurs.
056:             */
057:            public long writePdf(OutputStream os) throws IOException {
058:                Float ft = new Float(_f);
059:                int x = ft.intValue();
060:                if ((float) x == _f) {
061:                    return write(os, new Integer(x));
062:                } else {
063:                    return write(os, ft);
064:                }
065:            }
066:
067:            /**
068:               Returns a string representation of this number in PDF format.
069:               @return the string representation.
070:            public String toString() {
071:            	Float ft = new Float(_f);
072:            	int x = ft.intValue();
073:            	if ((float)x == _f) {
074:            		return new Integer(x).toString();
075:            	} else {
076:            		return ft.toString();
077:            	}
078:            }
079:             */
080:
081:            /**
082:               Returns a deep copy of this object.
083:               @return a deep copy of this object.
084:             */
085:            public Object clone() {
086:                return this ;
087:            }
088:
089:            /**
090:               Compares two PjNumber objects for equality.
091:               @param obj the reference object to compare to.
092:               @return true if this object is the same as obj, false
093:               otherwise.
094:             */
095:            public boolean equals(Object obj) {
096:                if (obj == null) {
097:                    return false;
098:                }
099:                if (obj instanceof  PjNumber) {
100:                    return (_f == ((PjNumber) obj)._f);
101:                } else {
102:                    return false;
103:                }
104:            }
105:
106:            /**
107:               Returns a hash code value for the object.
108:               @return a hashcode value for this object.
109:             */
110:            public int hashCode() {
111:                return new Float(_f).hashCode();
112:            }
113:
114:            public static final PjNumber ZERO = new PjNumber(0);
115:            public static final PjNumber ONE = new PjNumber(1);
116:            public static final PjNumber TWO = new PjNumber(2);
117:
118:            private float _f;
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.