示例#1
0
 @Override
 public void setIntValue(FeatureExpr ctx, int pos, Conditional<Integer> newValue) {
   if (Conditional.isTautology(ctx)) {
     values[pos] = newValue;
   } else {
     values[pos] = ChoiceFactory.create(ctx, newValue, values[pos]).simplify();
   }
 }
示例#2
0
 @Override
 public void setReferenceValue(FeatureExpr ctx, int index, Conditional<Integer> newValue) {
   if (Conditional.isTautology(ctx)) {
     values[index] = newValue;
   } else {
     values[index] = ChoiceFactory.create(ctx, newValue, values[index]).simplify();
   }
 }
示例#3
0
 @Parameters(name = "{0} : {1}")
 public static List<Object[]> configurations() {
   List<Object[]> params = new LinkedList<>();
   for (Object[] choice : ChoiceFactory.asParameter()) {
     params.add(new Object[] {choice[0], FeatureExprFactory.bdd()});
     params.add(new Object[] {choice[0], FeatureExprFactory.sat()});
   }
   return params;
 }
示例#4
0
 /* (non-Javadoc)
  * @see gov.nasa.jpf.vm.IStackHandler#storeOperand(de.fosd.typechef.featureexpr.FeatureExpr, int)
  */
 @Override
 public void storeOperand(final FeatureExpr ctx, final int index) {
   if (Conditional.isTautology(ctx)) {
     locals[index] = popEntry(ctx, true);
   } else {
     if (locals[index] == null) {
       locals[index] = new One<>(new Entry(MJIEnv.NULL, false));
     }
     locals[index] = ChoiceFactory.create(ctx, popEntry(ctx, true), locals[index]).simplify();
   }
 }
示例#5
0
  public ConditionalTest(Factory factory, AbstractFeatureExprFactory fexprFeactory) {
    ChoiceFactory.setDefault(factory);
    FeatureExprFactory.setDefault(fexprFeactory);

    fa = FeatureExprFactory.createDefinedExternal("A");
    fb = FeatureExprFactory.createDefinedExternal("B");
    fc = FeatureExprFactory.createDefinedExternal("C");
    fd = FeatureExprFactory.createDefinedExternal("D");
    fe = FeatureExprFactory.createDefinedExternal("E");
    ff = FeatureExprFactory.createDefinedExternal("F");
    fg = FeatureExprFactory.createDefinedExternal("G");
  }
示例#6
0
 /* (non-Javadoc)
  * @see gov.nasa.jpf.vm.IStackHandler#setLocal(de.fosd.typechef.featureexpr.FeatureExpr, int, int, boolean)
  */
 @Override
 public void setLocal(
     final FeatureExpr ctx, final int index, final int value, final boolean isRef) {
   if (Conditional.isTautology(ctx)) {
     locals[index] = new One<>(new Entry(value, isRef));
   } else {
     if (locals[index] == null) {
       locals[index] = new One<>(new Entry(0, false));
     }
     locals[index] =
         ChoiceFactory.create(ctx, new One<>(new Entry(value, isRef)), locals[index]).simplify();
   }
 }
示例#7
0
  /* (non-Javadoc)
   * @see gov.nasa.jpf.vm.IStackHandler#storeLongOperand(de.fosd.typechef.featureexpr.FeatureExpr, int)
   */
  @Override
  public void storeLongOperand(final FeatureExpr ctx, final int index) {
    /*
    stack.mapf(ctx, new VoidBiFunction<FeatureExpr, Stack>() {

      @Override
      public void apply(final FeatureExpr f, final Stack stack) {
        if (Conditional.isContradiction(f)) {
          return;
        }
        locals[index + 1] = ChoiceFactory.create(f, popEntry(f, false), locals[index + 1]);
        locals[index] = ChoiceFactory.create(f, popEntry(f, false), locals[index]);
      }
    });
    locals[index] = locals[index].simplify();
    locals[index + 1] = locals[index + 1].simplify();
    stack = stack.simplify();
    */
    locals[index + 1] = ChoiceFactory.create(ctx, popEntry(ctx, false), locals[index + 1]);
    locals[index] = ChoiceFactory.create(ctx, popEntry(ctx, false), locals[index]);

    locals[index] = locals[index].simplify();
    locals[index + 1] = locals[index + 1].simplify();
  }
示例#8
0
  @Override
  public void setFloatValue(FeatureExpr ctx, int index, Conditional<Float> newValue) {
    if (Conditional.isTautology(ctx)) {
      values[index] = new One<>(Types.floatToInt(newValue.getValue()));
    } else {
      values[index] =
          ChoiceFactory.create(
                  ctx,
                  newValue.map(
                      new Function<Float, Integer>() {

                        @Override
                        public Integer apply(Float v) {
                          return Types.floatToInt(v);
                        }
                      }),
                  values[index])
              .simplify();
    }
  }
示例#9
0
  @Override
  public void setByteValue(FeatureExpr ctx, int index, Conditional<Byte> newValue) {
    if (Conditional.isTautology(ctx)) {
      values[index] = new One<>((int) newValue.getValue());
    } else {
      values[index] =
          ChoiceFactory.create(
                  ctx,
                  newValue.map(
                      new Function<Byte, Integer>() {

                        @Override
                        public Integer apply(Byte x) {
                          return (int) x;
                        }
                      }),
                  values[index])
              .simplify();
    }
  }
示例#10
0
  @Override
  public void setBooleanValue(FeatureExpr ctx, int index, Conditional<Boolean> newValue) {
    if (Conditional.isTautology(ctx)) {
      values[index] = new One<>(newValue.getValue() ? 1 : 0);
    } else {
      values[index] =
          ChoiceFactory.create(
                  ctx,
                  newValue.map(
                      new Function<Boolean, Integer>() {

                        @Override
                        public Integer apply(Boolean v) {
                          return v ? 1 : 0;
                        }
                      }),
                  values[index])
              .simplify();
    }
  }
示例#11
0
 private static Conditional<Integer> Choice(
     FeatureExpr f, Conditional<Integer> first, Conditional<Integer> second) {
   return ChoiceFactory.create(f, first, second);
 }
示例#12
0
 @Override
 public void setCharValue(FeatureExpr ctx, int index, Conditional<Character> newValue) {
   values[index] = ChoiceFactory.create(ctx, newValue.map(SetCharValue), values[index]).simplify();
 }