• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Pair类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ValidMatches

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public ValidMatches(PAG pag, FieldToEdgesMap fieldToStores) {
	for (Iterator iter = pag.loadSources().iterator(); iter.hasNext();) {
		FieldRefNode loadSource = (FieldRefNode) iter.next();
		SparkField field = loadSource.getField();
		VarNode loadBase = loadSource.getBase();
		ArraySet<Pair<VarNode, VarNode>> storesOnField = fieldToStores.get(field);
		for (Pair<VarNode, VarNode> store : storesOnField) {
			VarNode storeBase = store.getO2();				
			if (loadBase.getP2Set().hasNonEmptyIntersection(storeBase.getP2Set())) {
				VarNode matchSrc = store.getO1();
				Node[] loadTargets = pag.loadLookup(loadSource);
				for (int i = 0; i < loadTargets.length; i++) {
					VarNode matchTgt = (VarNode) loadTargets[i];
					vMatchEdges.put(matchSrc, matchTgt);
					vMatchBarEdges.put(matchTgt, matchSrc);
				}
			}				
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:21,代码来源:ValidMatches.java


示例2: buildStoreMap

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static FieldAccessMap buildStoreMap(PAG pag) {
  FieldAccessMap ret = new FieldAccessMap();
  Iterator frNodeIter = pag.storeInvSourcesIterator();
  while (frNodeIter.hasNext()) {
    FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
    SparkField field = frNode.getField();
    Node[] targets = pag.storeInvLookup(frNode);
    for (int i = 0; i < targets.length; i++) {
      VarNode target = (VarNode) targets[i];
      if (target instanceof GlobalVarNode)
        continue;
      ret.put(field, new Pair<FieldRefNode, LocalVarNode>(frNode, (LocalVarNode) target));
    }
  }
  return ret;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:SootUtil.java


示例3: checkContextsForAllocsCache

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
protected PointsToSetInternal checkContextsForAllocsCache(
		VarAndContext varAndContext, AllocAndContextSet ret,
		PointsToSetInternal locs) {
	PointsToSetInternal retSet = null;
	if (contextsForAllocsCache.containsKey(varAndContext)) {
		for (AllocAndContext allocAndContext : contextsForAllocsCache.get(
				varAndContext).getO2()) {
			if (locs.contains(allocAndContext.alloc)) {
				ret.add(allocAndContext);
			}
		}
		final PointsToSetInternal oldLocs = contextsForAllocsCache.get(
				varAndContext).getO1();
		final PointsToSetInternal tmpSet = new HybridPointsToSet(locs
				.getType(), pag);
		locs.forall(new P2SetVisitor() {

			@Override
			public void visit(Node n) {
				if (!oldLocs.contains(n)) {
					tmpSet.add(n);
				}
			}
		});
		retSet = tmpSet;
		oldLocs.addAll(tmpSet, null);
	} else {
		PointsToSetInternal storedSet = new HybridPointsToSet(locs
				.getType(), pag);
		storedSet.addAll(locs, null);
		contextsForAllocsCache.put(varAndContext,
				new Pair<PointsToSetInternal, AllocAndContextSet>(
						storedSet, new AllocAndContextSet()));
		retSet = locs;
	}
	return retSet;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:38,代码来源:DemandCSPointsTo.java


示例4: caseNewMultiArrayExpr

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
@Override
final public void caseNewMultiArrayExpr( NewMultiArrayExpr nmae ) {
    ArrayType type = (ArrayType) nmae.getType();
    AllocNode prevAn = pag.makeAllocNode(
        new Pair<Expr, Integer>( nmae, new Integer( type.numDimensions ) ), type, method );
    VarNode prevVn = pag.makeLocalVarNode( prevAn, prevAn.getType(), method );
    mpag.addInternalEdge( prevAn, prevVn );
    setResult( prevAn );
    while( true ) {
        Type t = type.getElementType();
        if( !( t instanceof ArrayType ) ) break;
        type = (ArrayType) t;
        AllocNode an = pag.makeAllocNode(
            new Pair<Expr, Integer>( nmae, new Integer( type.numDimensions ) ), type, method );
        VarNode vn = pag.makeLocalVarNode( an, an.getType(), method );
        mpag.addInternalEdge( an, vn );
        mpag.addInternalEdge( vn, pag.makeFieldRefNode( prevVn, ArrayElement.v() ) );
        prevAn = an;
        prevVn = vn;
    }
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:22,代码来源:MethodNodeFactory.java


示例5: isParamVulnAndStore

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
@Override
public void isParamVulnAndStore(SootMethod originMethod, Stmt originStmt, Value reachedValue) { //avoid sideeffect
	//constant already guaranteed by caller
	System.out.println(originStmt);
	String funcSig = originStmt.getInvokeExpr().getMethod().getSignature();
	String valueString = reachedValue.toString();
	if (evaluateResult(funcSig, valueString)) {
		if(DEBUG) {
			System.out.println("result found");
			System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
		}
		this.results.add(new Pair<>(originMethod, new Pair<>(originStmt, valueString)));
	}
	if(DEBUG) {
		if (reachedValue instanceof Constant || reachedValue instanceof StaticFieldRef) {
			System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:APIVulnManager.java


示例6: isParamNode

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static boolean isParamNode(VarNode node) {
  if (node.getVariable() instanceof soot.toolkits.scalar.Pair) {
    soot.toolkits.scalar.Pair pair = (soot.toolkits.scalar.Pair) node.getVariable();
    return (pair.getO1() instanceof SootMethod && (pair.getO2() instanceof Integer || pair.getO2() == PointsToAnalysis.THIS_NODE));
  }
  return false;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:8,代码来源:SootUtil.java


示例7: isThisNode

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/**
 * 
 * @param node
 * @return <code>true</code> if <code>node</code> represents the this
 *         parameter of a method; <code>false</code> otherwise
 */
public static boolean isThisNode(VarNode node) {
  if (node.getVariable() instanceof soot.toolkits.scalar.Pair) {
    soot.toolkits.scalar.Pair pair = (soot.toolkits.scalar.Pair) node.getVariable();
    return (pair.getO1() instanceof SootMethod) && (pair.getO2() == PointsToAnalysis.THIS_NODE);
  }
  return false;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:14,代码来源:SootUtil.java


示例8: addInterproceduralAssignment

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public Pair<Node, Node> addInterproceduralAssignment(Node from, Node to, Edge e) 
{
	Pair<Node, Node> val = new Pair<Node, Node>(from, to);
	
	if ( runGeomPTA ) {
		Set<Edge> sets = assign2edges.get(val);
		if ( sets == null ) {
			sets = new HashSet<Edge>();
			assign2edges.put(val, sets);
		}
		sets.add(e);
	}
	
	return val;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:16,代码来源:PAG.java


示例9: isThisPtr

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/** Returns true if this VarNode represents the THIS pointer */
public boolean isThisPtr()
{
	if ( variable instanceof Pair ) {
		Pair o = (Pair)variable;
		return o.isThisParameter();
	}
	
	return false;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:VarNode.java


示例10: v

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static Parm v( SootMethod m, int index ) {
    Pair<SootMethod, Integer> p = new Pair<SootMethod, Integer>( m, new Integer(index) );
    Parm ret = (Parm) G.v().Parm_pairToElement.get( p );
    if( ret == null ) {
        G.v().Parm_pairToElement.put( p, ret = new Parm( m, index ) );
    }
    return ret;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:9,代码来源:Parm.java


示例11: assignObjectToImpl

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
protected void assignObjectToImpl(ReferenceVariable lhs, AbstractObject obj) {
AllocNode objNode = pag.makeAllocNode( 
	new Pair( "AbstractObject", obj.getType() ),
	 obj.getType(), null );

       VarNode var;
       if( lhs instanceof FieldRefNode ) {
    var = pag.makeGlobalVarNode( objNode, objNode.getType() );
           pag.addEdge( (Node) lhs, var );
       } else {
           var = (VarNode) lhs;
       }
       pag.addEdge( objNode, var );
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:15,代码来源:SparkNativeHelper.java


示例12: caseNewInstance

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseNewInstance( VarNode cls ) {
       if( cls instanceof ContextVarNode ) cls = pag.findLocalVarNode( cls.getVariable() );
VarNode local = pag.makeGlobalVarNode( cls, RefType.v( "java.lang.Object" ) );
       for (SootClass cl : Scene.v().dynamicClasses()) {
           AllocNode site = pag.makeAllocNode( new Pair<VarNode, SootClass>(cls, cl), cl.getType(), null );
           pag.addEdge( site, local );
       }
       return local;
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:10,代码来源:GlobalNodeFactory.java


示例13: caseThis

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseThis() {
VarNode ret = pag.makeLocalVarNode(
	    new Pair<SootMethod, String>( method, PointsToAnalysis.THIS_NODE ),
	    method.getDeclaringClass().getType(), method );
       ret.setInterProcTarget();
       return ret;
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:8,代码来源:MethodNodeFactory.java


示例14: caseParm

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseParm( int index ) {
    VarNode ret = pag.makeLocalVarNode(
                new Pair<SootMethod, Integer>( method, new Integer( index ) ),
                method.getParameterType( index ), method );
    ret.setInterProcTarget();
    return ret;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:8,代码来源:MethodNodeFactory.java


示例15: casePhiExpr

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public void casePhiExpr(PhiExpr e) {
    Pair<Expr, String> phiPair = new Pair<Expr, String>( e, PointsToAnalysis.PHI_NODE );
    Node phiNode = pag.makeLocalVarNode( phiPair, e.getType(), method );
    for (Value op : e.getValues()) {
        op.apply( MethodNodeFactory.this );
        Node opNode = getNode();
        mpag.addInternalEdge( opNode, phiNode );
    }
    setResult( phiNode );
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:MethodNodeFactory.java


示例16: caseCastExpr

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public void caseCastExpr( CastExpr ce ) {
Pair<Expr, String> castPair = new Pair<Expr, String>( ce, PointsToAnalysis.CAST_NODE );
ce.getOp().apply( this );
Node opNode = getNode();
Node castNode = pag.makeLocalVarNode( castPair, ce.getCastType(), method );
mpag.addInternalEdge( opNode, castNode );
setResult( castNode );
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:9,代码来源:MethodNodeFactory.java


示例17: SynchronizedRegion

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public SynchronizedRegion()
{
	this.prepStmt = null;
	this.entermonitor = null;
	this.beginning = null;
	this.earlyEnds = new ArrayList<Pair<Stmt, Stmt>>();
	this.exceptionalEnd = null;
	this.end = null;
	this.last = null;
	this.after = null;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:12,代码来源:SynchronizedRegion.java


示例18: getArgMock

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public SootMethod getArgMock(SootMethod m, SootField base) {
    Pair<SootMethod, SootField> mockKey = new Pair<>(m, base);
    if (argMocks.containsKey(mockKey)) return argMocks.get(mockKey);
    SootMethod argMock = this.createMockSource(m.getName());
    argMocks.put(mockKey, argMock);
    return argMock;
}
 
开发者ID:ylimit,项目名称:HybridFlow,代码行数:8,代码来源:VirtualWebview.java


示例19: findIntAssignmentsForLocal

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/**
 * Return all possible values for an integer local variable.
 * 
 * @param start The statement where the analysis should start.
 * @param local The local variable whose values we are looking for.
 * @param visitedStmts The set of visited statement.
 * @return The set of possible values for the local variable.
 */
private Set<Object> findIntAssignmentsForLocal(Stmt start, Local local, Set<Stmt> visitedStmts) {
  List<DefinitionStmt> assignStmts =
      findAssignmentsForLocal(start, local, true, new HashSet<Pair<Unit, Local>>());
  Set<Object> result = new HashSet<>(assignStmts.size());

  for (DefinitionStmt assignStmt : assignStmts) {
    Value rhsValue = assignStmt.getRightOp();
    if (rhsValue instanceof IntConstant) {
      result.add(((IntConstant) rhsValue).value);
    } else if (rhsValue instanceof LongConstant) {
      result.add(((LongConstant) rhsValue).value);
    } else if (rhsValue instanceof ParameterRef) {
      ParameterRef parameterRef = (ParameterRef) rhsValue;
      Iterator<Edge> edges =
          Scene.v().getCallGraph()
              .edgesInto(AnalysisParameters.v().getIcfg().getMethodOf(assignStmt));
      while (edges.hasNext()) {
        Edge edge = edges.next();
        InvokeExpr invokeExpr = edge.srcStmt().getInvokeExpr();
        Value argValue = invokeExpr.getArg(parameterRef.getIndex());
        if (argValue instanceof IntConstant) {
          result.add(((IntConstant) argValue).value);
        } else if (argValue instanceof LongConstant) {
          result.add(((LongConstant) argValue).value);
        } else if (argValue instanceof Local) {
          Set<Object> newResults =
              findIntAssignmentsForLocal(edge.srcStmt(), (Local) argValue, visitedStmts);
          result.addAll(newResults);
        } else {
          result.add(TOP_VALUE);
        }
      }
    } else {
      return Collections.singleton((Object) TOP_VALUE);
    }
  }

  return result;
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:48,代码来源:IntValueAnalysis.java


示例20: computeVariableValues

import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/**
 * Returns the set of possible values of a variable of type class.
 * 
 * @param value The variable whose value we are looking for.
 * @param start The statement where the analysis should start.
 * @return The set of possible values for the variable.
 */
@Override
public Set<Object> computeVariableValues(Value value, Stmt start) {
  if (value instanceof ClassConstant) {
    return Collections.singleton((Object) ((ClassConstant) value).getValue());
  } else if (value instanceof Local) {
    return processClassAssignments(
        findAssignmentsForLocal(start, (Local) value, true, new HashSet<Pair<Unit, Local>>()),
        new HashSet<Stmt>());
  } else {
    return Collections.singleton((Object) TOP_VALUE);
  }
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:20,代码来源:ClassValueAnalysis.java



注:本文中的soot.toolkits.scalar.Pair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocalReadRunnable类代码示例发布时间:2022-05-22
下一篇:
Java R类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap