- private final float[] annotation;\r
-\r
- public AnnotatedSequence(String id, String sequence, float[] annotation) {\r
- super(id, sequence);\r
- this.annotation = annotation;\r
- if (annotation == null || annotation.length != sequence.length()) {\r
- throw new IllegalArgumentException("The length of the annotation ("\r
- + ((annotation != null) ? annotation.length : "0")\r
- + ") does not match the length of the sequence ("\r
- + sequence.length() + ")!");\r
+ private float[] annotation;\r
+\r
+ private AnnotatedSequence() {\r
+ super();\r
+ // JAXB default constructor\r
+ }\r
+\r
+ public AnnotatedSequence(String id, String sequence, float[] annotation) {\r
+ super(id, sequence);\r
+ this.annotation = annotation;\r
+ if (annotation == null || annotation.length != sequence.length()) {\r
+ throw new IllegalArgumentException("The length of the annotation ("\r
+ + ((annotation != null) ? annotation.length : "0")\r
+ + ") does not match the length of the sequence ("\r
+ + sequence.length() + ")!");\r
+ }\r
+ }\r
+\r
+ public AnnotatedSequence(FastaSequence fsequence, float[] annotation) {\r
+ this(fsequence.getId(), fsequence.getSequence(), annotation);\r
+ }\r
+\r
+ public float[] getAnnotation() {\r
+ return annotation;\r
+ }\r
+\r
+ @Override\r
+ public int hashCode() {\r
+ final int prime = 7;\r
+ int result = super.hashCode();\r
+ result = prime * result + Arrays.hashCode(annotation);\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+ if (!super.equals(obj))\r
+ return false;\r
+ if (getClass() != obj.getClass())\r
+ return false;\r
+ AnnotatedSequence other = (AnnotatedSequence) obj;\r
+ if (!Arrays.equals(annotation, other.annotation))\r
+ return false;\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return super.toString() + "Annotation:\n "\r
+ + Arrays.toString(annotation) + "\n";\r