Package java.util

Examples of java.util.LinkedList$ListItr


    public static List getDescendents( Element parent ) {
        if(parent == null){
            ArgCheck.isNotNull(parent,CorePlugin.Util.getString("JdomHelper.The_JDOM_Element_reference_may_not_be_null_15")); //$NON-NLS-1$
        }

        final List results = new LinkedList();
        levelOrderTraversal( parent,
            new XMLVisitor() {
                public void visit( Object obj ) {
                    results.add( obj );
                }
            }
        );
        return results;
    }
View Full Code Here


       
        if(name.length() == 0){
            ArgCheck.isNotZeroLength(name,CorePlugin.Util.getString("JdomHelper.The_name_may_not_be_zero-length_18")); //$NON-NLS-1$
        }

        final List results = new LinkedList();
        levelOrderTraversal( parent,
            new XMLVisitor() {
                public void visit( Object obj ) {
                    if( ((Element)obj).getName().equals(name) ) {
                        results.add( obj );
                    }
                }
            }
        );
        return results;
View Full Code Here

        }
        if(ns == null){
            ArgCheck.isNotNull(ns,CorePlugin.Util.getString("JdomHelper.The_Namespace_may_not_be_null_20")); //$NON-NLS-1$
        }

        final List results = new LinkedList();
        levelOrderTraversal( parent,
            new XMLVisitor() {
                public void visit( Object obj ) {
                    if( ((Element)obj).getNamespace().equals(ns) ) {
                        results.add( obj );
                    }
                }
            }
        );
        return results;
View Full Code Here

    private Log logger = LogFactory.getLog(this.getClass());

    public List getPools() throws Exception {

        List memoryPools = new LinkedList();
        MBeanServer mBeanServer = new Registry().getMBeanServer();
        Set memoryOPools = mBeanServer.queryMBeans(new ObjectName("java.lang:type=MemoryPool,*"), null);

        //
        // totals
        //
        long totalInit = 0;
        long totalMax = 0;
        long totalUsed = 0;
        long totalCommitted = 0;

        for (Iterator it = memoryOPools.iterator(); it.hasNext();) {
            ObjectInstance oi = (ObjectInstance) it.next();
            ObjectName oName = oi.getObjectName();
            MemoryPool memoryPool = new MemoryPool();
            memoryPool.setName(JmxTools.getStringAttr(mBeanServer, oName, "Name"));
            memoryPool.setType(JmxTools.getStringAttr(mBeanServer, oName, "Type"));

            CompositeDataSupport cd = (CompositeDataSupport) mBeanServer.getAttribute(oName, "Usage");
            //
            // It seems that "Usage" attribute of one of the pools may turn into null intermittently. We better have a
            // dip in the graph then an NPE though.
            //
            if (cd != null) {
                memoryPool.setMax(JmxTools.getLongAttr(cd, "max"));
                memoryPool.setUsed(JmxTools.getLongAttr(cd, "used"));
                memoryPool.setInit(JmxTools.getLongAttr(cd, "init"));
                memoryPool.setCommitted(JmxTools.getLongAttr(cd, "committed"));
            } else {
                logger.error("Oops, JVM problem? "+oName.toString()+" \"Usage\" attribute is NULL!");
            }

            totalInit += memoryPool.getInit();
            totalMax += memoryPool.getMax();
            totalUsed += memoryPool.getUsed();
            totalCommitted += memoryPool.getCommitted();

            memoryPools.add(memoryPool);
        }

        if (!memoryPools.isEmpty()) {
            MemoryPool pool = new MemoryPool();
            pool.setName("Total");
            pool.setType("TOTAL");
            pool.setInit(totalInit);
            pool.setUsed(totalUsed);
            pool.setMax(totalMax);
            pool.setCommitted(totalCommitted);
            memoryPools.add(pool);
        }

        return memoryPools;

    }
View Full Code Here

       
        if(name.length() == 0){
            ArgCheck.isNotZeroLength(name,CorePlugin.Util.getString("JdomHelper.The_name_may_not_be_zero-length_23")); //$NON-NLS-1$
        }

        final List results = new LinkedList();
        levelOrderTraversal( parent,
            new XMLVisitor() {
                public void visit( Object obj ) {
                    if( ((Element)obj).getName().equals(name) && ((Element)obj).getNamespace().equals(ns) ) {
                        results.add( obj );
                    }
                }
            }
        );
        return results;
View Full Code Here

        }
        if(v == null){
            ArgCheck.isNotNull(v,CorePlugin.Util.getString("JdomHelper.The_XMLVisitor_reference_may_not_be_null_37")); //$NON-NLS-1$
        }

        LinkedList queue = new LinkedList( parent.getChildren() );
        while( queue.size() != 0 ) {
            Element child = (Element)queue.getFirst();
            v.visit( child );
            queue.addAll( child.getChildren() );
            queue.removeFirst();
        }
    }
