Package cn.wensiqun.asmsupport.clazz

Examples of cn.wensiqun.asmsupport.clazz.AClass


        super(block, factor1, factor2);
    }

    @Override
    protected void verifyArgument() {
        AClass ftrCls1 = AClassUtils.getPrimitiveAClass(factor1.getParamterizedType());
        AClass ftrCls2 = AClassUtils.getPrimitiveAClass(factor2.getParamterizedType());
        checkFactorForNumerical(ftrCls1);
        checkFactorForNumerical(ftrCls2);
    }
View Full Code Here


        factor2.asArgument();
    }

    @Override
    protected void afterInitProperties() {
        AClass ftrCls1 = AClassUtils.getPrimitiveAClass(factor1.getParamterizedType());
        AClass ftrCls2 = AClassUtils.getPrimitiveAClass(factor2.getParamterizedType());
        if(ftrCls1.getCastOrder() > ftrCls2.getCastOrder()){
            targetClass = ftrCls1;
        }else{
            targetClass = ftrCls2;
        }
    }
View Full Code Here

        }
    }

    @Override
    protected void factorsToStack() {
        AClass ftrCls1 = factor1.getParamterizedType();
        AClass ftrCls2 = factor2.getParamterizedType();

        log.debug("push the first factor to stack");
        factor1.loadToStack(block);
       
        if(!ftrCls1.isPrimitive()){
            log.debug("unbox " + ftrCls1);
            insnHelper.unbox(ftrCls1.getType());
        }
       
        if(!ftrCls1.equals(targetClass) &&
            targetClass.getCastOrder() > AClass.INT_ACLASS.getCastOrder()){
            log.debug("cast from " + ftrCls1 + " to " + targetClass);
            insnHelper.cast(ftrCls1.getType(), targetClass.getType());
        }
       
        log.debug("push the second factor to stack");
        factor2.loadToStack(block);
       
        if(!ftrCls2.isPrimitive()){
            log.debug("unbox " + ftrCls2);
            insnHelper.unbox(ftrCls2.getType());
        }
       
        if(!ftrCls2.equals(targetClass) &&
            targetClass.getCastOrder() > AClass.INT_ACLASS.getCastOrder()){
            log.debug("cast from " + ftrCls2 + " to " + targetClass);
            insnHelper.cast(ftrCls2.getType(), targetClass.getType());
        }
       
    }
View Full Code Here

public abstract class AbstractIncrement extends AbstractCrement {

    protected AbstractIncrement(ProgramBlock block, Crementable factor) {
        super(block, factor);
        operator = Operators.INCREMENT;
        AClass ftrcls = factor.getParamterizedType();
       
        if(factor instanceof GlobalVariable ||
           ((ftrcls.getCastOrder() <= AClass.BOOLEAN_ACLASS.getCastOrder() ||
            ftrcls.getCastOrder() > AClass.INT_ACLASS.getCastOrder()) &&
            factor instanceof LocalVariable)){
           
          AbstractArithmetic arithOperator = OperatorFactory.newOperator(Addition.class,
                new Class<?>[]{ProgramBlock.class, Parameterized.class, Parameterized.class},
                block, factor, getValue());
View Full Code Here

   
  }

  protected void getValue(){
        InstructionHelper ih = block.getInsnHelper();
        AClass cls = arrayReference.getParamterizedType();
        if(log.isDebugEnabled()){
            log.debug("load the array reference to stack");
        }
        arrayReference.loadToStack(block);
       
        for(int i=0; i<parDims.length; i++){
            cls = ((ArrayClass) cls).getNextDimType();
            parDims[i].loadToStack(block);
            autoCast(parDims[i].getParamterizedType(), AClass.INT_ACLASS);
            ih.arrayLoad(cls.getType());
        }
       
    }
View Full Code Here

        super(block);
        this.paras = new Parameterized[pars.length + 1];
        this.paras[0] = par1;
        System.arraycopy(pars, 0, this.paras, 1, pars.length);
       
        AClass strBlderCls = AClassFactory.getProductClass(StringBuilder.class);

        MethodInvoker mi = block.invoke(block.invokeConstructor(strBlderCls), "append", par1);
        for(Parameterized par : pars){
            mi = block.invoke(mi, "append", par);
        }
View Full Code Here

        super(block);
        this.factor = factor;
    }
   
    protected Value getValue(){
        AClass type = factor.getParamterizedType();
        if(type.equals(AClass.DOUBLE_ACLASS)){
            return Value.value(1d);
        }else if(type.equals(AClass.FLOAT_ACLASS)){
            return Value.value(1f);
        }else if(type.equals(AClass.LONG_ACLASS)){
            return Value.value(1l);
        }else{
            return Value.value(1);
        }
    }
View Full Code Here

        super(block, factor1, factor2);
    }
   
    @Override
    protected void verifyArgument() {
        AClass ftrCls1 = AClassUtils.getPrimitiveAClass(factor1.getParamterizedType());
        AClass ftrCls2 = AClassUtils.getPrimitiveAClass(factor2.getParamterizedType());
       
        if(ftrCls1.equals(AClass.BOOLEAN_ACLASS)&&
           ftrCls2.equals(AClass.BOOLEAN_ACLASS)){
       
        } else if(ftrCls1.isPrimitive() && ftrCls2.isPrimitive()){
            checkFactorForNumerical(ftrCls1);
            checkFactorForNumerical(ftrCls2);
        }
    }
View Full Code Here

        factor2.asArgument();
    }

    @Override
    protected void afterInitProperties() {
        AClass ftrCls1 = AClassUtils.getPrimitiveAClass(factor1.getParamterizedType());
        AClass ftrCls2 = AClassUtils.getPrimitiveAClass(factor2.getParamterizedType());
       
        if(ftrCls1.getCastOrder() > ftrCls2.getCastOrder()){
            targetClass = ftrCls1;
        }else{
            targetClass = ftrCls2;
        }
    }
View Full Code Here

        insnHelper.unbox(factor.getParamterizedType().getType());
    }

    @Override
    protected void verifyArgument() {
        AClass fatCls = factor.getParamterizedType();
        if(!AClassUtils.arithmetical(fatCls)){
            throw new ArithmeticException("cannot execute arithmetic operator whit " + fatCls);
        }
    }
View Full Code Here

TOP

Related Classes of cn.wensiqun.asmsupport.clazz.AClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.