~hjd/ubuntu/wily/xmlgraphics-commons/debian-merged

« back to all changes in this revision

Viewing changes to src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java

  • Committer: Hans Joachim Desserud
  • Date: 2015-11-11 18:22:53 UTC
  • mfrom: (9.1.5 sid)
  • Revision ID: hans_joachim_desserud-20151111182253-zwi0frfm97j0wddn
  * Merge from Debian unstable.  Remaining changes:
    - d/control: Drop dependencies required for unit testing as they
      include libmockito-java which would pull maven into main, disable unit
      test execution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * limitations under the License.
16
16
 */
17
17
 
18
 
/* $Id: TIFFField.java 1345683 2012-06-03 14:50:33Z gadams $ */
 
18
/* $Id: TIFFField.java 1681698 2015-05-26 07:49:35Z ssteiner $ */
19
19
 
20
20
package org.apache.xmlgraphics.image.codec.tiff;
21
21
 
76
76
 
77
77
    /** Flag for 64 bit IEEE doubles. */
78
78
    public static final int TIFF_DOUBLE    = 12;
 
79
    private static final long serialVersionUID = 207783128222415437L;
79
80
 
80
81
    /** The tag number. */
81
82
    int tag;
90
91
    Object data;
91
92
 
92
93
    /** The default constructor. */
93
 
    TIFFField() {}
 
94
    TIFFField() { }
94
95
 
95
96
    /**
96
97
     * Constructs a TIFFField with arbitrary data.  The data
99
100
     * unsigned datatype, long is used. The mapping between types is
100
101
     * as follows:
101
102
     *
102
 
     * <table border=1>
 
103
     * <table border=1 summary="TIFF">
103
104
     * <tr>
104
105
     * <th> TIFF type </th> <th> Java type </th>
105
106
     * <tr>
353
354
            return (float)((double[])data)[index];
354
355
        case TIFF_SRATIONAL:
355
356
            int[] ivalue = getAsSRational(index);
356
 
            return (float)((double)ivalue[0]/ivalue[1]);
 
357
            return (float)((double)ivalue[0] / ivalue[1]);
357
358
        case TIFF_RATIONAL:
358
359
            long[] lvalue = getAsRational(index);
359
 
            return (float)((double)lvalue[0]/lvalue[1]);
 
360
            return (float)((double)lvalue[0] / lvalue[1]);
360
361
        default:
361
362
            throw new ClassCastException();
362
363
        }
391
392
            return ((double[])data)[index];
392
393
        case TIFF_SRATIONAL:
393
394
            int[] ivalue = getAsSRational(index);
394
 
            return (double)ivalue[0]/ivalue[1];
 
395
            return (double)ivalue[0] / ivalue[1];
395
396
        case TIFF_RATIONAL:
396
397
            long[] lvalue = getAsRational(index);
397
 
            return (double)lvalue[0]/lvalue[1];
 
398
            return (double)lvalue[0] / lvalue[1];
398
399
        default:
399
400
            throw new ClassCastException();
400
401
        }
444
445
     *         <code>TIFFField</code>.
445
446
     */
446
447
    public int compareTo(Object o) {
447
 
        if(o == null) {
 
448
        if (o == null) {
448
449
            throw new NullPointerException();
449
450
        }
450
451
 
451
452
        int oTag = ((TIFFField)o).getTag();
452
453
 
453
 
        if(tag < oTag) {
 
454
        if (tag < oTag) {
454
455
            return -1;
455
 
        } else if(tag > oTag) {
 
456
        } else if (tag > oTag) {
456
457
            return 1;
457
458
        } else {
458
459
            return 0;