public void reset(final AptitudeBonusInventory inventory) {
   this.m_categories.clear();
   this.m_categoriesById.clear();
   (this.m_inventory = inventory.getInactiveCopy()).addListener(this);
   this.m_modifications.clear();
   AptitudeCategoryModelManager.INSTANCE.forEachCategory(
       new TObjectProcedure<AptitudeCategoryModel>() {
         @Override
         public boolean execute(final AptitudeCategoryModel object) {
           final AptitudeBonusCategoryView category =
               new AptitudeBonusCategoryView(object, AptitudesView.this.m_inventory);
           AptitudesView.this.m_categories.add(category);
           AptitudesView.this.m_categoriesById.put(category.getId(), category);
           return true;
         }
       });
   Collections.sort(this.m_categories, this.m_categoryViewComparator);
   this.m_currentCategory = this.m_categories.get(0);
 }
Exemple #2
0
  @SuppressWarnings("HardCodedStringLiteral")
  public String toString() {
    StringBuilder result = new StringBuilder();
    result.append('<');
    if (myEphemeral) {
      result.append("ephemeral, ");
    }

    for (EqClass set : getNonTrivialEqClasses()) {
      result.append(set);
    }

    if (!myDistinctClasses.isEmpty()) {
      result.append("\n  distincts: ");
      List<String> distincts = new ArrayList<>();
      for (UnorderedPair<EqClass> pair : getDistinctClassPairs()) {
        distincts.add("{" + pair.first + ", " + pair.second + "}");
      }
      Collections.sort(distincts);
      result.append(StringUtil.join(distincts, " "));
    }

    if (!myStack.isEmpty()) {
      result.append("\n  stack: ").append(StringUtil.join(myStack, ","));
    }
    if (!myVariableStates.isEmpty()) {
      result.append("\n  vars: ");
      for (Map.Entry<DfaVariableValue, DfaVariableState> entry : myVariableStates.entrySet()) {
        result
            .append("[")
            .append(entry.getKey())
            .append("->")
            .append(entry.getValue())
            .append("] ");
      }
    }
    if (!myUnknownVariables.isEmpty()) {
      result.append("\n  unknowns: ").append(new HashSet<>(myUnknownVariables));
    }
    result.append('>');
    return result.toString();
  }