1 4 5 package com.etymon.pjx; 6 7 import java.io.*; 8 9 13 public class PdfFloat 14 extends PdfNumber { 15 16 19 protected float _n; 20 21 25 public PdfFloat(float n) { 26 _n = n; 27 } 28 29 public boolean equals(Object obj) { 30 31 if ( (obj == null) || ( !(obj instanceof PdfFloat) ) ) { 32 return false; 33 } 34 35 return (_n == ((PdfFloat)obj)._n); 36 } 37 38 public int getInt() { 39 return (int)_n; 40 } 41 42 public long getLong() { 43 return (long)_n; 44 } 45 46 public float getFloat() { 47 return _n; 48 } 49 50 public int hashCode() { 51 return Float.floatToIntBits(_n); 52 } 53 54 protected int writePdf(PdfWriter w, boolean spacing) throws IOException { 55 56 DataOutputStream dos = w.getDataOutputStream(); 57 58 int count; 59 60 if (spacing) { 61 dos.write(' '); 62 count = 1; 63 } else { 64 count = 0; 65 } 66 67 String s = Float.toString(_n); 68 dos.writeBytes(s); 69 return count + s.length(); 70 } 71 72 } 73 | Popular Tags |