• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java UnaryMinus类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中gov.nasa.jpf.constraints.expressions.UnaryMinus的典型用法代码示例。如果您正苦于以下问题:Java UnaryMinus类的具体用法?Java UnaryMinus怎么用?Java UnaryMinus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

UnaryMinus类属于gov.nasa.jpf.constraints.expressions包,在下文中一共展示了UnaryMinus类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public Instruction execute(ThreadInfo ti) {
	StackFrame sf = ti.getTopFrame();
   
   if (sf.getOperandAttr() == null) {
     return super.execute(ti);
   }    
   
  ConcolicUtil.Pair<Integer> negated = ConcolicUtil.popInt(sf);
   
   UnaryMinus<Integer> symb = new UnaryMinus<Integer>(negated.symb);    
   int conc = -negated.conc;    
   
   ConcolicUtil.Pair<Integer> result = new ConcolicUtil.Pair<Integer>(conc, symb);
   ConcolicUtil.pushInt(result, sf);

   if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute INEG: " + result);		
   return getNext(ti);         
	}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:20,
代码来源:INEG.java

示例2: execute

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public Instruction execute(ThreadInfo ti) {
	StackFrame sf = ti.getTopFrame();
   
   if (sf.getLongOperandAttr() == null) {
     return super.execute(ti);
   }    
   
  ConcolicUtil.Pair<Double> negated = ConcolicUtil.popDouble(sf);
   
   UnaryMinus<Double> symb = new UnaryMinus<Double>(negated.symb);    
   double conc = -negated.conc;    
   
   ConcolicUtil.Pair<Double> result = new ConcolicUtil.Pair<Double>(conc, symb);
   ConcolicUtil.pushDouble(result, sf);

   if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute DNEG: " + result);		
   return getNext(ti);         
	}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:20,
代码来源:DNEG.java

示例3: execute

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public Instruction execute(ThreadInfo ti) {
	StackFrame sf = ti.getTopFrame();
   
   if (sf.getLongOperandAttr() == null) {
     return super.execute(ti);
   }    
   
  ConcolicUtil.Pair<Long> negated = ConcolicUtil.popLong(sf);
   
   UnaryMinus<Long> symb = new UnaryMinus<Long>(negated.symb);    
   long conc = -negated.conc;    
   
   ConcolicUtil.Pair<Long> result = new ConcolicUtil.Pair<Long>(conc, symb);
   ConcolicUtil.pushLong(result, sf);

   if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute LNEG: " + result);		
   return getNext(ti);         
	}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:20,
代码来源:LNEG.java

示例4: execute

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public Instruction execute(ThreadInfo ti) {
	StackFrame sf = ti.getTopFrame();
   
   if (sf.getOperandAttr() == null) {
     return super.execute(ti);
   }    
   
  ConcolicUtil.Pair<Float> negated = ConcolicUtil.popFloat(sf);
   
   UnaryMinus<Float> symb = new UnaryMinus<Float>(negated.symb);    
   float conc = -negated.conc;    
   
   ConcolicUtil.Pair<Float> result = new ConcolicUtil.Pair<Float>(conc, symb);
   ConcolicUtil.pushFloat(result, sf);

   if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute FNEG: " + result);		
   return getNext(ti);         
	}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:20,
代码来源:FNEG.java

示例5: visit

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E> Expr visit(
    UnaryMinus<E> n, Void data) {
  Expr negated = null;
  try {
    negated = visit(n.getNegated(), null);
    Type<E> type = n.getType(); 
    
    if(type instanceof BVIntegerType) {
      return ctx.mkBVNeg((BitVecExpr)negated);
    }
    
    return ctx.mkUnaryMinus((ArithExpr)negated);
  }
  catch(Z3Exception ex) {
    throw new RuntimeException();
  }
  finally {
    safeDispose(negated);
  }
}
 

开发者ID:psycopaths,
项目名称:jconstraints-z3,
代码行数:22,
代码来源:NativeZ3ExpressionGenerator.java

