1 package jalview.datamodel.xdb.embl;
3 import java.util.Iterator;
4 import java.util.Vector;
6 public class EmblFeatureLocations {
9 boolean locationComplement;
11 * @return the locationComplement
13 public boolean isLocationComplement() {
14 return locationComplement;
17 * @param locationComplement the locationComplement to set
19 public void setLocationComplement(boolean locationComplement) {
20 this.locationComplement = locationComplement;
23 * @return the locationType
25 public String getLocationType() {
29 * @param locationType the locationType to set
31 public void setLocationType(String locationType) {
32 this.locationType = locationType;
35 * @return the locElements
37 public Vector getLocElements() {
41 * @param locElements the locElements to set
43 public void setLocElements(Vector locElements) {
44 this.locElements = locElements;
47 * Return all location elements as start-end pairs on referenced sequence
48 * TODO: pass back complement and 'less than or more than' range information
49 * @return int[] { start1, end1, ... }
51 public int[] getElementRanges() {
52 if (locationType.equalsIgnoreCase("single")) {
53 int[] se = new int[locElements.size()*2];
55 for (Iterator le=locElements.iterator();le.hasNext();) {
56 EmblFeatureLocElement loce = (EmblFeatureLocElement) le.next();
57 BasePosition bp[] = loce.getBasePositions();
59 se[sepos++] = Integer.parseInt(bp[0].getPos());
60 se[sepos++] = Integer.parseInt(bp[1].getPos());
65 if (locationType.equalsIgnoreCase("join")) {
66 int[] se = new int[locElements.size()*2];
68 for (Iterator le=locElements.iterator();le.hasNext();) {
69 EmblFeatureLocElement loce = (EmblFeatureLocElement) le.next();
70 BasePosition bp[] = loce.getBasePositions();
72 se[sepos++] = Integer.parseInt(bp[0].getPos());
73 se[sepos++] = Integer.parseInt(bp[1].getPos());
78 if (locationType!=null)
80 jalview.bin.Cache.log.error("EmbleFeatureLocations.getElementRanges cannot deal with locationType=='"+locationType+"'");