-package jalview.datamodel.features;
+package jalview.datamodel;
public interface ContiguousI
{
--- /dev/null
+package jalview.datamodel;
+
+/**
+ * An immutable data bean that models a start-end range
+ */
+public class Range implements ContiguousI
+{
+ public final int start;
+
+ public final int end;
+
+ @Override
+ public int getBegin()
+ {
+ return start;
+ }
+
+ @Override
+ public int getEnd()
+ {
+ return end;
+ }
+
+ public Range(int i, int j)
+ {
+ start = i;
+ end = j;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf(start) + "-" + String.valueOf(end);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return start * 31 + end;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof Range)
+ {
+ Range r = (Range) obj;
+ return (start == r.start && end == r.end);
+ }
+ return false;
+ }
+}
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
+
/**
* An extension of ContiguousI that allows start/end values to be interpreted
* instead as two contact positions
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
import jalview.datamodel.SequenceFeature;
import java.util.ArrayList;
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
+import jalview.datamodel.Range;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
+
import java.util.ArrayList;
import java.util.List;
+++ /dev/null
-package jalview.datamodel.features;
-
-
-public class Range implements ContiguousI
-{
- final int start;
-
- final int end;
-
- @Override
- public int getBegin()
- {
- return start;
- }
-
- @Override
- public int getEnd()
- {
- return end;
- }
-
- public Range(int i, int j)
- {
- start = i;
- end = j;
- }
-
- @Override
- public String toString()
- {
- return String.valueOf(start) + "-" + String.valueOf(end);
- }
-}
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
+
import java.util.Comparator;
/**
package jalview.datamodel.features;
+import jalview.datamodel.ContiguousI;
import jalview.datamodel.SequenceFeature;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyI;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
+import jalview.datamodel.ContiguousI;
+import jalview.datamodel.Range;
import jalview.datamodel.SequenceFeature;
import java.util.ArrayList;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import jalview.datamodel.Range;
import jalview.datamodel.SequenceFeature;
import java.util.ArrayList;
import static org.testng.Assert.assertEquals;
+import jalview.datamodel.ContiguousI;
+import jalview.datamodel.Range;
+
import java.util.Comparator;
import org.testng.annotations.Test;