Example #1
1
  /** @param config */
  public DecorateHandler(TagConfig config) {
    super(config);
    this.template = this.getRequiredAttribute("template");
    this.handlers = new HashMap();

    Iterator itr = this.findNextByType(DefineHandler.class);
    DefineHandler d = null;
    while (itr.hasNext()) {
      d = (DefineHandler) itr.next();
      this.handlers.put(d.getName(), d);
      if (log.isLoggable(Level.FINE)) {
        log.fine(tag + " found Define[" + d.getName() + "]");
      }
    }
    List paramC = new ArrayList();
    itr = this.findNextByType(ParamHandler.class);
    while (itr.hasNext()) {
      paramC.add(itr.next());
    }
    if (paramC.size() > 0) {
      this.params = new ParamHandler[paramC.size()];
      for (int i = 0; i < this.params.length; i++) {
        this.params[i] = (ParamHandler) paramC.get(i);
      }
    } else {
      this.params = null;
    }
  }
 public void setSwingDataCollection(Collection<ICFSecurityISOCountryObj> value) {
   final String S_ProcName = "setSwingDataCollection";
   swingDataCollection = value;
   if (swingDataCollection == null) {
     arrayOfISOCountry = new ICFSecurityISOCountryObj[0];
   } else {
     int len = value.size();
     arrayOfISOCountry = new ICFSecurityISOCountryObj[len];
     Iterator<ICFSecurityISOCountryObj> iter = swingDataCollection.iterator();
     int idx = 0;
     while (iter.hasNext() && (idx < len)) {
       arrayOfISOCountry[idx++] = iter.next();
     }
     if (idx < len) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Collection iterator did not fully populate the array copy");
     }
     if (iter.hasNext()) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Collection iterator had left over items when done populating array copy");
     }
     Arrays.sort(arrayOfISOCountry, compareISOCountryByQualName);
   }
   PickerTableModel tblDataModel = getDataModel();
   if (tblDataModel != null) {
     tblDataModel.fireTableDataChanged();
   }
 }
Example #3
1
  private void analyzeEdges(UniversalGraph<Node, Edge> graph, int colCount) {
    for (Node node : graph.getNodes()) {
      node.conLeft = false;
      node.conRight = false;
      node.conTop = false;
      node.conBottom = false;
      node.conLeftTop = 0;
      node.conLeftBottom = 0;
      node.conRightTop = 0;
      node.conRightBottom = 0;
    }

    int rowCount = coordinates.size();
    ArrayList<Edge> edgesList = new ArrayList<Edge>(graph.getEdges());
    for (int row = 0; row < rowCount; row++) {
      for (int jump = 0; jump < colCount - 1; jump++) {
        Iterator<Edge> edges = edgesList.iterator();
        while (edges.hasNext()) {
          Edge edge = edges.next();
          if (edge.forward() && edge.sameRow(row) && edge.jump() == jump) {
            analyzeEdge(row, jump, edge);
            edges.remove();
          }
        }
        edges = edgesList.iterator();
        while (edges.hasNext()) {
          Edge edge = edges.next();
          if (edge.backward() && edge.sameRow(row) && edge.jump() == jump) {
            analyzeEdge(row, jump, edge);
            edges.remove();
          }
        }
      }
    }
  }
Example #4
1
  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;
  }
 private List getTypeNames() throws PureException {
   List typeNames = new ArrayList();
   switch (m_nSortType) {
     case TYPE_PROJECT_KIND:
       {
         List values = NamedValueHelper.getNamedValues(SRMNamedValueTypes.PRJ_KIND, true);
         for (Iterator iter = values.iterator(); iter.hasNext(); ) {
           typeNames.add(((INamedValue) iter.next()).getName());
         }
       }
       break;
     case TYPE_RESEARCH_TYPE:
       {
         List values = NamedValueHelper.getNamedValues(SRMNamedValueTypes.RESEARCH_TYPE, true);
         for (Iterator iter = values.iterator(); iter.hasNext(); ) {
           typeNames.add(((INamedValue) iter.next()).getName());
         }
       }
       break;
     case TYPE_PROJECT_SOURCE:
       {
         List values = NamedValueHelper.getNamedValues(SRMNamedValueTypes.PRJ_SOURCE, true);
         for (Iterator iter = values.iterator(); iter.hasNext(); ) {
           typeNames.add(((INamedValue) iter.next()).getName());
         }
       }
       break;
   }
   return typeNames;
 }
  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");
  }
 public void run(Object[] selection) {
   final Set elements = new HashSet();
   final Set resources = new HashSet();
   for (int i = 0; i < selection.length; ++i) {
     Object o = selection[i];
     ValidatorUtils.processResourcesToElements(o, elements, resources);
   }
   for (Iterator i = elements.iterator(); i.hasNext(); ) {
     final ISourceModule module = (ISourceModule) i.next();
     final IScriptProject sproject = module.getScriptProject();
     if (sproject != null) {
       final IProject project = sproject.getProject();
       if (project != null) {
         getProjectInfo(project).elements.add(module);
       }
     }
   }
   for (Iterator i = resources.iterator(); i.hasNext(); ) {
     final IResource resource = (IResource) i.next();
     final IProject project = resource.getProject();
     if (project != null) {
       getProjectInfo(project).resources.add(resource);
     }
   }
   setRule(buildSchedulingRule(elements, resources));
   setUser(true);
   schedule();
 }
Example #8
0
  /**
   * Given a new LimitOrder, it will replace and old matching limit order in the orderbook or simply
   * get added. Finally, it is sorted.
   *
   * @param limitOrder
   */
  public void update(LimitOrder limitOrder) {

    if (limitOrder.getType().equals(OrderType.ASK)) {

      Iterator<LimitOrder> it = asks.iterator();
      while (it.hasNext()) {
        LimitOrder order = it.next();
        if (order.getLimitPrice().compareTo(limitOrder.getLimitPrice())
            == 0) { // they are equal. found it!
          it.remove();
          break;
        }
      }
      asks.add(limitOrder); // just add it
      Collections.sort(asks); // finally sort

    } else {

      Iterator<LimitOrder> it = bids.iterator();
      while (it.hasNext()) {
        LimitOrder order = it.next();
        if (order.getLimitPrice().compareTo(limitOrder.getLimitPrice())
            == 0) { // they are equal. found it!
          it.remove();
          break;
        }
      }
      bids.add(limitOrder); // just add it
      Collections.sort(bids); // finally sort
    }
  }
 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 #10
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;
  }
  protected void visitConfig(TestResult testResult, ConfigResult configResult) {
    // the faulty command is necessarily the last one
    List<CommandResult> commandResults = configResult.getSubResults();
    CommandResult commandResult = commandResults.get(commandResults.size() - 1);

    sb.append("Test: \"")
        .append(testResult.getTestElem().getName())
        .append("\" Config: \"")
        .append(configResult.getTestElem().getName())
        .append("\" FAILLED\n");
    sb.append("  Command: ").append(commandResult.getExecutedCommand()).append("\n");
    Iterator<String> commandArgs = commandResult.getCommandArgs().iterator();
    if (commandArgs.hasNext()) {
      sb.append("     args: ").append(commandArgs.next()).append("\n");
      while (commandArgs.hasNext()) {
        sb.append("           ").append(commandArgs.next()).append("\n");
      }
    }
    sb.append("  Output: ");
    for (String outputLine : commandResult.getOutput().split("\n")) {
      sb.append(outputLine).append("\n          ");
    }
    sb.append(
        "\n================================================================================\n\n");
  }
  protected void handleCellErrors(Iterator errorElems) throws SOAPException {
    SOAPElement errorElem = (SOAPElement) errorElems.next();

    StringBuffer errorMsg = new StringBuffer();
    errorMsg.append("Cell error: ");

    Iterator descriptionElems =
        errorElem.getChildElements(sf.createName("Description", "", MDD_URI));
    if (descriptionElems.hasNext()) {
      SOAPElement descrElem = (SOAPElement) descriptionElems.next();
      errorMsg.append(descrElem.getValue());
      errorMsg.append("; ");
    }

    Iterator sourceElems = errorElem.getChildElements(sf.createName("Source", "", MDD_URI));
    if (sourceElems.hasNext()) {
      SOAPElement sourceElem = (SOAPElement) sourceElems.next();
      errorMsg.append("Source: ");
      errorMsg.append(sourceElem.getValue());
      errorMsg.append("; ");
    }

    Iterator codeElems = errorElem.getChildElements(sf.createName("ErrorCode", "", MDD_URI));
    if (codeElems.hasNext()) {
      SOAPElement codeElem = (SOAPElement) codeElems.next();
      errorMsg.append("Code: ");
      errorMsg.append(codeElem.getValue());
      errorMsg.append("; ");
    }

    throw new JRRuntimeException(errorMsg.toString());
  }
  @Override
  public List<Activity> getRecommendations(Long myUserId) {

    Long closestUserId = getClosestUser(createDistancesVector(myUserId));

    Iterable<UserRating> myRatings = userRatingRepository.findByUserId(myUserId);

    Iterable<UserRating> ratings = userRatingRepository.findByUserId(closestUserId);
    Iterator<UserRating> ratingsIterator = ratings.iterator();

    List<Activity> recommendations = new ArrayList<Activity>();

    while (ratingsIterator.hasNext()) {
      Iterator<UserRating> myRatingsIterator = myRatings.iterator();
      UserRating rating = ratingsIterator.next();
      boolean activityFound = false;
      if (rating.getRating() >= 3) {
        while (myRatingsIterator.hasNext()) {
          UserRating myRating = myRatingsIterator.next();

          if (rating.getActivity().getId() == myRating.getActivity().getId()) {
            activityFound = true;
            break;
          }
        }
        if (!activityFound) {
          recommendations.add(rating.getActivity());
        }
      }
    }

    return recommendations;
  }
