package sds.decompile;

/**
 * This class is for local variable stack.
 * @author inagaki
 */
public class LocalStack extends SimpleStack {
	public LocalStack() {
		super();
	}

	/**
	 * returns argument of specified index.
	 * @param index array index
	 * @return argument
	 */
	public String load(int index) {
		return load(index, false);
	}

	/**
	 * returns argument of specified index.
	 * @param index array index
	 * @param isLongOrDouble  whether type of the specified local variable is long or double.
	 * @return argument
	 */
	public String load(int index, boolean isLongOrDouble) {
		if(index >= stack.size()) {
			int argNumber = stack.size();
			stack.push("val_" + argNumber);
			if(isLongOrDouble) {
				stack.push("val_" + argNumber);
			}
		}
		return stack.get(index);
	}
}
@@ -167,32 +167,80 @@
 uper();%0A%09%7D%0A%0A
+%09public int size() %7B%0A%09%09return stack.size();%0A%09%7D%0A%0A
 %09/**%0A%09 *
  returns arg
@@ -219,32 +219,39 @@
 ();%0A%09%7D%0A%0A%09/**%0A%09 *
+ return
  returns argumen
@@ -239,32 +239,37 @@
 urn returns 
+v
 ar
-gument
+iable type
  of specifie
@@ -286,37 +286,37 @@
  * @param index 
-array
+stack
  index%0A%09 * @retu
@@ -314,32 +314,37 @@
 %09 * @return 
+v
 ar
-gument
+iable type
 %0A%09 */%0A%09publi
@@ -348,32 +348,36 @@
 blic String load
+Type
 (int index) %7B%0A%09%09
@@ -387,25 +387,22 @@
 urn 
-load(index, false
+type.get(index
 );%0A%09
@@ -421,24 +421,23 @@
 returns 
-argument
+vaiable
  of spec
@@ -440,32 +440,82 @@
 specified index.
+%3Cbr%3E%0A%09 * this method is for except storing opcode.
 %0A%09 * @param inde
@@ -520,13 +520,13 @@
 dex 
-array
+stack
  ind
@@ -537,93 +537,240 @@
  * @
-param isLongOrDouble  whether type of the specified local variable is long or double.
+return variable%0A%09 */%0A%09public String load(int index) %7B%0A%09%09return stack.get(index);%0A%09%7D%0A%0A%09/**%0A%09 * returns variable of specified index.%3Cbr%3E%0A%09 * this method is for storing opcode.%0A%09 * @param index stack index%0A%09 * @param type variable type
 %0A%09 *
@@ -782,16 +782,16 @@
 urn 
+v
 ar
-gument
+iable
 %0A%09 *
@@ -827,29 +827,18 @@
 ex, 
-boolean isLongOrDoubl
+String typ
 e) %7B
@@ -904,22 +904,16 @@
 e();%0A%09%09%09
-stack.
 push(%22va
@@ -923,24 +923,30 @@
  + argNumber
+, type
 );%0A%09%09%09if(isL
@@ -946,30 +946,43 @@
 %09if(
-isLongOrDouble
+type.matches(%22double%7Clong%22)
 ) %7B%0A%09%09%09%09
 stac
@@ -977,22 +977,16 @@
 ) %7B%0A%09%09%09%09
-stack.
 push(%22va
@@ -1000,16 +1000,22 @@
 rgNumber
+, type
 );%0A%09%09%09%7D%0A

add and change method for type stack.