Beispiel #1
0
 public override void print(Output @out)
 {
     entries.Sort();
     //Collections.sort(entries);
     listLength = 1;
     if (entries.Count == 0)
     {
         @out.print("{}");
     }
     else
     {
         bool lineBreak = isList && entries.Count > 5 || isObject && entries.Count > 2 || !isObject;
         //System.out.println(" -- " + (isList && entries.size() > 5));
         //System.out.println(" -- " + (isObject && entries.size() > 2));
         //System.out.println(" -- " + (!isObject));
         if (!lineBreak)
         {
             foreach (Entry entry in entries)
             {
                 Expression @value = entry.value;
                 if (!(@value.isBrief()))
                 {
                     lineBreak = true;
                     break;
                 }
             }
         }
         @out.print("{");
         if (lineBreak)
         {
             @out.println();
             @out.indent();
         }
         printEntry(0, @out);
         if (!entries[0].value.isMultiple())
         {
             for (int index = 1; index < entries.Count; index++)
             {
                 @out.print(",");
                 if (lineBreak)
                 {
                     @out.println();
                 }
                 else
                 {
                     @out.print(" ");
                 }
                 printEntry(index, @out);
                 if (entries[index].value.isMultiple())
                 {
                     break;
                 }
             }
         }
         if (lineBreak)
         {
             @out.println();
             @out.dedent();
         }
         @out.print("}");
     }
 }