X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Frest%2Fparams%2FSeqVector.java;h=f890add45078d600f46bea8b11242c95d46da85c;hb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;hp=763206702d3cf7c7e591dc1b65d82a14ecdb207c;hpb=1cc81e06ac2faa5ee4b8879e9fa019956e34259f;p=jalview.git diff --git a/src/jalview/ws/rest/params/SeqVector.java b/src/jalview/ws/rest/params/SeqVector.java index 7632067..f890add 100644 --- a/src/jalview/ws/rest/params/SeqVector.java +++ b/src/jalview/ws/rest/params/SeqVector.java @@ -37,24 +37,30 @@ import org.apache.http.entity.mime.content.StringBody; import org.jmol.util.ArrayUtil; /** - * input a list of sequences separated by some separator + * input a list of sequences separated by some separator + * * @author JimP - * + * */ -public class SeqVector extends InputType { +public class SeqVector extends InputType +{ String sep; + molType type; + public SeqVector() { - super(new Class[] { AlignmentI.class} ); + super(new Class[] + { AlignmentI.class }); } @Override - public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException, NoValidInputDataException + public ContentBody formatForInput(RestJob rj) + throws UnsupportedEncodingException, NoValidInputDataException { StringBuffer idvector = new StringBuffer(); - boolean list=false; - for (SequenceI seq:rj.getSequencesForInput(token, type)) + boolean list = false; + for (SequenceI seq : rj.getSequencesForInput(token, type)) { if (list) { @@ -64,15 +70,16 @@ public class SeqVector extends InputType { } return new StringBody(idvector.toString()); } + @Override public List getURLEncodedParameter() { ArrayList prms = new ArrayList(); super.addBaseParams(prms); - prms.add("sep='"+ sep+"'"); - if (type!=null) + prms.add("sep='" + sep + "'"); + if (type != null) { - prms.add("type='"+type+"'"); + prms.add("type='" + type + "'"); } return prms; } @@ -90,20 +97,22 @@ public class SeqVector extends InputType { if (tok.startsWith("sep")) { - sep=val; + sep = val; return true; } if (tok.startsWith("type")) { - try { - type=molType.valueOf(val); + try + { + type = molType.valueOf(val); return true; } catch (Exception x) { - warnings.append("Invalid molecule type '"+val+"'. Must be one of ("); - for (molType v:molType.values()) + warnings.append("Invalid molecule type '" + val + + "'. Must be one of ("); + for (molType v : molType.values()) { - warnings.append(" "+v); + warnings.append(" " + v); } warnings.append(")\n"); } @@ -121,7 +130,7 @@ public class SeqVector extends InputType { { " ", ",", ";", "\t", "|" }), null)); lst.add(createMolTypeOption("type", "Sequence type", false, type, molType.MIX)); - + return lst; }