Beispiel #1
0
  public void write_all(readonly_list<Character> elements) {
    String s;

    if (elements instanceof string) {
      s = utilities.s((string) elements);
    } else {
      StringBuilder builder = new StringBuilder();
      for (int i = 0; i < elements.size(); ++i) {
        builder.append(elements.get(i));
      }
      s = builder.toString();
    }

    try {
      out.write(s);
    } catch (IOException e) {
    }
  }
  @Override
  public string to_string() {
    StringBuilder s = new StringBuilder();
    boolean first = true;
    s.append('[');

    if (!params.is_empty()) {
      readonly_list<dictionary.entry<master_type, abstract_value>> named_list = params.elements();
      for (int i = 0; i < named_list.size(); ++i) {
        if (first) {
          first = false;
        } else {
          s.append(", ");
        }
        s.append(utilities.s(named_list.get(i).key().short_name().to_string()));
        s.append(": ");
        s.append(utilities.s(named_list.get(i).value().to_string()));
      }
    }

    s.append(']');
    return new base_string(s.toString());
  }