X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=datamodel%2Fcompbio%2Fdata%2Fsequence%2FScore.java;h=f28bd0d6a34934551efb015baaa8290939a63e28;hb=aca9c5503b812c9c96aebb408748dc15728f9ad7;hp=39bb39818bf5bb4f46dc82d612ede0750c4bb7b1;hpb=c1e5e6f8c46bee0a7db6a643222bec916b7178da;p=jabaws.git diff --git a/datamodel/compbio/data/sequence/Score.java b/datamodel/compbio/data/sequence/Score.java index 39bb398..f28bd0d 100644 --- a/datamodel/compbio/data/sequence/Score.java +++ b/datamodel/compbio/data/sequence/Score.java @@ -6,11 +6,8 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.text.NumberFormat; import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.Locale; import java.util.Set; -import java.util.SortedSet; import java.util.TreeSet; import javax.xml.bind.annotation.XmlAccessType; @@ -35,15 +32,16 @@ public class Score { NUMBER_FORMAT.setGroupingUsed(false); NUMBER_FORMAT.setMaximumFractionDigits(3); } + // This should be Enum but JAXB cannot serialize it. + private final String method; - private Enum method; + private TreeSet ranges = new TreeSet(); - private SortedSet ranges = new TreeSet(); - - private List scores = Collections.emptyList(); + private ArrayList scores = new ArrayList(0); private Score() { // JaXB default constructor + method = null; } /** @@ -56,8 +54,8 @@ public class Score { * the actual conservation values for each column of the * alignment */ - public Score(Enum method, List scores) { - this.method = method; + public Score(Enum method, ArrayList scores) { + this.method = method.toString(); this.scores = new ArrayList(scores); } @@ -72,24 +70,24 @@ public class Score { * The set of ranges i.e. parts of the sequence with specific * function, usually can be calculated based on scores */ - public Score(Enum method, List scores, SortedSet ranges) { - this.method = method; + public Score(Enum method, ArrayList scores, TreeSet ranges) { + this.method = method.toString(); this.ranges = ranges; this.scores = scores; } - public Score(Enum method, SortedSet ranges) { - this.method = method; + public Score(Enum method, TreeSet ranges) { + this.method = method.toString(); this.ranges = ranges; } public Score(Enum method, float[] scores) { - this.method = method; + this.method = method.toString(); this.scores = toList(scores); } - private List toList(float[] values) { - List vlist = new ArrayList(); + private ArrayList toList(float[] values) { + ArrayList vlist = new ArrayList(); for (float v : values) { vlist.add(new Float(v)); } @@ -100,7 +98,7 @@ public class Score { * * @return the ConservationMethod */ - public Enum getMethod() { + public String getMethod() { return method; } @@ -109,7 +107,7 @@ public class Score { * * @return the column scores for the alignment */ - public List getScores() { + public ArrayList getScores() { return scores; } @@ -118,11 +116,11 @@ public class Score { * * @return */ - public SortedSet getRanges() { + public TreeSet getRanges() { return ranges; } - public void setRanges(SortedSet ranges) { + public void setRanges(TreeSet ranges) { this.ranges = ranges; }