01: /*
02: Copyright © 2006 Stefano Chizzolini. http://clown.stefanochizzolini.it
03:
04: Contributors:
05: * Stefano Chizzolini (original code developer, http://www.stefanochizzolini.it):
06: contributed code is Copyright © 2006 by Stefano Chizzolini.
07:
08: This file should be part of the source code distribution of "PDF Clown library"
09: (the Program): see the accompanying README files for more info.
10:
11: This Program is free software; you can redistribute it and/or modify it under
12: the terms of the GNU General Public License as published by the Free Software
13: Foundation; either version 2 of the License, or (at your option) any later version.
14:
15: This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16: WARRANTY, either expressed or implied; without even the implied warranty of
17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18:
19: You should have received a copy of the GNU General Public License along with this
20: Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21:
22: Redistribution and use, with or without modification, are permitted provided that such
23: redistributions retain the above copyright notice, license and disclaimer, along with
24: this list of conditions.
25: */
26:
27: package it.stefanochizzolini.clown.objects;
28:
29: import it.stefanochizzolini.clown.files.File;
30:
31: /**
32: PDF integer number object.
33: */
34: public class PdfInteger extends PdfAtomicObject<Integer> implements
35: IPdfNumber {
36: // <class>
37: // <static>
38: // <interface>
39: public static String toPdf(int value) {
40: return Integer.toString(value);
41: }
42:
43: // </interface>
44: // </static>
45:
46: // <dynamic>
47: // <constructors>
48: public PdfInteger(int value) {
49: setValue(value);
50: }
51:
52: // </constructors>
53:
54: // <interface>
55: // <public>
56: @Override
57: public Object clone(File context) {
58: // Shallow copy.
59: PdfInteger clone = (PdfInteger) super .clone();
60:
61: // Deep copy.
62: /* NOTE: No mutable object to be cloned. */
63:
64: return clone;
65: }
66:
67: @Override
68: public String toPdf() {
69: return PdfInteger.toPdf(getValue());
70: }
71:
72: // <IPdfNumber>
73: public double getNumberValue() {
74: return getValue();
75: }
76:
77: public void setNumberValue(double value) {
78: setValue((int) value);
79: }
80:
81: public void translateNumberValue(double value) {
82: setValue(getValue() + (int) value);
83: }
84: // </IPdfNumber>
85: // </public>
86: // </interface>
87: // </dynamic>
88: // </class>
89: }
|