コード例 #1
0
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
 @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
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
 @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
ファイル: ConditionalTest.java プロジェクト: ckaestne/VarexJ
 @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
ファイル: StackHandler.java プロジェクト: lambda-land/VarexJ
 /* (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
ファイル: ConditionalTest.java プロジェクト: ckaestne/VarexJ
  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
ファイル: StackHandler.java プロジェクト: lambda-land/VarexJ
 /* (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
ファイル: StackHandler.java プロジェクト: lambda-land/VarexJ
  /* (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
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
  @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
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
  @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
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
  @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
ファイル: ConditionalTest.java プロジェクト: ckaestne/VarexJ
 private static Conditional<Integer> Choice(
     FeatureExpr f, Conditional<Integer> first, Conditional<Integer> second) {
   return ChoiceFactory.create(f, first, second);
 }
コード例 #12
0
ファイル: NamedFields.java プロジェクト: Meng1024/VarexJ
 @Override
 public void setCharValue(FeatureExpr ctx, int index, Conditional<Character> newValue) {
   values[index] = ChoiceFactory.create(ctx, newValue.map(SetCharValue), values[index]).simplify();
 }