20 package org.hedgewars.hedgeroid.frontlib; |
20 package org.hedgewars.hedgeroid.frontlib; |
21 |
21 |
22 /** |
22 /** |
23 * This class represents the native C type size_t. On Android, this type could be mapped with int, |
23 * This class represents the native C type size_t. On Android, this type could be mapped with int, |
24 * but we use a separate type to make it easier to adapt for other platforms if anyone wants to use |
24 * but we use a separate type to make it easier to adapt for other platforms if anyone wants to use |
25 * the mappings elsewhere. |
25 * the mappings elsewhere. |
26 */ |
26 */ |
27 public final class NativeSizeT extends Number { |
27 public final class NativeSizeT extends Number { |
28 private static final long serialVersionUID = 1L; |
28 private static final long serialVersionUID = 1L; |
29 private final long value; |
29 private final long value; |
30 |
|
31 private NativeSizeT(long value) { |
|
32 this.value = value; |
|
33 } |
|
34 |
|
35 public static NativeSizeT valueOf(long l) { |
|
36 return new NativeSizeT(l); |
|
37 } |
|
38 |
|
39 @Override |
|
40 public int intValue() { |
|
41 return (int)value; |
|
42 } |
|
43 |
|
44 @Override |
|
45 public long longValue() { |
|
46 return value; |
|
47 } |
|
48 |
30 |
49 @Override |
31 private NativeSizeT(long value) { |
50 public double doubleValue() { |
32 this.value = value; |
51 return value; |
33 } |
52 } |
|
53 |
34 |
54 @Override |
35 public static NativeSizeT valueOf(long l) { |
55 public float floatValue() { |
36 return new NativeSizeT(l); |
56 return value; |
37 } |
57 } |
38 |
|
39 @Override |
|
40 public int intValue() { |
|
41 return (int)value; |
|
42 } |
|
43 |
|
44 @Override |
|
45 public long longValue() { |
|
46 return value; |
|
47 } |
|
48 |
|
49 @Override |
|
50 public double doubleValue() { |
|
51 return value; |
|
52 } |
|
53 |
|
54 @Override |
|
55 public float floatValue() { |
|
56 return value; |
|
57 } |
58 } |
58 } |