Example #14
0
  private String getSingleLineOfChildren(final List children) {
    final StringBuilder result = new StringBuilder();
    final Iterator childrenIt = children.iterator();
    boolean isFirst = true;

    while (childrenIt.hasNext()) {
      final Object child = childrenIt.next();

      if (!(child instanceof ContentNode)) {
        return null;
      } else {
        String content = child.toString();

        // if first item trims it from left
        if (isFirst) {
          content = Utils.ltrim(content);
        }

        // if last item trims it from right
        if (!childrenIt.hasNext()) {
          content = Utils.rtrim(content);
        }

        if (content.indexOf('\n') >= 0 || content.indexOf('\r') >= 0) {
          return null;
        }
        result.append(content);
      }

      isFirst = false;
    }

    return result.toString();
  }
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     Edge incomingLink = (Edge) it.next();
     if (CrystalVisualIDRegistry.getVisualID(incomingLink) == TransitionEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
   }
   for (Iterator<?> it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     Edge outgoingLink = (Edge) it.next();
     if (CrystalVisualIDRegistry.getVisualID(outgoingLink) == TransitionEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
   }
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation == null) {
     // there are indirectly referenced children, need extra commands: false
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
 private String a()
 {
   boolean bool = DialogToastListActivity.f;
   StringBuffer localStringBuffer = new StringBuffer();
   TreeSet localTreeSet = new TreeSet();
   Iterator localIterator1 = this.p.iterator();
   do
   {
     if (!localIterator1.hasNext())
       break;
     zq localzq = (zq)localIterator1.next();
     if (localzq.l)
       localTreeSet.add(localzq.b);
   }
   while (!bool);
   Iterator localIterator2 = localTreeSet.iterator();
   do
   {
     if (!localIterator2.hasNext())
       break;
     localStringBuffer.append((String)localIterator2.next()).append(",");
   }
   while (!bool);
   if (localStringBuffer.length() > 0);
   for (String str = localStringBuffer.substring(0, -1 + localStringBuffer.length()); ; str = null)
   {
     return str;
     localTreeSet.clear();
   }
 }
Example #17
0
  /**
   * Search the tree of objects starting at the given <code>ServerActiveHtml</code> and return the
   * content of the first <code>Element</code> with the same name as this <code>Placeholder</code>
   * as the children of a new <code>List</code> if the <code>Element</code> does not have a any
   * placeholder (of the form placeholder-x = "foo").
   *
   * <p>Otherise return a singleton list of a <code>ServerActiveHtml</code> which has the children
   * of the found <code>Element</code> and the placeholders of this <code>Element</code>
   *
   * <p>Packaging the content of the matched <code>Element</code> as a <code>ServerActiveHtml</code>
   * allows the placeholders of the <code>Element</code> to be transferred to the <code>
   * ServerActiveHtml</code>
   *
   * <p>If no matching <code>Element</code> return a <code>List</code> with a <code>Fragment</code>
   * warning message
   *
   * @return A <code>ServerActiveHtml</code> containing the child of the matched <code>Element
   *     </code> or a warning <code>Fragment</code> if no matching <code>Element</code>
   */
  public List getReplacement(ServerActiveHtml sah) throws ServerActiveHtmlException {

    List result = new LinkedList();

    Element match = sah.findElement(getUseElement());

    if (match == null) {
      result.add(
          new Fragment(
              "<b>Warning: missing element for placeholder '" + getUseElement() + "'</b>"));
      return result;
    }

    if (match.getPlaceholders().isEmpty()) {
      for (Iterator children = match.getChildren().iterator(); children.hasNext(); ) {
        Deserializable child = (Deserializable) children.next();
        result.add(child);
      }
    } else {
      ServerActiveHtml wrapper = new ServerActiveHtml(REPLACEMENT_NAME);
      wrapper.setPlaceholders(match.getPlaceholders());
      for (Iterator children = match.getChildren().iterator(); children.hasNext(); ) {
        Deserializable child = (Deserializable) children.next();
        wrapper.add(child);
      }
      result.add(wrapper);
    }

    return result;
  }
  @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);
  }
  protected void parseAxesElement(SOAPElement axesElement) throws SOAPException {
    // Cycle over Axis-Elements
    Name aName = sf.createName("Axis", "", MDD_URI);
    Iterator itAxis = axesElement.getChildElements(aName);
    while (itAxis.hasNext()) {
      SOAPElement axisElement = (SOAPElement) itAxis.next();
      Name name = sf.createName("name");
      String axisName = axisElement.getAttributeValue(name);

      if (axisName.equals(SLICER_AXIS_NAME)) {
        continue;
      }

      // LookUp for the Axis
      JRXmlaResultAxis axis = xmlaResult.getAxisByName(axisName);

      // retrieve the tuples by <Tuples>
      name = sf.createName("Tuples", "", MDD_URI);
      Iterator itTuples = axisElement.getChildElements(name);
      if (itTuples.hasNext()) {
        SOAPElement eTuples = (SOAPElement) itTuples.next();
        handleTuplesElement(axis, eTuples);
      }
    }
  }
 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(',');
   }
 }
    public int contextMatchCheck() {
      final Iterable<String> contextLines = myContext.getPreviousLinesIterable();

      // we ignore spaces.. at least at start/end, since some version controls could ignore their
      // changes when doing annotate
      final Iterator<String> iterator = contextLines.iterator();
      if (iterator.hasNext()) {
        String contextLine = iterator.next().trim();

        while (myChangedLinesIterator.hasNext()) {
          final Pair<Integer, String> pair = myChangedLinesIterator.next();
          if (pair.getSecond().trim().equals(contextLine)) {
            if (!iterator.hasNext()) break;
            contextLine = iterator.next().trim();
          }
        }
        if (iterator.hasNext()) {
          return -1;
        }
      }
      if (!myChangedLinesIterator.hasNext()) return -1;

      final String targetLine = myContext.getTargetString().trim();
      while (myChangedLinesIterator.hasNext()) {
        final Pair<Integer, String> pair = myChangedLinesIterator.next();
        if (pair.getSecond().trim().equals(targetLine)) {
          return pair.getFirst();
        }
      }
      return -1;
    }
  @Override
  public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(
      GameProfile profile, boolean requireSecure) {
    LogHelper.debug("getTextures, Username: '%s'", profile.getName());
    Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures =
        new EnumMap<>(MinecraftProfileTexture.Type.class);

    // Add skin URL to textures map
    Iterator<Property> skinURL =
        profile.getProperties().get(ClientLauncher.SKIN_URL_PROPERTY).iterator();
    Iterator<Property> skinHash =
        profile.getProperties().get(ClientLauncher.SKIN_DIGEST_PROPERTY).iterator();
    if (skinURL.hasNext() && skinHash.hasNext()) {
      String urlValue = skinURL.next().getValue();
      String hashValue = skinHash.next().getValue();
      textures.put(
          MinecraftProfileTexture.Type.SKIN, new MinecraftProfileTexture(urlValue, hashValue));
    }

    // Add cloak URL to textures map
    Iterator<Property> cloakURL =
        profile.getProperties().get(ClientLauncher.CLOAK_URL_PROPERTY).iterator();
    Iterator<Property> cloakHash =
        profile.getProperties().get(ClientLauncher.CLOAK_DIGEST_PROPERTY).iterator();
    if (cloakURL.hasNext() && cloakHash.hasNext()) {
      String urlValue = cloakURL.next().getValue();
      String hashValue = cloakHash.next().getValue();
      textures.put(
          MinecraftProfileTexture.Type.CAPE, new MinecraftProfileTexture(urlValue, hashValue));
    }

    // Return filled textures
    return textures;
  }
  @Override
  public void dealWithAnnotationOnField(
      ClassNode from, FieldNode on, ClassNode to, AnnotationNode details) {
    Iterator<MethodNode> iter = from.methods.iterator();
    MethodNode staticInitF = null;
    while (iter.hasNext()) {
      MethodNode next = iter.next();
      if (next.name.equals("<clinit>")) {
        staticInitF = next;
        break; // only one class (static) init
      }
    }
    if (staticInitF == null) {
      // what SHOULD be done here? :/
      return; // ?
    }

    Iterator<FieldNode> iter2 = to.fields.iterator();
    FieldNode targetField = null;
    while (iter2.hasNext()) {
      FieldNode next = iter2.next();
      if (next.name.equals(on.name)) {
        targetField = next;
        break;
      }
    }
    if (targetField == null) {
      // what SHOULD be done here? :/
      return; // ?
    }
    throw new UnsupportedOperationException();
    /*staticInitF.instructions.
    StaticInitMerger.
    */
  }
Example #24
0
  protected void prepareCommandline() throws BuildException {
    for (int i = 0; i < variables.length; i++) {
      variables[i].addToCommandline(cmdl);
    }

    if (metadata != null) metadata.addToCommandline(cmdl);

    if (fonts != null) fonts.addToCommandline(cmdl);

    if (dLimits != null) dLimits.addToCommandline(cmdl);

    if (dSize != null) dSize.addToCommandline(cmdl);

    Iterator it = nestedAttribs.iterator();

    while (it.hasNext()) ((OptionSource) it.next()).addToCommandline(cmdl);

    it = nestedFileSets.iterator();

    while (it.hasNext()) ((OptionSource) it.next()).addToCommandline(cmdl);

    if (output != null) {
      (new ConfigString(new OptionSpec(null, "output", "o"), output)).addToCommandline(cmdl);
    }

    // end of arguments
    cmdl.createArgument().setValue("--");

    // file-spec may not be specified if building, e.g. a resource bundle SWF
    if (file != null) {
      cmdl.createArgument().setValue(file);
    }
  }
  /* (non-Javadoc)
   * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#containsAll(org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet)
   */
  @Override
  public boolean containsAll(TypeSet other) {
    // Optimization: if other is also a SubTypeOfSingleton, just compare bounds
    if (other instanceof SuperTypesOfSingleton) {
      SuperTypesOfSingleton otherSuper = (SuperTypesOfSingleton) other;
      return TTypes.canAssignTo(fLowerBound, otherSuper.fLowerBound);
    }
    // Optimization: if other is a SubTypesSet, just compare all its bounds to mine
    if (other instanceof SuperTypesSet) {
      SuperTypesSet otherSuper = (SuperTypesSet) other;
      TypeSet otherLowerBounds = otherSuper.lowerBound();

      for (Iterator<TType> iter = otherLowerBounds.iterator(); iter.hasNext(); ) {
        TType t = iter.next();
        if (!TTypes.canAssignTo(fLowerBound, t)) return false;
      }
      return true;
    }
    if (other.isUniverse()) {
      return false;
    }
    // For now, no more tricks up my sleeve; get an iterator
    for (Iterator<TType> iter = other.iterator(); iter.hasNext(); ) {
      TType t = iter.next();

      if (!TTypes.canAssignTo(fLowerBound, t)) return false;
    }
    return true;
  }
