KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > eval > ast > instructions > DupX1


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.eval.ast.instructions;
12
13 import org.eclipse.core.runtime.CoreException;
14
15 /**
16  * Duplicate the top element of the stack and put in it behind
17  * the second element of the stack.
18  *
19  * Element1
20  * Element2
21  * ...
22  *
23  * ->
24  *
25  * Element1
26  * Element2
27  * Element3
28  * ...
29  *
30  */

31 public class DupX1 extends SimpleInstruction {
32
33     /* (non-Javadoc)
34      * @see org.eclipse.jdt.internal.debug.eval.ast.instructions.Instruction#execute()
35      */

36     public void execute() throws CoreException {
37         Object JavaDoc element1= pop();
38         Object JavaDoc element2= pop();
39         push(element1);
40         push(element2);
41         push(element1);
42     }
43
44 }
45
Popular Tags