示例6: atan2

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> atan2() {
    Variable x = doubleVar();                
    Variable y = doubleVar();                
    
    // y>=0 => atan2_y_pos(y,x)
    // y<0 => -atan2(-y,x)
    Expression<Boolean> ifCond = gte(y, constant(0.0));
    Expression thenExpr = fexpr(ATAN2_Y_POS, y, x);
    Expression elseExpr = new UnaryMinus(fexpr(ATAN2_Y_POS, new UnaryMinus(y), x));
    
    // y=0, x=0 
    elseExpr = ite(ifCond, thenExpr, elseExpr);
    thenExpr = constant(Math.atan2(0.0, 0.0));
    ifCond = ExpressionUtil.and( eq(x, constant(0.0)), eq(y, constant(0.0)));

    return forall(eq(fexpr(MathFunctions.ATAN2, y, x), 
            ite(ifCond, thenExpr, elseExpr)), x, y);  
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:19,
代码来源:Atan2Properties.java

示例7: tanPi

点赞 3

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> tanPi() {
    Variable arg = doubleVar();                
    
    // pi * 1.5 <= arg <= pi * 2.0
    Expression<Boolean> ifCond = bounds(arg, Math.PI * 1.5, Math.PI * 2.0, false, false);
    Expression elseExpr = constant(0.0);
    Expression thenExpr = new UnaryMinus(fexpr(TAN_LOOKUP, minus(constant(Math.PI * 2.0), arg)));
    elseExpr = ite(ifCond, thenExpr, elseExpr);        
    
    // pi <= arg <= pi * 1.5
    ifCond = bounds(arg, Math.PI, Math.PI * 1.5, false, false);
    thenExpr = fexpr(TAN_LOOKUP, minus(arg, constant(Math.PI)));
    elseExpr = ite(ifCond, thenExpr, elseExpr);
    
    // pi * 0.5 <= arg <= pi
    ifCond = bounds(arg, Math.PI * 0.5, Math.PI, false, false);
    thenExpr = fexpr(TAN_LOOKUP, new UnaryMinus(minus(constant(Math.PI), arg)));
    elseExpr = ite(ifCond, thenExpr, elseExpr);
    
    // 0.0 <= arg <= pi * 0.5
    ifCond = bounds(arg, 0.0, Math.PI * 0.5, false, false);
    thenExpr = fexpr(TAN_LOOKUP, arg);
    
    return forall(eq(fexpr(TAN_PI, arg), 
            ite(ifCond, thenExpr, elseExpr)), arg);        
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:27,
代码来源:TanProperties.java

示例8: abs__D__D

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@MJI
@SymbolicPeer
public double abs__D__D(MJIEnv env, int clsRef, double a) {
  Expression<Double> asym = argAttribute(env, BuiltinTypes.DOUBLE);
  if(asym != null) {
    Expression<Double> symReturn = ite(gte(asym, new Constant<>(BuiltinTypes.DOUBLE, 0.0)), asym, new UnaryMinus<>(asym));
    env.setReturnAttribute(symReturn);
  }
  return Math.abs(a);
}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:11,
代码来源:JPF_java_lang_Math.java

示例9: abs__J__J

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@MJI
@SymbolicPeer
public long abs__J__J(MJIEnv env, int clsRef, long a) {
  Expression<Long> asym = argAttribute(env, BuiltinTypes.SINT64);
  if(asym != null) {
    Expression<Long> symReturn = ite(gte(asym, new Constant<>(BuiltinTypes.SINT64, 0L)), asym, new UnaryMinus<>(asym));
    env.setReturnAttribute(symReturn);
  }
  return Math.abs(a);
}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:11,
代码来源:JPF_java_lang_Math.java

示例10: ceil__D__D

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@MJI
@SymbolicPeer
public double ceil__D__D(MJIEnv env, int clsRef, double a) {
  Expression<Double> asym = argAttribute(env, BuiltinTypes.DOUBLE);
  if(asym != null) {
    Expression<Double> symReturn = new UnaryMinus<>(
        CastExpression.create(
            CastExpression.create(
                new UnaryMinus<>(asym), BuiltinTypes.INTEGER),
            BuiltinTypes.DOUBLE));
    env.setReturnAttribute(symReturn);
  }
  return Math.ceil(a);
}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:15,
代码来源:JPF_java_lang_Math.java

示例11: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E> Object visit(UnaryMinus<E> n, Void data) {
	Object negated = null;
	negated = visit(n.getNegated(), null);
	if(negated instanceof SymInt) {
		return Util.mul(new SymIntConstant(-1), (SymInt)negated);
	} else if(negated instanceof SymLong) {
     return Util.mul(new SymLongConstant(-1L), (SymLong)negated);
	} else if(negated instanceof SymDouble) {
		return Util.mul(new SymDoubleConstant(-1.0), (SymDouble)negated);
	} else if(negated instanceof SymFloat) {
     return Util.mul(new SymFloatConstant(-1.0f), (SymFloat)negated);
   } else
		throw new UnsupportedOperationException("Unary minus not defined for " + negated.getClass());
}
 

开发者ID:psycopaths,
项目名称:jconstraints-coral,
代码行数:16,
代码来源:CoralExpressionGenerator.java

示例12: asin

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> asin() {
    Variable arg = doubleVar();                
    Expression<Boolean> ifCond = gte(arg, constant(0.0));
    Expression thenExpr = fexpr(ASIN_LOOKUP, arg);
    Expression elseExpr = new UnaryMinus(fexpr(ASIN_LOOKUP, new UnaryMinus(arg)));        
    return forall(eq(fexpr(MathFunctions.ASIN, arg), 
            ite(ifCond, thenExpr, elseExpr)), arg);                
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:9,
代码来源:AsinProperties.java

示例13: sin

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> sin() {
    Variable arg = doubleVar();                
    Expression<Boolean> ifCond = gte(arg, constant(0.0));
    Expression thenExpr = fexpr(SIN_PI, arg);
    Expression elseExpr = new UnaryMinus(fexpr(SIN_PI, new UnaryMinus(arg)));        
    return forall(eq(fexpr(MathFunctions.SIN, arg), 
            ite(ifCond, thenExpr, elseExpr)), arg);                
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:9,
代码来源:SinProperties.java

示例14: atan2_y_pos

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> atan2_y_pos() {
    Variable x = doubleVar();                
    Variable y = doubleVar();                
    Expression<Boolean> ifCond = gte(x, constant(0.0));
    Expression thenExpr = fexpr(ATAN2_LOOKUP, y, x);
    Expression elseExpr = minus(constant(180.0), fexpr(ATAN2_LOOKUP, y, new UnaryMinus(x)));        
    return forall(eq(fexpr(ATAN2_Y_POS, y, x), 
            ite(ifCond, thenExpr, elseExpr)), x, y);                        
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:10,
代码来源:Atan2Properties.java

示例15: tan

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private Expression<Boolean> tan() {
    Variable arg = doubleVar();                
    Expression<Boolean> ifCond = gte(arg, constant(0.0));
    Expression thenExpr = fexpr(TAN_PI, arg);
    Expression elseExpr = new UnaryMinus(fexpr(TAN_PI, new UnaryMinus(arg)));        
    return forall(eq(fexpr(MathFunctions.TAN, arg), 
            ite(ifCond, thenExpr, elseExpr)), arg);                
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:9,
代码来源:TanProperties.java

示例16: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E> Expression<?> visit(Variable<E> v, Boolean data) {
  if(!data)
    return v;
  Expression<Boolean> asBool = v.as(BuiltinTypes.BOOL);
  if(asBool != null)
    return new Negation(asBool);
  if(v.getType() instanceof NumericType)
    return new UnaryMinus<>(v);
  throw new IllegalStateException("Cannot simplify: expression of type " + v.getType() + " is neither boolean nor numeric");
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:12,
代码来源:ExpressionSimplificationVisitor.java

示例17: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E>
Boolean visit(UnaryMinus<E> n,Void data) { 
  return visit(n.getNegated(), data); 
}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:6,
代码来源:FunctionFilter.java

示例18: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E>
UnaryMinus<E> visit(UnaryMinus<E> n,Collection<FunctionExpression> data) { 
  return new UnaryMinus(visit(n.getNegated(), data)); 
}
 

开发者ID:psycopaths,
项目名称:jdart,
代码行数:6,
代码来源:FunctionFinder.java

示例19: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E> String visit(UnaryMinus<E> n, HashMap<Class, String> data) {
  String negated = visit(n.getNegated());
  return TransitionEncoding.unaryMinus + ":" + negated + ";";
}
 

开发者ID:psycopaths,
项目名称:psyco,
代码行数:6,
代码来源:ExpressionConverterVisitor.java

示例20: parseUnaryMinus

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
private UnaryMinus parseUnaryMinus() {
  currentLine = currentLine.substring(2);
  Expression unaryExpression = parseNextExpression();
  currentLine = currentLine.substring(1);
  return UnaryMinus.create(unaryExpression);
}
 

开发者ID:psycopaths,
项目名称:psyco,
代码行数:7,
代码来源:TransitionSystemLoader.java

示例21: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
public <E> R visit(
UnaryMinus<E> n, D data);
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:3,
代码来源:ExpressionVisitor.java

示例22: visit

点赞 2

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
@Override
public <E> ExpressionType visit(UnaryMinus<E> n, Void data) {
  return visit(n.getNegated());
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:5,
代码来源:ExpressionClassifierVisitor.java

示例23: translateUnaryMinus

点赞 1

import gov.nasa.jpf.constraints.expressions.UnaryMinus; //导入依赖的package包/类
public Expression<?> translateUnaryMinus(Tree n) {
  requireType(n, UNARY_MINUS);
  
  Expression<?> negated = translateArithmeticExpression(n.getChild(0));
  
  return UnaryMinus.create(negated);
}
 

开发者ID:psycopaths,
项目名称:jconstraints,
代码行数:8,
代码来源:ASTTranslator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)