本文整理汇总了Java中gov.nasa.jpf.vm.IntChoiceGenerator类的典型用法代码示例。如果您正苦于以下问题:Java IntChoiceGenerator类的具体用法?Java IntChoiceGenerator怎么用?Java IntChoiceGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntChoiceGenerator类属于gov.nasa.jpf.vm包,在下文中一共展示了IntChoiceGenerator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RandomOrderIntCG
import gov.nasa.jpf.vm.IntChoiceGenerator; //导入依赖的package包/类
public RandomOrderIntCG(IntChoiceGenerator sub) {
super(sub.getId());
setPreviousChoiceGenerator(sub.getPreviousChoiceGenerator());
choices = new int[sub.getTotalNumberOfChoices()];
for (int i = 0; i < choices.length; i++) {
sub.advance();
choices[i] = sub.getNextChoice();
}
for (int i = choices.length - 1; i > 0; i--) { // all but first
int j = random.nextInt(i + 1);
int tmp = choices[i];
choices[i] = choices[j];
choices[j] = tmp;
}
nextIdx = -1;
}
示例2: getValue
import gov.nasa.jpf.vm.IntChoiceGenerator; //导入依赖的package包/类
@Override
public Object getValue(ChoiceGenerator generator) {
if (generator instanceof ThreadChoiceGenerator) {
return (getType((ThreadChoiceGenerator) generator));
}
if (generator instanceof BooleanChoiceGenerator) {
return (CGType.DataChoice);
}
if (generator instanceof DoubleChoiceGenerator) {
return (CGType.DataChoice);
}
if (generator instanceof IntChoiceGenerator) {
return (CGType.DataChoice);
}
if (generator instanceof BooleanChoiceGenerator) {
return (CGType.DataChoice);
}
return (null);
}
示例3: choiceGeneratorAdvanced
import gov.nasa.jpf.vm.IntChoiceGenerator; //导入依赖的package包/类
@Override
public void choiceGeneratorAdvanced (VM vm, ChoiceGenerator<?> currentCG){
if (currentCG instanceof IntIntervalGenerator){
int v = ((IntChoiceGenerator)currentCG).getNextChoice();
if (v >= lastVal){
fail("values not decreasing");
}
lastVal = v;
}
}
示例4: getLastChoice
import gov.nasa.jpf.vm.IntChoiceGenerator; //导入依赖的package包/类
protected String getLastChoice() {
ChoiceGenerator<?> cg = vm.getChoiceGenerator();
Object choice = cg.getNextChoice();
Instruction insn = cg.getInsn();
if (cg instanceof BreakGenerator){
return "break";
} else if (choice instanceof ThreadInfo){
int idx = ((ThreadInfo)choice).getId();
return "T"+idx;
} else if (IndexSelector.isIndexChoice(cg)) {
return "idx: " + choice;
} else if (ElementSelector.isElementChoice(cg)) {
return "elem: " + choice;
} else if (insn instanceof AbstractBranching) {
Predicate p = ((AbstractBranching)insn).getLastPredicate();
if (cg instanceof IntChoiceGenerator) {
if ((Integer) cg.getNextChoice() == 0) {
return Negation.create(p).toString(Notation.DOT_NOTATION);
} else {
return p.toString(Notation.DOT_NOTATION);
}
}
} else if (insn instanceof ArrayStoreInstruction || insn instanceof ArrayLoadInstruction) {
if (cg instanceof AbstractChoiceGenerator) {
if ((Integer) cg.getNextChoice() == 0) {
return "outOfBounds";
} else {
return "inBounds";
}
}
}
return choice.toString(); // we probably want more here
}
示例5: randomize
import gov.nasa.jpf.vm.IntChoiceGenerator; //导入依赖的package包/类
public IntChoiceGenerator randomize() {
return new AbstractChoiceGenerator(random.nextBoolean());
}