当前位置: 首页>>代码示例>>Java>>正文


Java JExpression.mul方法代码示例

本文整理汇总了Java中com.sun.codemodel.JExpression.mul方法的典型用法代码示例。如果您正苦于以下问题:Java JExpression.mul方法的具体用法?Java JExpression.mul怎么用?Java JExpression.mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.codemodel.JExpression的用法示例。


在下文中一共展示了JExpression.mul方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: binaryOp_int_int

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
JExpression binaryOp_int_int(Expression.BinaryOp op,
			     JExpression left, JExpression right)
{
	switch(op.op) {
	case ADD: return left.plus(right);
	case SUB: return left.minus(right);
	case MUL: return left.mul(right);
	case DIV:
		JExpression fl_right =
			JExpr.cast(convertTypeToJClass_p(null, TypeFloat.I), right);
		return left.div(fl_right);
	case FLOORDIV:
		  return left.div(right);
	case EQ:  return left.eq(right);
	case NE:  return left.ne(right);
	case LT:  return left.lt(right);
	case GT:  return left.gt(right);
	case LE:  return left.lte(right);
	case GE:  return left.gte(right);
	default:
		  return null; // handle upstream
	}
}
 
开发者ID:BrainTech,项目名称:jsignalml,代码行数:24,代码来源:JavaPrimitiveGen.java

示例2: visitBooleanAnd

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanAnd(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getMajorType());

  JLabel label = generator.getEvalBlockLabel("AndOP");
  JBlock eval = generator.getEvalBlock().block();  // enter into nested block
  generator.nestEvalBlock(eval);

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "and" when one side is null
  //    p       q     p and q
  //    true    null     null
  //    false   null     false
  //    null    true     null
  //    null    false    false
  //    null    null     null
  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = null;
    if (arg.isOptional()) {
      earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().ne(JExpr.lit(1))))._then();
      if (e == null) {
        e = arg.getIsSet();
      } else {
        e = e.mul(arg.getIsSet());
      }
    } else {
      earlyExit = eval._if(arg.getValue().ne(JExpr.lit(1)))._then();
    }

    if (out.isOptional()) {
      earlyExit.assign(out.getIsSet(), JExpr.lit(1));
    }

    earlyExit.assign(out.getValue(),  JExpr.lit(0));
    earlyExit._break(label);
  }

  if (out.isOptional()) {
    assert (e != null);

    JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
    notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

    JBlock setBlock = notSetJC._else().block();
    setBlock.assign(out.getIsSet(), JExpr.lit(1));
    setBlock.assign(out.getValue(), JExpr.lit(1));
  } else {
    assert (e == null);
    eval.assign(out.getValue(), JExpr.lit(1)) ;
  }

  generator.unNestEvalBlock();     // exit from nested block

  return out;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:62,代码来源:EvaluationVisitor.java

示例3: visitBooleanOr

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanOr(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getMajorType());

  JLabel label = generator.getEvalBlockLabel("OrOP");
  JBlock eval = generator.getEvalBlock().block();
  generator.nestEvalBlock(eval);   // enter into nested block.

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "or" when one side is null
  //    p       q       p and q
  //    true    null     true
  //    false   null     null
  //    null    true     true
  //    null    false    null
  //    null    null     null

  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = null;
    if (arg.isOptional()) {
      earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().eq(JExpr.lit(1))))._then();
      if (e == null) {
        e = arg.getIsSet();
      } else {
        e = e.mul(arg.getIsSet());
      }
    } else {
      earlyExit = eval._if(arg.getValue().eq(JExpr.lit(1)))._then();
    }

    if (out.isOptional()) {
      earlyExit.assign(out.getIsSet(), JExpr.lit(1));
    }

    earlyExit.assign(out.getValue(),  JExpr.lit(1));
    earlyExit._break(label);
  }

  if (out.isOptional()) {
    assert (e != null);

    JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
    notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

    JBlock setBlock = notSetJC._else().block();
    setBlock.assign(out.getIsSet(), JExpr.lit(1));
    setBlock.assign(out.getValue(), JExpr.lit(0));
  } else {
    assert (e == null);
    eval.assign(out.getValue(), JExpr.lit(0)) ;
  }

  generator.unNestEvalBlock();   // exit from nested block.

  return out;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:63,代码来源:EvaluationVisitor.java

