Search in sources :

Example 31 with Iterator

use of java.util.Iterator in project platform_frameworks_base by android.

the class ActivityManagerService method dumpBroadcastsLocked.

void dumpBroadcastsLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage) {
    boolean needSep = false;
    boolean onlyHistory = false;
    boolean printedAnything = false;
    if ("history".equals(dumpPackage)) {
        if (opti < args.length && "-s".equals(args[opti])) {
            dumpAll = false;
        }
        onlyHistory = true;
        dumpPackage = null;
    }
    pw.println("ACTIVITY MANAGER BROADCAST STATE (dumpsys activity broadcasts)");
    if (!onlyHistory && dumpAll) {
        if (mRegisteredReceivers.size() > 0) {
            boolean printed = false;
            Iterator it = mRegisteredReceivers.values().iterator();
            while (it.hasNext()) {
                ReceiverList r = (ReceiverList) it.next();
                if (dumpPackage != null && (r.app == null || !dumpPackage.equals(r.app.info.packageName))) {
                    continue;
                }
                if (!printed) {
                    pw.println("  Registered Receivers:");
                    needSep = true;
                    printed = true;
                    printedAnything = true;
                }
                pw.print("  * ");
                pw.println(r);
                r.dump(pw, "    ");
            }
        }
        if (mReceiverResolver.dump(pw, needSep ? "\n  Receiver Resolver Table:" : "  Receiver Resolver Table:", "    ", dumpPackage, false, false)) {
            needSep = true;
            printedAnything = true;
        }
    }
    for (BroadcastQueue q : mBroadcastQueues) {
        needSep = q.dumpLocked(fd, pw, args, opti, dumpAll, dumpPackage, needSep);
        printedAnything |= needSep;
    }
    needSep = true;
    if (!onlyHistory && mStickyBroadcasts != null && dumpPackage == null) {
        for (int user = 0; user < mStickyBroadcasts.size(); user++) {
            if (needSep) {
                pw.println();
            }
            needSep = true;
            printedAnything = true;
            pw.print("  Sticky broadcasts for user ");
            pw.print(mStickyBroadcasts.keyAt(user));
            pw.println(":");
            StringBuilder sb = new StringBuilder(128);
            for (Map.Entry<String, ArrayList<Intent>> ent : mStickyBroadcasts.valueAt(user).entrySet()) {
                pw.print("  * Sticky action ");
                pw.print(ent.getKey());
                if (dumpAll) {
                    pw.println(":");
                    ArrayList<Intent> intents = ent.getValue();
                    final int N = intents.size();
                    for (int i = 0; i < N; i++) {
                        sb.setLength(0);
                        sb.append("    Intent: ");
                        intents.get(i).toShortString(sb, false, true, false, false);
                        pw.println(sb.toString());
                        Bundle bundle = intents.get(i).getExtras();
                        if (bundle != null) {
                            pw.print("      ");
                            pw.println(bundle.toString());
                        }
                    }
                } else {
                    pw.println("");
                }
            }
        }
    }
    if (!onlyHistory && dumpAll) {
        pw.println();
        for (BroadcastQueue queue : mBroadcastQueues) {
            pw.println("  mBroadcastsScheduled [" + queue.mQueueName + "]=" + queue.mBroadcastsScheduled);
        }
        pw.println("  mHandler:");
        mHandler.dump(new PrintWriterPrinter(pw), "    ");
        needSep = true;
        printedAnything = true;
    }
    if (!printedAnything) {
        pw.println("  (nothing)");
    }
}
Also used : Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) Point(android.graphics.Point) PrintWriterPrinter(android.util.PrintWriterPrinter) Iterator(java.util.Iterator) Map(java.util.Map) ArrayMap(android.util.ArrayMap) HashMap(java.util.HashMap) ProcessMap(com.android.internal.app.ProcessMap)

Example 32 with Iterator

use of java.util.Iterator in project freeline by alibaba.

the class GroovyFileUil method getLastPlugin.

/**
     * 获取最后一个插件的表达式
     *
     * @param buildScript
     * @return
     */
public static GrExpression getLastPlugin(GroovyFile buildScript) {
    Iterator var2 = getMethodCalls(buildScript, "apply").iterator();
    GrExpression expression = null;
    while (var2.hasNext()) {
        GrMethodCall methodCall = (GrMethodCall) var2.next();
        expression = methodCall.getInvokedExpression();
    }
    return expression;
}
Also used : GrMethodCall(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall) Iterator(java.util.Iterator) GrExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression)

Example 33 with Iterator

use of java.util.Iterator in project jstorm by alibaba.

the class TransferDrainer method getBundleIterator.

private Iterator<TaskMessage> getBundleIterator(final ArrayList<ArrayList<TaskMessage>> bundle) {
    if (null == bundle) {
        return null;
    }
    return new Iterator<TaskMessage>() {

        private int offset = 0;

        private int size = 0;

        {
            for (ArrayList<TaskMessage> list : bundle) {
                size += list.size();
            }
        }

        private int bundleOffset = 0;

        private Iterator<TaskMessage> iter = bundle.get(bundleOffset).iterator();

        @Override
        public boolean hasNext() {
            if (offset < size) {
                return true;
            }
            return false;
        }

        @Override
        public TaskMessage next() {
            TaskMessage msg = null;
            if (iter.hasNext()) {
                msg = iter.next();
            } else {
                bundleOffset++;
                iter = bundle.get(bundleOffset).iterator();
                msg = iter.next();
            }
            if (null != msg) {
                offset++;
            }
            return msg;
        }

        @Override
        public void remove() {
            throw new RuntimeException("not supported");
        }
    };
}
Also used : Iterator(java.util.Iterator) TaskMessage(backtype.storm.messaging.TaskMessage)

Example 34 with Iterator

use of java.util.Iterator in project Conversations by siacs.

the class DatabaseBackend method getMessagesIterable.

public Iterable<Message> getMessagesIterable(final Conversation conversation) {
    return new Iterable<Message>() {

        @Override
        public Iterator<Message> iterator() {
            class MessageIterator implements Iterator<Message> {

                SQLiteDatabase db = getReadableDatabase();

                String[] selectionArgs = { conversation.getUuid() };

                Cursor cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION + "=?", selectionArgs, null, null, Message.TIME_SENT + " ASC", null);

                public MessageIterator() {
                    cursor.moveToFirst();
                }

                @Override
                public boolean hasNext() {
                    return !cursor.isAfterLast();
                }

                @Override
                public Message next() {
                    Message message = Message.fromCursor(cursor);
                    cursor.moveToNext();
                    return message;
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            }
            return new MessageIterator();
        }
    };
}
Also used : Message(eu.siacs.conversations.entities.Message) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Iterator(java.util.Iterator) Cursor(android.database.Cursor)

Example 35 with Iterator

use of java.util.Iterator in project lombok by rzwitserloot.

the class FileSystemSourceCache method sourcesForDirectory.

private Iterable<ConfigurationSource> sourcesForDirectory(final File directory, final ConfigurationProblemReporter reporter) {
    return new Iterable<ConfigurationSource>() {

        @Override
        public Iterator<ConfigurationSource> iterator() {
            return new Iterator<ConfigurationSource>() {

                File currentDirectory = directory;

                ConfigurationSource next;

                boolean stopBubbling = false;

                @Override
                public boolean hasNext() {
                    if (next != null)
                        return true;
                    if (stopBubbling)
                        return false;
                    next = findNext();
                    return next != null;
                }

                @Override
                public ConfigurationSource next() {
                    if (!hasNext())
                        throw new NoSuchElementException();
                    ConfigurationSource result = next;
                    next = null;
                    return result;
                }

                private ConfigurationSource findNext() {
                    while (currentDirectory != null && next == null) {
                        next = getSourceForDirectory(currentDirectory, reporter);
                        currentDirectory = currentDirectory.getParentFile();
                    }
                    if (next != null) {
                        Result stop = next.resolve(ConfigurationKeys.STOP_BUBBLING);
                        stopBubbling = (stop != null && Boolean.TRUE.equals(stop.getValue()));
                    }
                    return next;
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
}
Also used : Iterator(java.util.Iterator) File(java.io.File) NoSuchElementException(java.util.NoSuchElementException) Result(lombok.core.configuration.ConfigurationSource.Result)

Aggregations

Iterator (java.util.Iterator)8930 ArrayList (java.util.ArrayList)2267 Set (java.util.Set)1895 HashMap (java.util.HashMap)1828 Map (java.util.Map)1714 List (java.util.List)1622 HashSet (java.util.HashSet)1602 Test (org.junit.Test)624 IOException (java.io.IOException)524 Collection (java.util.Collection)377 Region (org.apache.geode.cache.Region)240 SSOException (com.iplanet.sso.SSOException)227 File (java.io.File)216 LinkedList (java.util.LinkedList)213 TreeSet (java.util.TreeSet)191 LinkedHashMap (java.util.LinkedHashMap)181 Entry (java.util.Map.Entry)174 SMSException (com.sun.identity.sm.SMSException)169 ListIterator (java.util.ListIterator)146 TreeMap (java.util.TreeMap)145