7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package com.sun.org.apache.bcel.internal.generic;
21
22 /**
23 * ICONST - Push value between -1, ..., 5, other values cause an exception
24 *
25 * <PRE>Stack: ... -> ..., </PRE>
26 *
27 * @version $Id$
28 */
29 public class ICONST extends Instruction implements ConstantPushInstruction {
30
31 private int value;
32
33
34 /**
35 * Empty constructor needed for Instruction.readInstruction.
36 * Not to be used otherwise.
37 */
38 ICONST() {
39 }
40
41
42 public ICONST(final int i) {
43 super(com.sun.org.apache.bcel.internal.Const.ICONST_0, (short) 1);
44 if ((i >= -1) && (i <= 5)) {
45 super.setOpcode((short) (com.sun.org.apache.bcel.internal.Const.ICONST_0 + i)); // Even works for i == -1
46 } else {
47 throw new ClassGenException("ICONST can be used only for value between -1 and 5: " + i);
|
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package com.sun.org.apache.bcel.internal.generic;
21
22 /**
23 * ICONST - Push value between -1, ..., 5, other values cause an exception
24 *
25 * <PRE>Stack: ... -> ..., </PRE>
26 *
27 */
28 public class ICONST extends Instruction implements ConstantPushInstruction {
29
30 private int value;
31
32
33 /**
34 * Empty constructor needed for Instruction.readInstruction.
35 * Not to be used otherwise.
36 */
37 ICONST() {
38 }
39
40
41 public ICONST(final int i) {
42 super(com.sun.org.apache.bcel.internal.Const.ICONST_0, (short) 1);
43 if ((i >= -1) && (i <= 5)) {
44 super.setOpcode((short) (com.sun.org.apache.bcel.internal.Const.ICONST_0 + i)); // Even works for i == -1
45 } else {
46 throw new ClassGenException("ICONST can be used only for value between -1 and 5: " + i);
|