MCPcopy Create free account
hub / github.com/SquirrelJME/SquirrelJME / write

Method write

utils-dev/TodoProgression.java:75–121  ·  view source on GitHub ↗

Writes the results to the output stream. @param __ps The output stream. @throws NullPointerException On null arguments. @since 2018/03/29

(PrintStream __ps)

Source from the content-addressed store, hash-verified

73 * @since 2018/03/29
74 */
75 public void write(PrintStream __ps)
76 throws NullPointerException
77 {
78 if (__ps == null)
79 throw new NullPointerException("NARG");
80
81 Set<String> tags = this.tags;
82
83 // Build row one for column headers
84 __ps.print("name");
85 for (String t : tags)
86 {
87 __ps.print(',');
88 __ps.print(t);
89 }
90
91 // End with line
92 __ps.println();
93
94 // Sort projects by their name then UUID so they appear consistent
95 // and alphabetically sorted
96 Set<Project> sorted = new TreeSet<>(projects.values());
97
98 // Go through all projects and dump their data, ignore the UUID and
99 // only use the latest name
100 for (Project p : sorted)
101 {
102 // Print name
103 __ps.print(p.lastname);
104
105 // Print all counts
106 Map<String, Integer> counts = p.counts;
107 for (String t : tags)
108 {
109 // Comma before
110 __ps.print(',');
111
112 // Only print value if it is not null
113 Integer i = counts.get(t);
114 if (i != null)
115 __ps.print(i);
116 }
117
118 // End line for the column
119 __ps.println();
120 }
121 }
122
123 /**
124 * Main entry point.

Callers 1

mainMethod · 0.95

Calls 4

valuesMethod · 0.65
getMethod · 0.65
printMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected