git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a7895a
)
dataset alignments have a reference count which must be zero before they are finalized.
author
jprocter
<Jim Procter>
Fri, 24 Aug 2007 15:38:29 +0000
(15:38 +0000)
committer
jprocter
<Jim Procter>
Fri, 24 Aug 2007 15:38:29 +0000
(15:38 +0000)
src/jalview/datamodel/Alignment.java
patch
|
blob
|
history
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
c474142
..
ba65fd7
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-190,7
+190,7
@@
public class Alignment
public void finalize()
{
if(getDataset()!=null)
public void finalize()
{
if(getDataset()!=null)
- getDataset().finalize();
+ getDataset().removeAlignmentRef();
dataset = null;
sequences = null;
dataset = null;
sequences = null;
@@
-199,6
+199,16
@@
public class Alignment
hiddenSequences = null;
}
hiddenSequences = null;
}
+ /**
+ * decrement the alignmentRefs counter by one and call finalize if it goes to zero.
+ */
+ private void removeAlignmentRef()
+ {
+ if (--alignmentRefs==0)
+ {
+ finalize();
+ }
+ }
/**
* DOCUMENT ME!
/**
* DOCUMENT ME!
@@
-638,6
+648,18
@@
public class Alignment
{
dataset = data;
}
{
dataset = data;
}
+ dataset.addAlignmentRef();
+ }
+ /**
+ * reference count for number of alignments referencing this one.
+ */
+ int alignmentRefs=0;
+ /**
+ * increase reference count to this alignment.
+ */
+ private void addAlignmentRef()
+ {
+ alignmentRefs++;
}
public Alignment getDataset()
}
public Alignment getDataset()