1 package jalview.io.xdb.genbank;
5 * @author Dieval Guizelini
7 public class GenBankLocations extends GenBankLocation {
8 public static final int NONE = 1; // default
9 public static final int COMPLEMENT = 2;
10 public static final int JOIN = 3;
11 public static final int ORDER = 4; // conj com ordem desconhecida
12 private int operator = NONE;
13 private java.util.List<GenBankLocation> units;
15 public GenBankLocations() {
16 units = new java.util.ArrayList<GenBankLocation>();
20 public void setComplement(boolean complement){
21 super.setComplement(complement);
22 this.operator = COMPLEMENT;
24 for (GenBankLocation o : units) {
25 o.setComplement(complement);
31 public String toString() {
32 StringBuilder sb = new StringBuilder();
33 if (getOperator() == COMPLEMENT) {
34 sb.append("complement(");
35 } else if (getOperator() == JOIN) {
37 } else if (getOperator() == ORDER) {
40 if (units.size() > 0) {
41 sb.append(units.get(0).toString());
42 for (int i = 1; i < units.size(); i++) {
44 sb.append(units.get(i).toString());
47 if (getOperator() != NONE) {
56 public java.util.List<GenBankLocation> getUnits() {
61 * @param units the units to set
63 public void setUnits(java.util.List<GenBankLocation> units) {
68 public int getMinor() {
69 if( units.size() > 0 ) {
70 return units.get(0).getMinor();
76 public int getMajor() {
77 int ind = units.size();
79 return units.get(ind-1).getMajor();
85 * @return the operator
87 public int getOperator() {
92 * @param operator the operator to set
94 public void setOperator(int operator) {
95 this.operator = operator;