示例4: generateEvalBody

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
protected HoldingContainer generateEvalBody(ClassGenerator<?> g, HoldingContainer[] inputVariables, String body, JVar[] workspaceJVars) {

    g.getEvalBlock().directStatement(String.format("//---- start of eval portion of %s function. ----//", registeredNames[0]));

    JBlock sub = new JBlock(true, true);
    JBlock topSub = sub;
    HoldingContainer out = null;
    MajorType returnValueType = returnValue.type;

    // add outside null handling if it is defined.
    if (nullHandling == NullHandling.NULL_IF_NULL) {
      JExpression e = null;
      for (HoldingContainer v : inputVariables) {
        if (v.isOptional()) {
          if (e == null) {
            e = v.getIsSet();
          } else {
            e = e.mul(v.getIsSet());
          }
        }
      }

      if (e != null) {
        // if at least one expression must be checked, set up the conditional.
        returnValueType = returnValue.type.toBuilder().setMode(DataMode.OPTIONAL).build();
        out = g.declare(returnValueType);
        e = e.eq(JExpr.lit(0));
        JConditional jc = sub._if(e);
        jc._then().assign(out.getIsSet(), JExpr.lit(0));
        sub = jc._else();
      }
    }

    if (out == null) {
      out = g.declare(returnValueType);
    }

    // add the subblock after the out declaration.
    g.getEvalBlock().add(topSub);


    JVar internalOutput = sub.decl(JMod.FINAL, g.getHolderType(returnValueType), returnValue.name, JExpr._new(g.getHolderType(returnValueType)));
    addProtectedBlock(g, sub, body, inputVariables, workspaceJVars, false);
    if (sub != topSub) {
      sub.assign(internalOutput.ref("isSet"),JExpr.lit(1));// Assign null if NULL_IF_NULL mode
    }
    sub.assign(out.getHolder(), internalOutput);
    if (sub != topSub) {
      sub.assign(internalOutput.ref("isSet"),JExpr.lit(1));// Assign null if NULL_IF_NULL mode
    }

    g.getEvalBlock().directStatement(String.format("//---- end of eval portion of %s function. ----//", registeredNames[0]));

    return out;
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:56,代码来源:DrillSimpleFuncHolder.java

示例5: visitBooleanAnd

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanAnd(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getCompleteType());

  JLabel label = generator.getEvalBlockLabel("AndOP");
  JBlock eval = generator.createInnerEvalBlock();
  generator.nestEvalBlock(eval);  // enter into nested block

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "and" when one side is null
  //    p       q     p and q
  //    true    null     null
  //    false   null     false
  //    null    true     null
  //    null    false    false
  //    null    null     null
  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = null;
      earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().ne(JExpr.lit(1))))._then();
      if (e == null) {
        e = arg.getIsSet();
      } else {
        e = e.mul(arg.getIsSet());
      }
    earlyExit.assign(out.getIsSet(), JExpr.lit(1));

    earlyExit.assign(out.getValue(),  JExpr.lit(0));
    earlyExit._break(label);
  }

  assert (e != null);

  JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
  notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

  JBlock setBlock = notSetJC._else().block();
  setBlock.assign(out.getIsSet(), JExpr.lit(1));
  setBlock.assign(out.getValue(), JExpr.lit(1));

  generator.unNestEvalBlock();     // exit from nested block

  return out;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:50,代码来源:EvaluationVisitor.java

示例6: visitBooleanOr

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanOr(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getCompleteType());

  JLabel label = generator.getEvalBlockLabel("OrOP");
  JBlock eval = generator.createInnerEvalBlock();
  generator.nestEvalBlock(eval);   // enter into nested block.

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "or" when one side is null
  //    p       q       p and q
  //    true    null     true
  //    false   null     null
  //    null    true     true
  //    null    false    null
  //    null    null     null

  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().eq(JExpr.lit(1))))._then();
    if (e == null) {
      e = arg.getIsSet();
    } else {
      e = e.mul(arg.getIsSet());
    }
    earlyExit.assign(out.getIsSet(), JExpr.lit(1));
    earlyExit.assign(out.getValue(),  JExpr.lit(1));
    earlyExit._break(label);
  }

  assert (e != null);

  JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
  notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

  JBlock setBlock = notSetJC._else().block();
  setBlock.assign(out.getIsSet(), JExpr.lit(1));
  setBlock.assign(out.getValue(), JExpr.lit(0));

  generator.unNestEvalBlock();   // exit from nested block.

  return out;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:49,代码来源:EvaluationVisitor.java