View Full Code Here

    String tnumstr, fnumstr, newpriostr;
    int tnumber;
    DiskManagerFileInfo[] files;
    String[] sections;
    List args = commandLine.getArgList();
    LinkedList fs,fe;
    DownloadManager dm;
   
    if( args.isEmpty() )
    {
      console.out.println("Torrent # required!");
      return;
    } else {
      tnumstr = (String) args.remove(0);
    }
    if( args.isEmpty() )
    {
      console.out.println("File # required!");
      return;
    } else {
      fnumstr = (String) args.remove(0);
    }

    if ((console.torrents == null) || console.torrents.isEmpty()) {
      console.out.println("> Command 'prio': No torrents in list (try 'show torrents' first).");
      return;
    }
   
    try {
      tnumber = Integer.parseInt(tnumstr);
      if ((tnumber == 0) || (tnumber > console.torrents.size())) {
        console.out.println("> Command 'prio': Torrent #" + tnumber + " unknown.");
        return;
      }

      dm = (DownloadManager) console.torrents.get(tnumber - 1);
      files = dm.getDiskManagerFileInfo();
    }
    catch (Exception e) {
      e.printStackTrace();
      console.out.println("> Command 'prio': Torrent # '" + tnumstr + "' unknown.");
      return;
    }

    if( args.isEmpty() )
    {
      console.out.println("> Command 'prio': missing parameter for new priority");
      return;
    } else {
      newpriostr = (String) args.remove(0);
    }

    if (newpriostr.equalsIgnoreCase("normal")) {
      newprio = NORMAL;
    } else if (newpriostr.equalsIgnoreCase("high")) {
      newprio = HIGH;
    } else if (newpriostr.equalsIgnoreCase("dnd")) {
      newprio = DONOTDOWNLOAD;
    } else if (newpriostr.equalsIgnoreCase("del")) {
      newprio = DELETE;
    } else {
      console.out.println("> Command 'prio': unknown priority "
          + newpriostr);
      return;
    }

    if (fnumstr.equalsIgnoreCase("all")) {
      sections = new String[1];
      sections[0] = "1-"+files.length;
    } else
      sections = fnumstr.split(",");
   
    fs = new LinkedList();
    fe = new LinkedList();
   
    int dash,start,end;
    for (int i=0; i<sections.length; i++) {
      try {
        if ((dash = sections[i].indexOf('-')) != -1) {
          start = Integer.parseInt(sections[i].substring(0,dash));
          end = Integer.parseInt(sections[i].substring(dash+1));
        } else
          start = end = Integer.parseInt(sections[i]);
        if ((start == 0) || (end > files.length)) {
          console.out.println("> Command 'prio': Invalid file range " + sections[i]);
          return;
        }
        if (start > end) {
          console.out.println("> Command 'prio': Invalid file range '"+sections[i]+"'");
        }
       
        // -1 compensates for 0-based offsets
        fs.add(new Integer(start - 1));
        fe.add(new Integer(end - 1));
      } catch (Exception e) {
        console.out.println("> Command 'prio': File # '" + sections[i]
            + "' unknown.");
        return;
      }
    }
   
//    console.out.println("DM was " + dm.getState());
    if ((newprio == DELETE) && (dm.getState() != DownloadManager.STATE_STOPPED)) {
      try {
        dm.stopIt( DownloadManager.STATE_STOPPED, false, false );
      } catch (Exception e) {
        console.out.println("Failed to stop torrent " + tnumber);
        return;
      }
    }
   
//    console.out.println("DM is " + dm.getState());
    int nummod = 0;
    while (fs.size() > 0) {
      start = ((Integer) fs.removeFirst()).intValue();
      end = ((Integer) fe.removeFirst()).intValue();
      for (int i = start; i <= end; i++) {
        nummod++;
        // DEBUG
//        console.out.println("Setting priority for file " + i + " to " + newprio);
View Full Code Here

            if (!proc.isProcedureRelational()) {
                continue;
            }

            HashSet inputSymbols = new HashSet();
            List inputReferences = new LinkedList();
           
            PlanNode critNode = node.getParent();
           
            List conjuncts = new LinkedList();
            HashSet coveredParams = new HashSet();
            //List preExecNodes = new LinkedList();
                       
            for (Iterator params = proc.getInputParameters().iterator(); params.hasNext();) {
                SPParameter param = (SPParameter)params.next();
                ElementSymbol symbol = param.getParameterSymbol();
                Expression input = param.getExpression();
                inputReferences.add(input);
                inputSymbols.add(symbol);
            }
           
            findInputNodes(inputSymbols, critNode, conjuncts, coveredParams);
           
            List defaults = new LinkedList();
           
            for (Iterator params = inputReferences.iterator(); params.hasNext();) {
                Reference ref = (Reference)params.next();
                ElementSymbol symbol = ref.getExpression();
               
                Expression defaultValue = null;
               
                /*try {
                    defaultValue = ResolverUtil.getDefault(symbol, metadata);
                } catch (QueryResolverException qre) {
                    //Just ignore
                }*/
               
                defaults.add(defaultValue);
               
                if (defaultValue == null && !coveredParams.contains(symbol)) {
                    throw new QueryPlannerException(QueryPlugin.Util.getString("RulePlanProcedures.no_values", symbol)); //$NON-NLS-1$
                }
            }
View Full Code Here

     * Adds a TLV object to the list
     */
    protected void addTLV(TLV tlv) {

        if (tlvList == null) {
            tlvList = new LinkedList();
        }

        tlvList.add(tlv);
    }
View Full Code Here

    public static List getTLVs(byte[] byteArray, int pos, int len) {

        List list = null;

        if (byteArray != null) {
            list = new LinkedList();

            int length = len - pos;

            //for (int i = pos; i < pos+len;) {
            for (int i = pos; i < length;) {
View Full Code Here

TOP

Related Classes of java.util.LinkedList$ListItr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.