// Path: src/main/java/com/j2js/Form.java
// public class Form {
// 
//     public static int CATEGORY1 = 1;
//     public static int CATEGORY2 = 2;
//     
//     public static class Value {
//         public String type;
//         public String name;
//         
//         public Value(String theType, String theName) {
//             type = theType;
//             name = theName;
//         }
//         
//         public int getCategory() {
//             return type.equals("cat2") || type.equals("long") || type.equals("double")?CATEGORY2:CATEGORY1;
//         }
//     }
//     
//     private int index;
//     private Form.Value[] ins;
//     private Form.Value[] outs;
//     private Form.Value[] operands;
//     private Type type;
//     
//     /**
//      * @return Returns the ins.
//      */
//     public Form.Value[] getIns() {
//         return ins;
//     }
// 
//     /**
//      * @param theIns The ins to set.
//      */
//     public void setIns(Form.Value[] theIns) {
//         ins = theIns;
//     }
// 
//     /**
//      * @return Returns the operands.
//      */
//     public Form.Value[] getOperands() {
//         return operands;
//     }
// 
//     /**
//      * @param theOperands The operands to set.
//      */
//     public void setOperands(Form.Value[] theOperands) {
//         operands = theOperands;
//     }
// 
//     /**
//      * @return Returns the outs.
//      */
//     public Form.Value[] getOuts() {
//         return outs;
//     }
// 
//     /**
//      * @param theOuts The outs to set.
//      */
//     public void setOuts(Form.Value[] theOuts) {
//         outs = theOuts;
//         
//         if (theOuts.length != 1) return;
//         
//         String s = theOuts[0].type;
//         if (s.equals("object")) type = Type.OBJECT;
//         else if (s.equals("int")) type = Type.INT;
//         else if (s.equals("short")) type = Type.SHORT;
//         else if (s.equals("byte")) type = Type.SHORT;
//         else if (s.equals("long")) type = Type.LONG;
//         else if (s.equals("float")) type = Type.FLOAT;
//         else if (s.equals("double")) type = Type.DOUBLE;
//         else if (!s.equals("cat1") && !s.equals("returnAddress") && !s.equals("")) 
//             throw new RuntimeException("Unhandled type: " + s);
//     }
//     
//     public int getOpStackDelta() {
//         return getOuts().length - getIns().length;
//     }
// 
//     public Type getResultType() {
//         if (type == null) throw new RuntimeException("Result type is not available for " + this);
//         
//         return type;
//     }
//     /**
//      * @return Returns the index.
//      */
//     public int getIndex() {
//         return index;
//     }
//     /**
//      * @param theIndex The index to set.
//      */
//     public void setIndex(int theIndex) {
//         index = theIndex;
//     }
// }


import org.apache.bcel.generic.Type;
import com.j2js.Form;
package com.j2js.dom;



/**
 * Copyright by Wolfgang Kuehn 2005
 * Created on Feb 17, 2005
 */
public class Expression extends Block implements Cloneable {
    
    Type type = Type.UNKNOWN;
    
    public Expression() {
        super();
    }
    
    public Expression(int theBeginIndex, int theEndIndex) {
        super(theBeginIndex, theEndIndex);
    }
    
    public Object clone() {
        if (getChildCount() > 0) throw new RuntimeException("Cannot clone expression with children");
        ASTNode node;
        try {
            node = (ASTNode) super.clone();
        } catch (CloneNotSupportedException e) {
            return null;
        }
        node.setParentNode(null);
        node.setPreviousSibling(null);
        node.setNextSibling(null);
        return node;
    }
    
    public Type getTypeBinding() {
        return type;
    }
    
    public void setTypeBinding(Type theType) {
        type = theType;
    }
    
