本文整理汇总了Java中com.sun.codemodel.JBlock._break方法的典型用法代码示例。如果您正苦于以下问题:Java JBlock._break方法的具体用法?Java JBlock._break怎么用?Java JBlock._break使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.codemodel.JBlock
的用法示例。
在下文中一共展示了JBlock._break方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMethodFieldSetFieldValue
import com.sun.codemodel.JBlock; //导入方法依赖的package包/类
private void createMethodFieldSetFieldValue(JDefinedClass _class, Map<String, JType> fields) {
JMethod method = _class.method(JMod.PUBLIC, Void.TYPE, "setFieldValue");
JClass refEnumFields = codeModel.ref(_class.fullName() + DOT_FIELD);
JVar param = method.param(refEnumFields, "field");
JVar param2 = method.param(codeModel.ref(Object.class), "value");
JBlock body = method.body();
JSwitch _switch = body._switch(param);
for (Map.Entry<String, JType> entry : fields.entrySet()) {
JBlock bodyCase = _switch._case(JExpr.ref(entry.getKey().toUpperCase())).body();
JConditional _if = bodyCase._if(param2.eq(JExpr._null()));
String capitalizeName = JavaGeneratorUtil.getCapitalizeString(entry.getKey());
_if._then().invoke("unset" + capitalizeName);
_if._else().invoke("set" + capitalizeName).arg(JExpr.cast(getTypeGetMethodByName(_class, capitalizeName), param2));
bodyCase._break();
}
// JInvocation _newException = JExpr._new(codeModel.ref(IllegalStateException.class));
// _switch._default().body()._throw(_newException);
}
示例2: visitBooleanAnd
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例3: visitBooleanOr
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例4: visitBooleanAnd
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例5: visitBooleanOr
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例6: visitBooleanAnd
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例7: visitBooleanOr
import com.sun.codemodel.JBlock; //导入方法依赖的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;
}
示例8: introduceUserCodeBlock
import com.sun.codemodel.JBlock; //导入方法依赖的package包/类
private void introduceUserCodeBlock(JDefinedClass jc, JCodeModel jm,
ConcreticisedMethod block,
JSwitch methodSwitch,
JVar _ca2, JVar _ca1,
Map<String, JMethod> virtualMethods) {
JMethod vmethhandler = jc.method(JMod.PUBLIC,
jm.VOID,
block.getRefMeth().getArguments().get(0).getIdentificator());
vmethhandler._throws(AVEInternaException.class);
vmethhandler.javadoc().add("Virtual method handler for " + block.getMethodName() + " method.");
vmethhandler.javadoc().addThrows(AVEInternaException.class).
add("Throws when message has an invalid instance.");
allMethods.put(UCB_DECLPREFIX + block.getMethodName(), methodsEnum.enumConstant(UCB_DECLPREFIX + block.getMethodName()));
JBlock userBlockSwitch = methodSwitch._case(JExpr.ref(UCB_DECLPREFIX + block.getMethodName())).body();
JArray mthNames = JExpr.newArray(jm.ref(String.class));
int argId = 0;
for (Argument arg : block.getRefMeth().getArguments()) {
String defaultV = arg.getDefaultValue();
userBlockSwitch.add(_ca2.invoke("add").arg(
JExpr._new(jm.ref(Node.class))
.arg(arg.getIdentificator())
.arg(arg.getType())
.arg(defaultV == null ? "" : defaultV)
.arg(JExpr.lit(arg.isFixed()))));
mthNames.add(JExpr.lit(arg.getIdentificator()));
vmethargs.put(block.getMethodName() + argId, vmethhandler.param(Message.class, arg.getIdentificator()));
argId++;
}
userBlockSwitch.add(_ca1.invoke("add").arg(jm.ref(Arrays.class)
.staticInvoke("asList").arg(mthNames)));
userBlockSwitch._break();
virtualMethods.put(block.getMethodName(), vmethhandler);
}