Example #26
0
  /**
   * Generate the standard IES Data Format Header and write it into the output stream 'out'.
   *
   * @param group
   * @param filename
   * @param loggingInterval
   * @param logChannelList
   * @return
   */
  public String getIESDataFormatHeaderString(
      LogIntervalContainerGroup group,
      String filename,
      int loggingInterval,
      HashMap<String, LogChannel> logChannelList) {

    StringBuilder sb = new StringBuilder();
    setHeaderTop(sb, loggingInterval, filename);

    // write channel specific header informations
    int colNumber = 4;
    for (LogRecordContainer container : group.getList()) {

      LogChannel logChannel = logChannelList.get(container.getChannelId());
      appendChannelSpecificComment(sb, logChannel, colNumber);
      ++colNumber;
    }
    List<LogRecordContainer> containers = group.getList();
    appendColumnHeaderTimestamp(sb);

    Iterator<LogRecordContainer> iterator = containers.iterator();

    while (iterator.hasNext()) {
      sb.append(iterator.next().getChannelId());
      if (iterator.hasNext()) {
        sb.append(Const.SEPARATOR);
      }
    }

    sb.append(Const.LINESEPARATOR);
    return sb.toString();
  }
 @Override
 public boolean addAll(final Collection<? extends E> c) {
   if (c.isEmpty()) {
     return false;
   }
   boolean modified = false;
   if (c instanceof SortedListSet && this.comparator == ((SortedListSet<?>) c).getComparator()) {
     int index = 0;
     for (final Iterator<? extends E> iter = c.iterator(); iter.hasNext(); ) {
       index = addE(index, iter.next());
       if (index >= 0) {
         modified = true;
         index++;
       } else {
         index = -(index + 1);
       }
     }
   } else {
     for (final Iterator<? extends E> iter = c.iterator(); iter.hasNext(); ) {
       if (addE(iter.next()) >= 0) {
         modified = true;
       }
     }
   }
   return modified;
 }
