HiddenSequences hiddenSequences = new HiddenSequences(this);
+ public Hashtable alignmentProperties;
+
private void initAlignment(SequenceI[] seqs)
{
int i = 0;
public SequenceI[] getSequencesArray()
{
+ if (sequences==null)
+ return null;
SequenceI[] reply = new SequenceI[sequences.size()];
for (int i = 0; i < sequences.size(); i++)
{
return true;
}
-
- /**
- * DOCUMENT ME!
- *
- * @param aa DOCUMENT ME!
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.AlignmentAnnotation)
*/
- public void deleteAnnotation(AlignmentAnnotation aa)
+ public boolean deleteAnnotation(AlignmentAnnotation aa)
{
- if(aa.sequenceRef!=null)
- aa.sequenceRef.removeAlignmentAnnotation(aa);
-
int aSize = 1;
if (annotations != null)
if (aSize < 1)
{
- return;
+ return false;
}
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
+ boolean swap=false;
int tIndex = 0;
for (int i = 0; i < aSize; i++)
{
if (annotations[i] == aa)
{
+ swap=true;
continue;
}
-
- temp[tIndex] = annotations[i];
- tIndex++;
+ if (tIndex<temp.length)
+ temp[tIndex++] = annotations[i];
}
- annotations = temp;
+ if (swap)
+ {
+ annotations = temp;
+ if(aa.sequenceRef!=null)
+ aa.sequenceRef.removeAlignmentAnnotation(aa);
+ }
+ return swap;
}
/**
return cal;
}
+ public void setProperty(Object key, Object value)
+ {
+ if(alignmentProperties==null)
+ alignmentProperties = new Hashtable();
+
+ alignmentProperties.put(key,value);
+ }
+
+ public Object getProperty(Object key)
+ {
+ if(alignmentProperties!=null)
+ return alignmentProperties.get(key);
+ else
+ return null;
+ }
+
+ public Hashtable getProperties()
+ {
+ return alignmentProperties;
+ }
+ AlignedCodonFrame[] codonFrameList=null;
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame)
+ */
+ public void addCodonFrame(AlignedCodonFrame codons)
+ {
+ if (codons==null)
+ return;
+ if (codonFrameList==null)
+ {
+ codonFrameList = new AlignedCodonFrame[] { codons };
+ return;
+ }
+ AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length+1];
+ System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
+ t[codonFrameList.length] = codons;
+ codonFrameList = t;
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
+ */
+ public AlignedCodonFrame getCodonFrame(int index)
+ {
+ return codonFrameList[index];
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
+ */
+ public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
+ {
+ if (seq==null || codonFrameList==null)
+ return null;
+ Vector cframes=new Vector();
+ for (int f=0;f<codonFrameList.length; f++)
+ {
+ if (codonFrameList[f].involvesSequence(seq))
+ cframes.addElement(codonFrameList[f]);
+ }
+ if (cframes.size()==0)
+ return null;
+ AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
+ cframes.copyInto(cfr);
+ return cfr;
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#getCodonFrames()
+ */
+ public AlignedCodonFrame[] getCodonFrames()
+ {
+ return codonFrameList;
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.AlignedCodonFrame)
+ */
+ public boolean removeCodonFrame(AlignedCodonFrame codons)
+ {
+ if (codons==null || codonFrameList==null)
+ return false;
+ boolean removed=false;
+ int i=0,iSize=codonFrameList.length;
+ while (i<iSize)
+ {
+ if (codonFrameList[i]==codons)
+ {
+ removed=true;
+ if (i+1<iSize)
+ {
+ System.arraycopy(codonFrameList,i+1,codonFrameList, i, iSize-i-1);
+ }
+ iSize--;
+ }
+ else
+ {
+ i++;
+ }
+ }
+ return removed;
+ }
}