Java Iterator.hasNext Examples

Java Iterator.hasNext - 30 examples found. These are the top rated real world Java examples of java.util.Iterator.hasNext extracted from open source projects. You can rate examples to help us improve the quality of examples.
 public void deleteTaxByTenantIdx(long TenantId) {
   CFAccTaxByTenantIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey();
   key.setRequiredTenantId(TenantId);
   if (indexByTenantIdx == null) {
     indexByTenantIdx = new HashMap<CFAccTaxByTenantIdxKey, Map<CFAccTaxPKey, ICFAccTaxObj>>();
   }
   if (indexByTenantIdx.containsKey(key)) {
     Map<CFAccTaxPKey, ICFAccTaxObj> dict = indexByTenantIdx.get(key);
     ((ICFAccSchema) schema.getBackingStore())
         .getTableTax()
         .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId);
     Iterator<ICFAccTaxObj> iter = dict.values().iterator();
     ICFAccTaxObj obj;
     List<ICFAccTaxObj> toForget = new LinkedList<ICFAccTaxObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByTenantIdx.remove(key);
   } else {
     ((ICFAccSchema) schema.getBackingStore())
         .getTableTax()
         .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId);
   }
 }
Example #2
0
  private boolean generateWsdl(AxisService axisService) {
    Iterator operatins = axisService.getOperations();
    if (operatins.hasNext()) {
      while (operatins.hasNext()) {
        AxisOperation axisOperation = (AxisOperation) operatins.next();

        if (axisOperation.isControlOperation()) {
          continue;
        }

        if (axisOperation.getMessageReceiver() == null) {
          continue;
        }
        String messageReceiverClass = axisOperation.getMessageReceiver().getClass().getName();
        if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver".equals(messageReceiverClass)
            || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
                .equals(messageReceiverClass)
            || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver"
                .equals(messageReceiverClass)
            || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver".equals(messageReceiverClass))) {
          return false;
        }
      }
    }
    return true;
  }
Example #3
0
  public double getNormalizedActivatedRate() {
    LoadUnloadEdge labeledEdge = (LoadUnloadEdge) this.getEdge();

    Node source = labeledEdge.getA();
    PacketStyleTransportSystem transSystem =
        (PacketStyleTransportSystem)
            ((labeledEdge.isLoadingEdge()) ? (labeledEdge.getB()) : (labeledEdge.getA()));

    Collection<NodeLabel> lbls = source.getLabels();
    double sourcePop = 0;

    // Get the population size of the source node
    for (Iterator<NodeLabel> it = lbls.iterator(); it.hasNext(); ) {
      NodeLabel lbl = it.next();
      if (lbl instanceof PopulationLabel) {
        sourcePop = ((PopulationLabelValue) ((PopulationLabel) lbl).getCurrentValue()).getCount();
        break;
      }
    }
    assert sourcePop > 0;

    lbls = transSystem.getLabels();
    double transCapacity = 0;

    // Get the capacity of the packet transport label
    for (Iterator<NodeLabel> it = lbls.iterator(); it.hasNext(); ) {
      NodeLabel lbl = it.next();
      if (lbl instanceof PacketTransportLabel) {
        transCapacity = ((PacketTransportLabel) lbl).getCurrentValue().getCapacity();
        break;
      }
    }

    return getActivatedRate() * transCapacity / sourcePop;
  }
  public synchronized void transferProgress(
      TransferEvent transferEvent, byte[] buffer, int length) {
    Resource resource = transferEvent.getResource();
    if (!downloads.containsKey(resource)) {
      downloads.put(resource, new Long(length));
    } else {
      Long complete = (Long) downloads.get(resource);
      complete = new Long(complete.longValue() + length);
      downloads.put(resource, complete);
    }

    StringBuffer buf = new StringBuffer();
    for (Iterator i = downloads.entrySet().iterator(); i.hasNext(); ) {
      Map.Entry entry = (Map.Entry) i.next();
      Long complete = (Long) entry.getValue();
      String status =
          getDownloadStatusForResource(
              complete.longValue(), ((Resource) entry.getKey()).getContentLength());
      buf.append(status);
      if (i.hasNext()) {
        buf.append(" ");
      }
    }

    if (buf.length() > maxLength) {
      maxLength = buf.length();
    }

    out.print(buf.toString() + "\r");
  }
 private void appendScanRow(StringBuilder buf, Bound bound) {
   ScanRanges scanRanges = context.getScanRanges();
   KeyRange minMaxRange = context.getMinMaxRange();
   Iterator<byte[]> minMaxIterator = Iterators.emptyIterator();
   if (minMaxRange != null) {
     RowKeySchema schema = tableRef.getTable().getRowKeySchema();
     if (!minMaxRange.isUnbound(bound)) {
       minMaxIterator = new RowKeyValueIterator(schema, minMaxRange.getRange(bound));
     }
   }
   int nRanges = scanRanges.getRanges().size();
   for (int i = 0, minPos = 0; minPos < nRanges || minMaxIterator.hasNext(); i++) {
     List<KeyRange> ranges = minPos >= nRanges ? EVERYTHING : scanRanges.getRanges().get(minPos++);
     KeyRange range = bound == Bound.LOWER ? ranges.get(0) : ranges.get(ranges.size() - 1);
     byte[] b = range.getRange(bound);
     Boolean isNull =
         KeyRange.IS_NULL_RANGE == range
             ? Boolean.TRUE
             : KeyRange.IS_NOT_NULL_RANGE == range ? Boolean.FALSE : null;
     if (minMaxIterator.hasNext()) {
       byte[] bMinMax = minMaxIterator.next();
       int cmp = Bytes.compareTo(bMinMax, b) * (bound == Bound.LOWER ? 1 : -1);
       if (cmp > 0) {
         minPos = nRanges;
         b = bMinMax;
         isNull = null;
       } else if (cmp < 0) {
         minMaxIterator = Iterators.emptyIterator();
       }
     }
     appendPKColumnValue(buf, b, isNull, i);
     buf.append(',');
   }
 }
  @Override
  protected void writeFormRow(
      FacesContext context,
      ResponseWriter w,
      FormLayout c,
      ComputedFormData formData,
      UIFormLayoutRow row)
      throws IOException {
    ComputedRowData rowData = createRowData(context, c, formData, row);

    UIInput edit = row.getForComponent();
    if (edit != null) {
      // Write the error messages, if any
      if (!formData.isDisableRowError()) {
        Iterator<FacesMessage> msg =
            ((DominoFacesContext) context).getMessages(edit.getClientId(context));
        if (msg.hasNext()) {
          while (msg.hasNext()) {
            FacesMessage m = msg.next();
            writeFormRowError(context, w, c, row, edit, m, rowData);
          }
        }
      }
    }

    // The write the children
    writeFormRowData(context, w, c, formData, row, edit, rowData);
  }