Example #28
0
  /**
   * Generate the standard IES Data Format Header and write it into the output stream 'out'.
   *
   * @param filename
   * @param logChannelList
   * @return
   */
  public String getIESDataFormatHeaderString(String filename, List<LogChannel> logChannelList) {

    StringBuilder sb0 = new StringBuilder();
    StringBuilder sb1 = new StringBuilder();
    setHeaderTop(sb0, logChannelList.get(0).getLoggingInterval(), filename);

    // write channel specific header informations
    int colNumber = 4;
    Iterator<LogChannel> iterator = logChannelList.listIterator();
    while (iterator.hasNext()) {

      LogChannel logChannel = iterator.next();
      appendChannelSpecificComment(sb0, logChannel, colNumber);

      sb1.append(logChannel.getId());
      if (iterator.hasNext()) {
        sb1.append(Const.SEPARATOR);
      }
      ++colNumber;
    }
    appendColumnHeaderTimestamp(sb0);
    sb0.append(sb1);
    sb0.append(Const.LINESEPARATOR);
    return sb0.toString();
  }
  /**
   * Finds common instruments for all missions in compare list.
   *
   * @return the set of common instruments names
   */
  public static Set<String> findCommonInstruments() {
    // calculate common instruments
    Set<String> commonInstruments = new HashSet<String>();
    if (ITEMS.size() > 1) {
      // add first instruments of first item to list
      Iterator<CompareItem> i = ITEMS.iterator();
      for (EntityInfo instrument : i.next().getInstruments()) {
        commonInstruments.add(instrument.getName());
      }

      // check data with others
      while (i.hasNext()) {
        CompareItem next = i.next();
        for (Iterator<String> j = commonInstruments.iterator(); j.hasNext(); ) {
          String commonInstrument = j.next();

          // find instrument in next item
          boolean present = true;
          for (EntityInfo entityInfo : next.getInstruments()) {
            if (!entityInfo.getName().equalsIgnoreCase(commonInstrument)) {
              present = false;
              break;
            }
          }

          // remove instrument if it is not present in next
          if (!present) {
            j.remove();
          }
        }
      }
    }
    return commonInstruments;
  }
 public List<ICFAccTaxObj> readAllTax(boolean forceRead) {
   final String S_ProcName = "readAllTax";
   if ((allTax == null) || forceRead) {
     Map<CFAccTaxPKey, ICFAccTaxObj> map = new HashMap<CFAccTaxPKey, ICFAccTaxObj>();
     allTax = map;
     CFAccTaxBuff[] buffList =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableTax()
             .readAllDerived(schema.getAuthorization());
     CFAccTaxBuff buff;
     ICFAccTaxObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey());
       obj.setBuff(buff);
       ICFAccTaxObj realized = (ICFAccTaxObj) obj.realize();
     }
   }
   Comparator<ICFAccTaxObj> cmp =
       new Comparator<ICFAccTaxObj>() {
         public int compare(ICFAccTaxObj lhs, ICFAccTaxObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFAccTaxPKey lhsPKey = lhs.getPKey();
             CFAccTaxPKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allTax.size();
   ICFAccTaxObj arr[] = new ICFAccTaxObj[len];
   Iterator<ICFAccTaxObj> valIter = allTax.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFAccTaxObj> arrayList = new ArrayList<ICFAccTaxObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFAccTaxObj> sortedList = arrayList;
   return (sortedList);
 }