+ @Override
+ public void write(Writer w) throws IOException // directly copied from
+ // forester
+ {
+ w.write(" ");
+ w.write(getSize() + "");
+ w.write(ForesterUtil.LINE_SEPARATOR);
+ for (int row = 0; row < getSize(); ++row)
+ {
+ if (!ForesterUtil.isEmpty(getIdentifier(row)))
+ {
+ w.write(ForesterUtil.pad(getIdentifier(row), 10, ' ', false)
+ .toString());
+ w.write(' ');
+ w.write(' ');
+ }
+ else
+ {
+ throw new IllegalFormatUseException(
+ "Phylip format does not allow empty identifiers");
+ }
+ for (int col = 0; col < getSize(); ++col)
+ {
+ w.write(PHYLIP_FORMATTER.format(getValue(col, row)));
+ if (col < (getSize() - 1))
+ {
+ w.write(' ');
+ w.write(' ');
+ }
+ }
+ if (row < (getSize() - 1))
+ {
+ w.write(ForesterUtil.LINE_SEPARATOR);
+ }
+ }
+
+ }
+
+