Beispiel #1
0
 public Iterator<CGNode> getPredNodes(CGNode N) {
   IntSet s = getPredNodeNumbers(N);
   if (s == null) {
     return EmptyIterator.instance();
   } else {
     return new IntMapIterator<CGNode>(s.intIterator(), toNode);
   }
 }
 /*
  * @see com.ibm.wala.dataflow.IFDS.ISupergraph#getNormalSuccessors(java.lang.Object)
  */
 public Iterator<Statement> getNormalSuccessors(Statement call) {
   if (!backward) {
     return EmptyIterator.instance();
   } else {
     Assertions.UNREACHABLE();
     return null;
   }
 }
 @Override
 public Iterator<NewSiteReference> iterateNewSites(CGNode node) {
   if (node == null) {
     throw new IllegalArgumentException("node is null");
   }
   assert understands(node);
   GetMethodContext context = (GetMethodContext) node.getContext();
   TypeReference tr = context.getType().getTypeReference();
   if (tr != null) {
     return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(0, tr));
   }
   return EmptyIterator.instance();
 }
  /**
   * Find the next graph node in discover time order.
   *
   * @return the next graph node in discover time order.
   */
  @Override
  public T next() throws NoSuchElementException {

    if (empty()) {
      throw new NoSuchElementException();
    }

    // we always return the top node on the stack.
    T toReturn = peek();

    // compute the next node to return.
    assert getPendingChildren(toReturn) != null;
    do {
      T stackTop = peek();
      for (Iterator<? extends T> it = getPendingChildren(stackTop); it.hasNext(); ) {
        T child = it.next();
        if (getPendingChildren(child) == null) {
          // found a new child.
          visitEdge(stackTop, child);
          setPendingChildren(child, getConnected(child));
          push(child);
          return toReturn;
        }
      }
      // the following saves space by allowing the original iterator to be GCed
      Iterator<T> empty = EmptyIterator.instance();
      setPendingChildren(stackTop, empty);
      // didn't find any new children. pop the stack and try again.
      pop();

    } while (!empty());

    // search for the next unvisited root.
    while (roots.hasNext()) {
      T nextRoot = roots.next();
      if (getPendingChildren(nextRoot) == null) {
        push(nextRoot);
        setPendingChildren(nextRoot, getConnected(nextRoot));
        return toReturn;
      }
    }

    return toReturn;
  }
 @Override
 public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) {
   return EmptyIterator.instance();
 }
 @Override
 public Iterator<FieldReference> iterateFieldsWritten(CGNode node) {
   return EmptyIterator.instance();
 }
 @Override
 public Iterator<CallSiteReference> iterateCallSites(CGNode node) {
   assert understands(node);
   return EmptyIterator.instance();
 }
Beispiel #8
0
 @Override
 public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getNormalSuccessors(
     BasicBlockInContext<IExplodedBasicBlock> call) {
   return EmptyIterator.instance();
 }