View Javadoc

1   package uk.ac.ebi.intenz.tools.sib.sptr_enzyme;
2   
3   import uk.ac.ebi.interfaces.enzyme.EnzymeEntry;
4   import uk.ac.ebi.interfaces.sptr.SPTRCrossReference;
5   import uk.ac.ebi.interfaces.sptr.SPTRException;
6   
7   import java.io.Serializable;
8   import java.util.ArrayList;
9   
10  /**
11   * This class is a simple implementation of the {@link EnzymeEntry EnzymeEntry} interface.
12   *
13   * @author Michael Darsow
14   * @version preliminary - $Revision: 1.2 $ $Date: 2008/01/28 11:43:22 $
15   */
16  public class EnzymeEntryImpl implements EnzymeEntry, Serializable {
17    private int id;
18    private String ec, commonName, cofactors, comment;
19    private ArrayList synonyms, reactions, xrefs;
20    private boolean isTransferredOrDeleted;
21  
22    public EnzymeEntryImpl() {
23      id = 0;
24      ec = "";
25      commonName = "";
26      cofactors = "";
27      comment = "";
28      synonyms = new ArrayList();
29      reactions = new ArrayList();
30      xrefs = new ArrayList();
31      isTransferredOrDeleted = false;
32    }
33  
34    public int getId() {
35      return id;
36    }
37  
38    public void setId(int id) {
39      this.id = id;
40    }
41  
42    public void setEC(String s) throws SPTRException, UnsupportedOperationException {
43      ec = s;
44    }
45  
46    public String getEC() throws SPTRException, UnsupportedOperationException {
47      return ec;
48    }
49  
50    public void setCommonName(String s) throws SPTRException, UnsupportedOperationException {
51      commonName = s;
52    }
53  
54    public String getCommonName() throws SPTRException, UnsupportedOperationException {
55      return commonName;
56    }
57  
58    public void addSynonym(String s) throws SPTRException, UnsupportedOperationException {
59      synonyms.add(s);
60    }
61  
62    public boolean removeSynonym(String s) throws SPTRException, UnsupportedOperationException {
63      return synonyms.remove(s);
64    }
65  
66    public String[] getSynonyms() throws SPTRException, UnsupportedOperationException {
67      String[] synonymsArray = new String[synonyms.size()];
68      for (int iii = 0; iii < synonyms.size(); iii++) {
69        synonymsArray[iii] = (String) synonyms.get(iii);
70      }
71      return synonymsArray;
72    }
73  
74    public void setSynonyms(String[] synonyms) throws SPTRException, UnsupportedOperationException {
75      for (int iii = 0; iii < synonyms.length; iii++) {
76        addSynonym(synonyms[iii]);
77      }
78    }
79  
80    public void addReaction(String s) throws SPTRException, UnsupportedOperationException {
81      reactions.add(s);
82    }
83  
84    public boolean removeReaction(String s) throws SPTRException, UnsupportedOperationException {
85      return reactions.remove(s);
86    }
87  
88    public String[] getReactions() throws SPTRException, UnsupportedOperationException {
89      String[] reactionsArray = new String[reactions.size()];
90      for (int iii = 0; iii < reactions.size(); iii++) {
91        reactionsArray[iii] = (String) reactions.get(iii);
92      }
93      return reactionsArray;
94    }
95  
96    public void setReactions(String[] reactions) throws SPTRException, UnsupportedOperationException {
97      for (int iii = 0; iii < reactions.length; iii++) {
98        addReaction(reactions[iii]);
99      }
100   }
101 
102   public void setCofactors(String s) throws SPTRException, UnsupportedOperationException {
103     cofactors = s;
104   }
105 
106   public String getCofactors() throws SPTRException, UnsupportedOperationException {
107     return cofactors;
108   }
109 
110   public void setComment(String s) throws SPTRException, UnsupportedOperationException {
111     comment = s;
112   }
113 
114   public String getComment() throws SPTRException, UnsupportedOperationException {
115     return comment;
116   }
117 
118   public void addCrossReference(SPTRCrossReference sptrCrossReference) throws SPTRException, UnsupportedOperationException {
119     xrefs.add(sptrCrossReference);
120   }
121 
122   public void addCrossReferences(SPTRCrossReference[] sptrCrossReference) throws SPTRException, UnsupportedOperationException {
123     for (int iii = 0; iii < sptrCrossReference.length; iii++) {
124       addCrossReference(sptrCrossReference[iii]);
125     }
126   }
127 
128   public boolean removeCrossReference(SPTRCrossReference sptrCrossReference) throws SPTRException, UnsupportedOperationException {
129     return xrefs.remove(sptrCrossReference);
130   }
131 
132   public SPTRCrossReference[] getCrossReferences() throws SPTRException, UnsupportedOperationException {
133     SPTRCrossReference[] xrefsArray = new SPTRCrossReference[this.xrefs.size()];
134     for (int iii = 0; iii < this.xrefs.size(); iii++) {
135       xrefsArray[iii] = (SPTRCrossReference) this.xrefs.get(iii);
136     }
137     return xrefsArray;
138   }
139 
140   public void setCrossReferences(SPTRCrossReference[] xrefs) throws SPTRException, UnsupportedOperationException {
141     for (int iii = 0; iii < xrefs.length; iii++) {
142       addCrossReference(xrefs[iii]);
143     }
144   }
145 
146   public boolean isTransferredOrDeleted() {
147     return isTransferredOrDeleted;
148   }
149 
150   public void setTransferredOrDeleted(boolean transferredOrDeleted) {
151     isTransferredOrDeleted = transferredOrDeleted;
152   }
153 }