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

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

java 33次浏览

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

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

示例1: meetIsectAndObjType

点赞 3

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
private boolean meetIsectAndObjType(IntersectionType isectType,
        ObjectType objType) {
    ObjectType lhsObj = isectType.findObjectType();
    List<Type> isectTypes = isectType.getTypes();
    if (lhsObj != null) {
        Pair<ObjectType, Boolean> res = meetObjectTypes(lhsObj, objType);
        if (res.snd) {
            // need to replace object type in intersection
            for (int i = 0; i < isectTypes.size(); i++) {
                if (isectTypes.get(i).equals(lhsObj)) {
                    isectTypes.set(i, res.fst);
                    break;
                }
            }
            return true;
        }
        return false;
        // UGH.  need to write test for when something is used both as an object and a function.  sigh.
    } else {
        // add object type as a case
        isectTypes.add(objType);
        // we changed the type, so return true
        return true;
    }
}
 

开发者ID:Samsung,
项目名称:SJS,
代码行数:26,
代码来源:TypeMeetOperator.java

示例2: collectInitialSeeds

点赞 3

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
/**
 * collect the putstatic instructions in the call graph as {@link PathEdge} seeds for the analysis
 */
private Collection<PathEdge<BasicBlockInContext<IExplodedBasicBlock>>> collectInitialSeeds() {
  Collection<PathEdge<BasicBlockInContext<IExplodedBasicBlock>>> result = HashSetFactory.make();
  for (BasicBlockInContext<IExplodedBasicBlock> bb : supergraph) {
    IExplodedBasicBlock ebb = bb.getDelegate();
    SSAInstruction instruction = ebb.getInstruction();
    if (instruction instanceof SSAPutInstruction) {
      SSAPutInstruction putInstr = (SSAPutInstruction) instruction;
      if (putInstr.isStatic()) {
        final CGNode cgNode = bb.getNode();
        Pair<CGNode, Integer> fact = Pair.make(cgNode, ebb.getFirstInstructionIndex());
        int factNum = domain.add(fact);
        BasicBlockInContext<IExplodedBasicBlock> fakeEntry = getFakeEntry(cgNode);
        // note that the fact number used for the source of this path edge doesn't really matter
        result.add(PathEdge.createPathEdge(fakeEntry, factNum, bb, factNum));

      }
    }
  }
  return result;
}
 

开发者ID:wala,
项目名称:WALA-start,
代码行数:24,
代码来源:ContextSensitiveReachingDefs.java

示例3: tagInvokeInsts

点赞 3

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
private Map<Pair<CGNode, Integer>, HashSet<String>> tagInvokeInsts() {
    Map<Pair<CGNode, Integer>, HashSet<String>> invokeInstTags = new HashMap<>();

    for (CGNode node : icfg.getCallGraph()) {
        String m = node.getMethod().getDeclaringClass().getName().toString();
        if (m.startsWith("Lprologue.js") || m.startsWith("Lpreamble.js"))
            continue;

        IR ir = node.getIR();
        if (ir == null) continue;

        SSAInstruction[] instructions = ir.getInstructions();
        for (int i = 0; i < instructions.length; i++) {
            SSAInstruction instruction = instructions[i];
            if (instruction instanceof JavaScriptInvoke) {
                JavaScriptInvoke invokeInst = (JavaScriptInvoke) instruction;
                Pair<CGNode, Integer> invokeInstItem = Pair.make(node, i);
                HashSet<String> tags = this.getReachingTags(node, invokeInst);
                invokeInstTags.put(invokeInstItem, tags);
            }
        }
    }

    return invokeInstTags;
}
 

开发者ID:ylimit,
项目名称:HybridFlow,
代码行数:26,
代码来源:JSTaintAnalysis.java

示例4: convertHTMLToJS

点赞 3

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
protected SourceModule convertHTMLToJS(URL url) {
  SourceModule ret = null;
  try {
    Pair<Set<MappedSourceModule>,File> parsed = WebUtil.extractScriptFromHTML(url, true);
    File jsfile = parsed.snd; 
    //Dbg.dbg("JSFILE: " + jsfile.getAbsolutePath());
    Set<MappedSourceModule> sms = parsed.fst;
    if (sms.size() < 1) {
      Dbg.err("Nothing returned from WebUtil.extractScriptFromHTML");
    } else if (sms.size() > 1) {
      Dbg.err("Unexpected result from WebUtil.extractScriptFromHTML: " + sms);
    } else {
      ret = (MappedSourceModule)sms.toArray()[0];
    }
  } catch (Error ex) {
    Dbg.warn("Error converting HTML to script: " + ex.getMessage());
  }
  return ret;
}
 

开发者ID:blackoutjack,
项目名称:jamweaver,
代码行数:20,
代码来源:WalaClient.java

示例5: makeValueNumbers

点赞 3

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
private Map makeValueNumbers(IR ir) {
   Map vns = new LinkedHashMap();
   for(Iterator is = iterateInstructions(ir); is.hasNext(); ) {
     SSAInstruction inst = (SSAInstruction)is.next();
     if (inst == null) continue;

     PointerKey[] uses = fieldAccesses.getUses(inst);
     int[] useValueNumbers = new int[ uses.length ];
     for(int j = 0; j < uses.length; j++) {
useValueNumbers[j] = getInitialFieldNumber( uses[j] );
     }
     vns.put(Pair.make(inst, USES), useValueNumbers);
     
     PointerKey[] defs = fieldAccesses.getDefs(inst);
     int[] defValueNumbers = new int[ defs.length ];
     for(int j = 0; j < defs.length; j++) {
defValueNumbers[j] = getInitialFieldNumber( defs[j] );
     }
     vns.put(Pair.make(inst, DEFS), defValueNumbers);
   }
   
   return vns;
 }
 

开发者ID:wala,
项目名称:MemSAT,
代码行数:24,
代码来源:FieldNameSSAConversion.java

示例6: handleFunctionReturnTerm

点赞 2

import com.ibm.wala.util.collections.Pair; //导入依赖的package包/类
private void handleFunctionReturnTerm(
        Consumer<IConstraint> constraintAdder,
        Set<Pair<ITypeTerm, Integer>> constrainedFunctionTerms,
        ITypeConstraint constraint) {
    FunctionReturnTerm returnTerm = (FunctionReturnTerm)(constraint.getLeft() instanceof FunctionReturnTerm ? constraint.getLeft() : constraint.getRight());
    ITypeTerm otherTerm = constraint.getLeft() instanceof FunctionReturnTerm ? constraint.getRight() : constraint.getLeft();
    ITypeTerm functionTerm = returnTerm.getFunctionTerm();
    int nrParams = returnTerm.getNrParams();
    // TODO make sure we handle constructors with parameters
    boolean isConstructorCall = otherTerm instanceof FunctionCallTerm &&
            ((FunctionCallTerm)otherTerm).getFunctionCall() instanceof NewExpression;
    doConstraintsForFunctionTerm(constraintAdder, constrainedFunctionTerms, functionTerm, nrParams, isConstructorCall);
}
 

开发者ID:Samsung,
项目名称:SJS,
代码行数:14,
代码来源:DirectionalConstraintSolver.java


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