--- /dev/null
+package jalview.io.xdb.genbank;
+
+/**
+ *
+ * @author Dieval Guizelini
+ */
+public class GenBankLocations extends GenBankLocation {
+ public static final int NONE = 1; // default
+ public static final int COMPLEMENT = 2;
+ public static final int JOIN = 3;
+ public static final int ORDER = 4; // conj com ordem desconhecida
+ private int operator = NONE;
+ private java.util.List<GenBankLocation> units;
+
+ public GenBankLocations() {
+ units = new java.util.ArrayList<GenBankLocation>();
+ }
+
+ @Override
+ public void setComplement(boolean complement){
+ super.setComplement(complement);
+ this.operator = COMPLEMENT;
+ if (units != null) {
+ for (GenBankLocation o : units) {
+ o.setComplement(complement);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (getOperator() == COMPLEMENT) {
+ sb.append("complement(");
+ } else if (getOperator() == JOIN) {
+ sb.append("join(");
+ } else if (getOperator() == ORDER) {
+ sb.append("order(");
+ }
+ if (units.size() > 0) {
+ sb.append(units.get(0).toString());
+ for (int i = 1; i < units.size(); i++) {
+ sb.append(",");
+ sb.append(units.get(i).toString());
+ }
+ }
+ if (getOperator() != NONE) {
+ sb.append(")");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * @return the units
+ */
+ public java.util.List<GenBankLocation> getUnits() {
+ return units;
+ }
+
+ /**
+ * @param units the units to set
+ */
+ public void setUnits(java.util.List<GenBankLocation> units) {
+ this.units = units;
+ }
+
+ @Override
+ public int getMinor() {
+ if( units.size() > 0 ) {
+ return units.get(0).getMinor();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMajor() {
+ int ind = units.size();
+ if( ind > 0 ) {
+ return units.get(ind-1).getMajor();
+ }
+ return 0;
+ }
+
+ /**
+ * @return the operator
+ */
+ public int getOperator() {
+ return operator;
+ }
+
+ /**
+ * @param operator the operator to set
+ */
+ public void setOperator(int operator) {
+ this.operator = operator;
+ }
+
+}