示例#1
0
  void expressionToUML() { // Executes two commands, one on languages, and another one on bodies
    int fillLanguage = 0, fillBody = 0;

    languages.clear();
    bodies.clear();

    Iterator<Expression> iterator = expressions.iterator();
    while (iterator.hasNext()) {
      Expression expression = iterator.next();
      if (expression == null) {
        iterator.remove();
        continue;
      }

      String language = expression.getLanguage();
      String body = expression.getBody();
      if (language == null && body == null) {
        iterator.remove();
        continue;
      }

      if (language != null && body != null) {
        addLanguage(language, fillLanguage);
        addBody(body, fillBody);

        fillBody = fillLanguage = 0;
      }

      if (language == null) {
        fillLanguage++;
        addBody(body, fillBody);
        fillBody = 0;
      } else if (body == null) {
        fillBody++;
        addLanguage(language, fillLanguage);
        fillLanguage = 0;
      }
    }
  }
示例#2
0
 /**
  * Updates the available brokers from a {@link BrokersStatus} event.
  *
  * @param statuses the new statuses
  */
 public synchronized void setBrokersStatus(BrokersStatus statuses) {
   mBrokerMap.clear();
   mAvailableBrokers.clear();
   List<Broker> availableBrokers = Lists.newArrayList();
   availableBrokers.add(AUTO_SELECT_BROKER);
   for (BrokerStatus status : statuses.getBrokers()) {
     if (status.getLoggedOn()) {
       Broker broker = new Broker(status.getName(), status.getId());
       mBrokerMap.put(status.getId(), broker);
       availableBrokers.add(broker);
     }
   }
   mAvailableBrokers.addAll(availableBrokers);
 }