}
else
{
- seqannot = new IdentityHashMap<SequenceI, AlignmentAnnotation>();
+ seqannot = new IdentityHashMap<>();
}
// resolve the context containing all the annotation for the sequence
AnnotatedCollectionI alcontext = alignment instanceof AlignmentI
&& aboveAnnotationThreshold == ABOVE_THRESHOLD
&& value >= ann.threshold.value)
{
- range = (value - ann.threshold.value)
+ range = ann.graphMax == ann.threshold.value ? 1f
+ : (value - ann.threshold.value)
/ (ann.graphMax - ann.threshold.value);
}
else if (thresholdIsMinMax && ann.threshold != null
&& aboveAnnotationThreshold == BELOW_THRESHOLD
&& value <= ann.threshold.value)
{
- range = (value - ann.graphMin) / (ann.threshold.value - ann.graphMin);
+ range = ann.graphMin == ann.threshold.value ? 0f
+ : (value - ann.graphMin)
+ / (ann.threshold.value - ann.graphMin);
}
else
{
Color result = testee.shadeCalculation(ann, col);
assertEquals(result, expected, "for column " + col);
}
+
+ /*
+ * test for boundary case threshold == graphMax (JAL-3206)
+ */
+ float thresh = ann.threshold.value;
+ ann.threshold.value = ann.graphMax;
+ Color result = testee.shadeCalculation(ann, WIDTH - 1);
+ assertEquals(result, maxColour);
+ testee.setThresholdIsMinMax(false);
+ result = testee.shadeCalculation(ann, WIDTH - 1);
+ assertEquals(result, maxColour);
+ ann.threshold.value = thresh; // reset
}
/**
Color result = testee.shadeCalculation(ann, col);
assertEquals(result, expected, "for column " + col);
}
+
+ /*
+ * test for boundary case threshold == graphMin (JAL-3206)
+ */
+ float thresh = ann.threshold.value;
+ ann.threshold.value = ann.graphMin;
+ Color result = testee.shadeCalculation(ann, 0);
+ assertEquals(result, minColour);
+ testee.setThresholdIsMinMax(false);
+ result = testee.shadeCalculation(ann, 0);
+ assertEquals(result, minColour);
+ ann.threshold.value = thresh; // reset
}
/**