equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.jdi; |
26 package com.sun.tools.jdi; |
27 |
27 |
28 import com.sun.jdi.*; |
28 import com.sun.jdi.InvalidTypeException; |
|
29 import com.sun.jdi.ShortValue; |
|
30 import com.sun.jdi.Type; |
|
31 import com.sun.jdi.VirtualMachine; |
29 |
32 |
30 public class ShortValueImpl extends PrimitiveValueImpl |
33 public class ShortValueImpl extends PrimitiveValueImpl |
31 implements ShortValue { |
34 implements ShortValue { |
32 private short value; |
35 private short value; |
33 |
36 |
34 ShortValueImpl(VirtualMachine aVm,short aValue) { |
37 ShortValueImpl(VirtualMachine aVm, short aValue) { |
35 super(aVm); |
38 super(aVm); |
36 |
|
37 value = aValue; |
39 value = aValue; |
38 } |
40 } |
39 |
41 |
40 public boolean equals(Object obj) { |
42 public boolean equals(Object obj) { |
41 if ((obj != null) && (obj instanceof ShortValue)) { |
43 if ((obj != null) && (obj instanceof ShortValue)) { |
65 public short value() { |
67 public short value() { |
66 return value; |
68 return value; |
67 } |
69 } |
68 |
70 |
69 public boolean booleanValue() { |
71 public boolean booleanValue() { |
70 return(value == 0)?false:true; |
72 return (value == 0 ? false : true); |
71 } |
73 } |
72 |
74 |
73 public byte byteValue() { |
75 public byte byteValue() { |
74 return(byte)value; |
76 return (byte)value; |
75 } |
77 } |
76 |
78 |
77 public char charValue() { |
79 public char charValue() { |
78 return(char)value; |
80 return (char)value; |
79 } |
81 } |
80 |
82 |
81 public short shortValue() { |
83 public short shortValue() { |
82 return value; |
84 return value; |
83 } |
85 } |
84 |
86 |
85 public int intValue() { |
87 public int intValue() { |
86 return(int)value; |
88 return value; |
87 } |
89 } |
88 |
90 |
89 public long longValue() { |
91 public long longValue() { |
90 return(long)value; |
92 return value; |
91 } |
93 } |
92 |
94 |
93 public float floatValue() { |
95 public float floatValue() { |
94 return(float)value; |
96 return value; |
95 } |
97 } |
96 |
98 |
97 public double doubleValue() { |
99 public double doubleValue() { |
98 return(double)value; |
100 return value; |
99 } |
101 } |
100 |
102 |
101 byte checkedByteValue() throws InvalidTypeException { |
103 byte checkedByteValue() throws InvalidTypeException { |
102 if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { |
104 if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { |
103 throw new InvalidTypeException("Can't convert " + value + " to byte"); |
105 throw new InvalidTypeException("Can't convert " + value + " to byte"); |