示例7: generateEvalBody

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
protected HoldingContainer generateEvalBody(ClassGenerator<?> g, CompleteType resolvedOutput, HoldingContainer[] inputVariables, String body, JVar[] workspaceJVars) {

    g.getEvalBlock().directStatement(String.format("//---- start of eval portion of %s function. ----//", registeredNames[0]));

    JBlock sub = new JBlock(true, true);
    JBlock topSub = sub;
    HoldingContainer out = null;


    // add outside null handling if it is defined.
    if (nullHandling == NullHandling.NULL_IF_NULL) {
      JExpression e = null;
      for (HoldingContainer v : inputVariables) {
        final JExpression isNullExpr;
        if (v.isReader()) {
          isNullExpr = JOp.cond(v.getHolder().invoke("isSet"), JExpr.lit(1), JExpr.lit(0));
        } else {
          isNullExpr = v.getIsSet();
        }
        if (e == null) {
          e = isNullExpr;
        } else {
          e = e.mul(isNullExpr);
        }
      }

      if (e != null) {
        // if at least one expression must be checked, set up the conditional.
        out = g.declare(resolvedOutput);
        e = e.eq(JExpr.lit(0));
        JConditional jc = sub._if(e);
        jc._then().assign(out.getIsSet(), JExpr.lit(0));
        sub = jc._else();
      }
    }

    if (out == null) {
      out = g.declare(resolvedOutput);
    }

    // add the subblock after the out declaration.
    g.getEvalBlock().add(topSub);


    JVar internalOutput = sub.decl(JMod.FINAL, resolvedOutput.getHolderType(g.getModel()), getReturnName(), JExpr._new(resolvedOutput.getHolderType(g.getModel())));
    addProtectedBlock(g, sub, body, inputVariables, workspaceJVars, false);

    if (sub != topSub || inputVariables.length == 0) {
      sub.assign(internalOutput.ref("isSet"), JExpr.lit(1));// Assign null if NULL_IF_NULL mode
    }
    sub.assign(out.getHolder(), internalOutput);

    g.getEvalBlock().directStatement(String.format("//---- end of eval portion of %s function. ----//", registeredNames[0]));

    return out;
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:57,代码来源:SimpleFunctionHolder.java

示例8: visitBooleanAnd

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanAnd(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getMajorType());

  JLabel label = generator.getEvalBlockLabel("AndOP");
  JBlock eval = generator.createInnerEvalBlock();
  generator.nestEvalBlock(eval);  // enter into nested block

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "and" when one side is null
  //    p       q     p and q
  //    true    null     null
  //    false   null     false
  //    null    true     null
  //    null    false    false
  //    null    null     null
  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = null;
    if (arg.isOptional()) {
      earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().ne(JExpr.lit(1))))._then();
      if (e == null) {
        e = arg.getIsSet();
      } else {
        e = e.mul(arg.getIsSet());
      }
    } else {
      earlyExit = eval._if(arg.getValue().ne(JExpr.lit(1)))._then();
    }

    if (out.isOptional()) {
      earlyExit.assign(out.getIsSet(), JExpr.lit(1));
    }

    earlyExit.assign(out.getValue(),  JExpr.lit(0));
    earlyExit._break(label);
  }

  if (out.isOptional()) {
    assert (e != null);

    JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
    notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

    JBlock setBlock = notSetJC._else().block();
    setBlock.assign(out.getIsSet(), JExpr.lit(1));
    setBlock.assign(out.getValue(), JExpr.lit(1));
  } else {
    assert (e == null);
    eval.assign(out.getValue(), JExpr.lit(1)) ;
  }

  generator.unNestEvalBlock();     // exit from nested block

  return out;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:62,代码来源:EvaluationVisitor.java