    public int getCategory() {
        if (getTypeBinding().getType() == Type.LONG.getType()) return Form.CATEGORY2;
// Path: src/main/java/com/j2js/Form.java
// public class Form {
// 
//     public static int CATEGORY1 = 1;
//     public static int CATEGORY2 = 2;
//     
//     public static class Value {
//         public String type;
//         public String name;
//         
//         public Value(String theType, String theName) {
//             type = theType;
//             name = theName;
//         }
//         
//         public int getCategory() {
//             return type.equals("cat2") || type.equals("long") || type.equals("double")?CATEGORY2:CATEGORY1;
//         }
//     }
//     
//     private int index;
//     private Form.Value[] ins;
//     private Form.Value[] outs;
//     private Form.Value[] operands;
//     private Type type;
//     
//     /**
//      * @return Returns the ins.
//      */
//     public Form.Value[] getIns() {
//         return ins;
//     }
// 
//     /**
//      * @param theIns The ins to set.
//      */
//     public void setIns(Form.Value[] theIns) {
//         ins = theIns;
//     }
// 
//     /**
//      * @return Returns the operands.
//      */
//     public Form.Value[] getOperands() {
//         return operands;
//     }
// 
//     /**
//      * @param theOperands The operands to set.
//      */
//     public void setOperands(Form.Value[] theOperands) {
//         operands = theOperands;
//     }
// 
//     /**
//      * @return Returns the outs.
//      */
//     public Form.Value[] getOuts() {
//         return outs;
//     }
// 
//     /**
//      * @param theOuts The outs to set.
//      */
//     public void setOuts(Form.Value[] theOuts) {
//         outs = theOuts;
//         
//         if (theOuts.length != 1) return;
//         
//         String s = theOuts[0].type;
//         if (s.equals("object")) type = Type.OBJECT;
//         else if (s.equals("int")) type = Type.INT;
//         else if (s.equals("short")) type = Type.SHORT;
//         else if (s.equals("byte")) type = Type.SHORT;
//         else if (s.equals("long")) type = Type.LONG;
//         else if (s.equals("float")) type = Type.FLOAT;
//         else if (s.equals("double")) type = Type.DOUBLE;
//         else if (!s.equals("cat1") && !s.equals("returnAddress") && !s.equals("")) 
//             throw new RuntimeException("Unhandled type: " + s);
//     }
//     
//     public int getOpStackDelta() {
//         return getOuts().length - getIns().length;
//     }
// 
//     public Type getResultType() {
//         if (type == null) throw new RuntimeException("Result type is not available for " + this);
//         
//         return type;
//     }
//     /**
//      * @return Returns the index.
//      */
//     public int getIndex() {
//         return index;
//     }
//     /**
//      * @param theIndex The index to set.
//      */
//     public void setIndex(int theIndex) {
//         index = theIndex;
//     }
// }


// Path: src/main/java/com/j2js/dom/Expression.java
import org.apache.bcel.generic.Type;
import com.j2js.Form;

package com.j2js.dom;



/**
 * Copyright by Wolfgang Kuehn 2005
 * Created on Feb 17, 2005
 */
public class Expression extends Block implements Cloneable {
    
    Type type = Type.UNKNOWN;
    
    public Expression() {
        super();
    }
    
    public Expression(int theBeginIndex, int theEndIndex) {
        super(theBeginIndex, theEndIndex);
    }
    
    public Object clone() {
        if (getChildCount() > 0) throw new RuntimeException("Cannot clone expression with children");
        ASTNode node;
        try {
            node = (ASTNode) super.clone();
        } catch (CloneNotSupportedException e) {
            return null;
        }
        node.setParentNode(null);
        node.setPreviousSibling(null);
        node.setNextSibling(null);
        return node;
    }
    
    public Type getTypeBinding() {
        return type;
    }
    
    public void setTypeBinding(Type theType) {
        type = theType;
    }
    
    public int getCategory() {
        if (getTypeBinding().getType() == Type.LONG.getType()) return Form.CATEGORY2;
        if (getTypeBinding().getType() == Type.DOUBLE.getType()) return Form.CATEGORY2;