private java.util.Hashtable parseDescription(String desc)
{
java.util.Hashtable fields = new java.util.Hashtable();
- java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":");
+ java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":",true);
+
String field;
int type = -1;
if (st.countTokens() > 0)
if (i < seqTypes.length)
{
+ st.nextToken(); // skip ':'
// valid seqType for modeller
type = i;
i = 1; // continue parsing fields
{
if ((field = st.nextToken(":")) != null)
{
+ if (!field.equals(":"))
+ {
// validate residue field value
if (Types[i] == 1)
{
;
}
fields.put(Fields[i++], field);
+ if (st.hasMoreTokens()) {
+ st.nextToken(); // skip token sep.
+ }
+ } else {
+ i++;
+ }
}
}
if (i == TAIL)
// slurp remaining fields
while (st.hasMoreTokens())
{
- field += ":" + st.nextToken(":");
+ String tl = st.nextToken(":");
+ field += tl.equals(":") ? tl : (":" + tl);
}
fields.put(Fields[TAIL], field);
}
{
// Set start and end before we update the type (in the case of a
// synthesized field set)
- if (getStartNum() != seq.getStart() && getStartCode().val != null)
+ if (getStartCode()==null || (getStartNum() != seq.getStart() && getStartCode().val != null))
{
+ // unset or user updated sequence start position
setStartCode(seq.getStart());
}
- if (getEndNum() != seq.getEnd() && getStartCode().val != null)
+ if (getEndCode()==null || (getEndNum() != seq.getEnd() && getStartCode()!=null && getStartCode().val != null))
{
setEndCode(seq.getEnd());
}
{
int start = 0;
resCode val = getStartCode();
- if (val.val != null)
+ if (val!=null && val.val != null)
{
return val.val.intValue();
}
{
int end = 0;
resCode val = getEndCode();
- if (val.val != null)
+ if (val!=null && val.val != null)
{
return val.val.intValue();
}
{
if (isModellerFieldset())
{
- if (getStartCode().val != null)
+ resCode rc=getStartCode();
+ if (rc!=null && rc.val != null)
{
newSeq.setStart(getStartNum());
}
{
newSeq.setStart(1);
}
- if (getEndCode().val != null)
+ rc=getEndCode();
+ if (rc!=null && rc.val != null)
{
newSeq.setEnd(getEndNum());
}