Package java.util

Examples of java.util.ListIterator


                 
      List dels = new ArrayList();
     
      synchronized (refLock)
      {
         ListIterator liter = messageRefs.iterator();
                          
         while (iter.hasNext())
         {
            Long id = (Long)iter.next();
           
            //Scan the queue
            while (true)
            {              
               if (!liter.hasNext())
               {
                  // TODO we need to look in paging state too - currently not supported
                  //http://jira.jboss.com/jira/browse/JBMESSAGING-839
                  log.warn(this + " cannot find reference " + id + " (Might be paged!)");
                  break;
               }
              
               MessageReference ref = (MessageReference)liter.next();
              
               if (ref.getMessage().getMessageID() == id.longValue())
               {
                  liter.remove();
                 
                  Delivery del = new SimpleDelivery(this, ref);
                 
                  dels.add(del);
                                
View Full Code Here


      try
      {
         // The iterator is used to iterate through the refs in the channel in the case that they
         // don't match the selectors of any receivers.
         ListIterator iter = null;
        
         MessageReference ref = null;
        
         if (!receiversReady)
         {
View Full Code Here

        if(v.getClass() == ArrayValueImpl.class) {
            return equals((ArrayValueImpl) v);
        }

        ListIterator oi = v.asArrayValue().listIterator();
        int i = 0;
        while(i < array.length) {
            if(!oi.hasNext() || !array[i].equals(oi.next())) {
                return false;
            }
        }
        return !oi.hasNext();
    }
View Full Code Here

    }

    if (system)
    {
      // add the variable before the first non-system variable
      ListIterator it = variablesList.listIterator();
      while (it.hasNext())
      {
        JRVariable var = (JRVariable) it.next();
        if (!var.isSystemDefined())
        {
          it.previous();
          break;
        }
      }
      it.add(variable);
      index = it.previousIndex();
    }
    else
    {
      variablesList.add(index, variable);
    }
View Full Code Here

    }

   
    void collectVals(BucketMap map, boolean sum) throws JRException
    {
      ListIterator totalIt = entries.listIterator();
      MapEntry totalItEntry = totalIt.hasNext() ? (MapEntry) totalIt.next() : null;
     
      Iterator it = map.entryIterator();
      Map.Entry entry = it.hasNext() ? (Map.Entry) it.next() : null;
      while(entry != null)
      {
        Bucket key = (Bucket) entry.getKey();
       
        int compare = totalItEntry == null ? -1 : key.compareTo(totalItEntry.key);
        if (compare <= 0)
        {
          Object addVal = null;
         
          if (last)
          {
            if (sum)
            {
              MeasureValue[] totalVals = compare == 0 ? (MeasureValue[]) totalItEntry.value : null;

              if (totalVals == null)
              {
                totalVals = initMeasureValues();
                addVal = totalVals;
              }

              sumVals(totalVals, (MeasureValue[]) entry.getValue());
            }
          }
          else
          {
            BucketListMap nextTotals = compare == 0 ? (BucketListMap) totalItEntry.value : null;
           
            if (nextTotals == null)
            {
              nextTotals = createCollectBucketMap(level + 1);
              addVal = nextTotals;
            }
           
            nextTotals.collectVals((BucketMap) entry.getValue(), sum);
          }
         
          if (compare < 0)
          {
            if (totalItEntry != null)
            {
              totalIt.previous();
            }
           
            totalIt.add(new MapEntry(key, addVal));
            entryMap.put(key, addVal);
           
            if (totalItEntry != null)
            {
              totalIt.next();
            }
          }
         
          entry = it.hasNext() ? (Map.Entry) it.next() : null;
        }
       
        if (compare >= 0)
        {
          totalItEntry = totalIt.hasNext() ? (MapEntry) totalIt.next() : null;
        }
      }
    }
View Full Code Here

public class LIFOInvocationDispatcher implements InvocationDispatcher {

    private ArrayList invokables = new ArrayList();

    public Object dispatch(Invocation invocation) throws Throwable {
        ListIterator i = invokables.listIterator(invokables.size());
        while (i.hasPrevious()) {
            Invokable invokable = (Invokable) i.previous();
            if (invokable.matches(invocation)) {
                return invokable.invoke(invocation);
            }
        }
        throw new DynamicMockError(invocation, "No match found");
View Full Code Here

   */
  public void scanClasses( List cls ) {
    if( null == cls )
      return;

    ListIterator iter = cls.listIterator();
    while( iter.hasNext() ) {
      Class klass = (Class) ((WeakReference)iter.next()).get();
      if( null == klass )
        iter.remove();
      else if( !scannedClasses.containsKey(klass) )
        try{ scan( klass ); }
      catch(ClassNotFoundException e)
      { System.err.println("HotSwapClassRegister.scanClasses: " + e.getMessage() ); }
    }
View Full Code Here

     *
     * @param newEntry new entry to insert into <CODE>redefineAdvices</CODE>
     */
    private void addRedefineAdvice(RedefineAdviceListEntry newEntry) {
      // find the right position for insertion
      ListIterator iter = redefineAdvices.listIterator();
      while(iter.hasNext()) {
        if(newEntry.priority <= ((RedefineAdviceListEntry)iter.next()).priority) {
          // a. found the position where newEntry will be inserted
          redefineAdvices.add(iter.previousIndex(), newEntry);
          return;
        }
      }
      // b. the list is empty or all entries have a lower priority number:
      //        append the new entry to the list.
View Full Code Here

      List<ServiceContext> servicesCopy = new ArrayList<ServiceContext>(installedServices);

      int serviceCounter = 0;
      ObjectName name = null;

      ListIterator i = servicesCopy.listIterator(servicesCopy.size());
      while (i.hasPrevious())
      {
         ServiceContext ctx = (ServiceContext) i.previous();
         name = ctx.objectName;

         // Go through the full stop/destroy cycle
         try
         {
View Full Code Here

     *
     * @param newEntry new entry to insert into <CODE>redefineAdvices</CODE>
     */
    private void addRedefineAdvice(RedefineAdviceListEntry newEntry) {
      // find the right position for insertion
      ListIterator iter = redefineAdvices.listIterator();
      while(iter.hasNext()) {
        if(newEntry.priority <= ((RedefineAdviceListEntry)iter.next()).priority) {
          // a. found the position where newEntry will be inserted
          redefineAdvices.add(iter.previousIndex(), newEntry);
          return;
        }
      }
      // b. the list is empty or all entries have a lower priority number:
      //        append the new entry to the list.
View Full Code Here

TOP

Related Classes of java.util.ListIterator

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.