示例9: visitBooleanOr

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
private HoldingContainer visitBooleanOr(BooleanOperator op,
    ClassGenerator<?> generator) {

  HoldingContainer out = generator.declare(op.getMajorType());

  JLabel label = generator.getEvalBlockLabel("OrOP");
  JBlock eval = generator.createInnerEvalBlock();
  generator.nestEvalBlock(eval);   // enter into nested block.

  HoldingContainer arg = null;

  JExpression e = null;

  //  value of boolean "or" when one side is null
  //    p       q       p and q
  //    true    null     true
  //    false   null     null
  //    null    true     true
  //    null    false    null
  //    null    null     null

  for (int i = 0; i < op.args.size(); i++) {
    arg = op.args.get(i).accept(this, generator);

    JBlock earlyExit = null;
    if (arg.isOptional()) {
      earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().eq(JExpr.lit(1))))._then();
      if (e == null) {
        e = arg.getIsSet();
      } else {
        e = e.mul(arg.getIsSet());
      }
    } else {
      earlyExit = eval._if(arg.getValue().eq(JExpr.lit(1)))._then();
    }

    if (out.isOptional()) {
      earlyExit.assign(out.getIsSet(), JExpr.lit(1));
    }

    earlyExit.assign(out.getValue(),  JExpr.lit(1));
    earlyExit._break(label);
  }

  if (out.isOptional()) {
    assert (e != null);

    JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));
    notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));

    JBlock setBlock = notSetJC._else().block();
    setBlock.assign(out.getIsSet(), JExpr.lit(1));
    setBlock.assign(out.getValue(), JExpr.lit(0));
  } else {
    assert (e == null);
    eval.assign(out.getValue(), JExpr.lit(0)) ;
  }

  generator.unNestEvalBlock();   // exit from nested block.

  return out;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:63,代码来源:EvaluationVisitor.java

示例10: generateEvalBody

import com.sun.codemodel.JExpression; //导入方法依赖的package包/类
protected HoldingContainer generateEvalBody(ClassGenerator<?> g, HoldingContainer[] inputVariables, String body,
                                            JVar[] workspaceJVars, FieldReference ref) {

  g.getEvalBlock().directStatement(String.format("//---- start of eval portion of %s function. ----//", getRegisteredNames()[0]));

  JBlock sub = new JBlock(true, true);
  JBlock topSub = sub;
  HoldingContainer out = null;
  MajorType returnValueType = getReturnType();

  // add outside null handling if it is defined.
  if (getNullHandling() == NullHandling.NULL_IF_NULL) {
    JExpression e = null;
    for (HoldingContainer v : inputVariables) {
      if (v.isOptional()) {
        JExpression isNullExpr;
        if (v.isReader()) {
         isNullExpr = JOp.cond(v.getHolder().invoke("isSet"), JExpr.lit(1), JExpr.lit(0));
        } else {
          isNullExpr = v.getIsSet();
        }
        if (e == null) {
          e = isNullExpr;
        } else {
          e = e.mul(isNullExpr);
        }
      }
    }

    if (e != null) {
      // if at least one expression must be checked, set up the conditional.
      returnValueType = getReturnType().toBuilder().setMode(DataMode.OPTIONAL).build();
      out = g.declare(returnValueType);
      e = e.eq(JExpr.lit(0));
      JConditional jc = sub._if(e);
      jc._then().assign(out.getIsSet(), JExpr.lit(0));
      sub = jc._else();
    }
  }

  if (out == null) {
    out = g.declare(returnValueType);
  }

  // add the subblock after the out declaration.
  g.getEvalBlock().add(topSub);


  JVar internalOutput = sub.decl(JMod.FINAL, g.getHolderType(returnValueType), getReturnValue().getName(), JExpr._new(g.getHolderType(returnValueType)));
  addProtectedBlock(g, sub, body, inputVariables, workspaceJVars, false);
  if (sub != topSub) {
    sub.assign(internalOutput.ref("isSet"),JExpr.lit(1));// Assign null if NULL_IF_NULL mode
  }
  sub.assign(out.getHolder(), internalOutput);
  if (sub != topSub) {
    sub.assign(internalOutput.ref("isSet"),JExpr.lit(1));// Assign null if NULL_IF_NULL mode
  }

  g.getEvalBlock().directStatement(String.format("//---- end of eval portion of %s function. ----//", getRegisteredNames()[0]));

  return out;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:63,代码来源:DrillSimpleFuncHolder.java


注:本文中的com.sun.codemodel.JExpression.mul方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。