JAL-1115 - synchronized access to group list
[jalview.git] / src / jalview / io / packed / JalviewDataset.java
index 1e06636..95de89d 100644 (file)
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************************/
 package jalview.io.packed;
 
 import jalview.datamodel.AlignmentI;
@@ -16,12 +33,61 @@ public class JalviewDataset
   AlignmentI parentDataset;
 
   /**
+   * @return the parentDataset
+   */
+  public AlignmentI getParentDataset()
+  {
+    return parentDataset;
+  }
+  /**
+   * @param parentDataset the parentDataset to set
+   */
+  public void setParentDataset(AlignmentI parentDataset)
+  {
+    this.parentDataset = parentDataset;
+  }
+  /**
+   * @return the featureColours
+   */
+  public Hashtable getFeatureColours()
+  {
+    return featureColours;
+  }
+  /**
+   * @param featureColours the featureColours to set
+   */
+  public void setFeatureColours(Hashtable featureColours)
+  {
+    this.featureColours = featureColours;
+  }
+  /**
+   * @return the seqDetails
+   */
+  public Hashtable getSeqDetails()
+  {
+    return seqDetails;
+  }
+  /**
+   * @param seqDetails the seqDetails to set
+   */
+  public void setSeqDetails(Hashtable seqDetails)
+  {
+    this.seqDetails = seqDetails;
+  }
+  /**
+   * @return the al
+   */
+  public List<AlignmentSet> getAl()
+  {
+    return (al==null) ? new ArrayList<AlignmentSet>() : al;
+  }
+  /**
    * current alignment being worked on.
    */
   List<AlignmentSet> al;
   public class AlignmentSet {
-    AlignmentI al;
-    List<jalview.io.NewickFile> trees;
+    public AlignmentI al;
+    public List<jalview.io.NewickFile> trees;
     AlignmentSet(AlignmentI a) {
       al = a;
       trees = new ArrayList<jalview.io.NewickFile>();
@@ -62,11 +128,31 @@ public class JalviewDataset
         {
           // the following works because all trees are already had node/SequenceI associations created.
           jalview.analysis.NJTree njt = new jalview.analysis.NJTree(al.getSequencesArray(), nf);
-          // this just updates the displayed leaf name on the try according to the SequenceIs.
+          // this just updates the displayed leaf name on the tree according to the SequenceIs.
           njt.renameAssociatedNodes();
         }
         
       }
+      /**
+       * set modification flag. If anything modifies the alignment in the current set, this flag should be true
+       */
+      private boolean modified=false;
+      
+      /**
+       * @return the modified
+       */
+      public boolean isModified()
+      {
+        return modified;
+      }
+      /**
+       * or the modification state with the given state 
+       * @param modifiedFromAction
+       */
+    public void updateSetModified(boolean modifiedFromAction)
+    {
+      modified |= modifiedFromAction;
+    }
   }
 
   /**
@@ -79,6 +165,8 @@ public class JalviewDataset
    */
   Hashtable seqDetails;
 
+  public boolean relaxedIdMatching=false;
+
   public JalviewDataset()
   {
     seqDetails = new Hashtable();
@@ -173,4 +261,12 @@ public SequenceI getLastAssociatedSequence() {
   // TODO: delineate semantics for associating uniquified data with potentially de-uniquified sequence.
   return null;
 }
+/**
+ * update the modified state flag for the current set with the given modification state
+ * @param modified - this will be ored with current modification state
+ */
+public void updateSetModified(boolean modified)
+{
+  getLastAlignmentSet().updateSetModified(modified);
+}
 }
\ No newline at end of file