本文整理匯總了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());
}