From: Jim Procter Date: Wed, 22 May 2013 16:45:29 +0000 (+0100) Subject: JAL-1297 JAL-1295 JAL-1294 sensible toString for benefit of annotation IO test X-Git-Tag: Jalview_2_9~249^2~18 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=788b7b7980d3de31579a9081bd0b3043b08d7a26;p=jalview.git JAL-1297 JAL-1295 JAL-1294 sensible toString for benefit of annotation IO test --- diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index 73611bd..b7a83a5 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -117,4 +117,57 @@ public class Annotation { this(null, null, ' ', val); } + + @Override + public String toString() + { + StringBuffer sb = new StringBuffer(); + if (displayCharacter != null) + { + sb.append("\'"); + sb.append(displayCharacter); + sb.append("\'"); + } + { + sb.append(","); + } + if (secondaryStructure != 0 + && !("" + displayCharacter).equals("" + secondaryStructure)) + { + sb.append("\'"); + sb.append(secondaryStructure); + sb.append("\'"); + } + { + sb.append(","); + } + if (description != null && description.length() > 0) + { + sb.append("\""); + sb.append(description); + sb.append("\""); + } + { + sb.append(","); + } + if (value != Float.NaN) + { + sb.append(value); + } + if (colour != null) + { + if (sb.length() > 0) + { + sb.append(","); + } + sb.append("["); + sb.append(colour.getRed()); + sb.append(","); + sb.append(colour.getGreen()); + sb.append(","); + sb.append(colour.getBlue()); + sb.append("]"); + } + return sb.toString(); + } }