From: amwaterhouse Date: Wed, 18 Apr 2007 12:01:33 +0000 (+0000) Subject: Check values not null in copy constructor X-Git-Tag: Release_2_3~227 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ff37fec79b0304a4a9a67bbb512c7d2b120f6f34;p=jalview.git Check values not null in copy constructor --- diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 8e6d50d..f43529d 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -189,6 +189,8 @@ public class AlignmentAnnotation int graphType) { // graphs are not editable + editable = graphType==0; + this.label = label; this.description = description; this.annotations = annotations; @@ -209,7 +211,7 @@ public class AlignmentAnnotation float min = graphMin; float max = graphMax; boolean drawValues = true; - + if (min == max) { min = 999999999; @@ -253,16 +255,17 @@ public class AlignmentAnnotation } } } - + /** * Copy constructor - * creates a new independent annotation row with the same associated sequenceRef + * creates a new independent annotation row with the same associated sequenceRef * @param annotation */ public AlignmentAnnotation(AlignmentAnnotation annotation) { this.label = new String(annotation.label); - this.description = new String(annotation.description); + if (annotation.description != null) + this.description = new String(annotation.description); this.graphMin = annotation.graphMin; this.graphMax = annotation.graphMax; this.graph = annotation.graph; @@ -294,7 +297,7 @@ public class AlignmentAnnotation while (pos.hasMoreElements()) { Integer p = (Integer) pos.nextElement(); Annotation a = (Annotation) sequenceMapping.get(p); - sequenceMapping.put(p, annotations[anvec.indexOf(a)]); + sequenceMapping.put(p, annotations[anvec.indexOf(a)]); } anvec.removeAllElements(); } else { @@ -407,7 +410,7 @@ public class AlignmentAnnotation { if (sequenceRef==null) return; - + int a = 0, aSize = sequenceRef.getLength(); if (aSize == 0) @@ -451,7 +454,7 @@ public class AlignmentAnnotation ann = null; return j; } - + /** * Associate this annotion with the aligned residues of a particular sequence. * sequenceMapping will be updated in the following way: @@ -467,7 +470,7 @@ public class AlignmentAnnotation if (sequenceRef!=sequenceI && !sequenceRef.equals(sequenceI)) { // throw away old mapping and reconstruct. sequenceRef=null; - if (sequenceMapping!=null) + if (sequenceMapping!=null) { sequenceMapping=null; // compactAnnotationArray();