apollo.editor
Class CompoundTransaction

java.lang.Object
  extended by apollo.editor.Transaction
      extended by apollo.editor.CompoundTransaction
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
UpdateParentTransaction

public class CompoundTransaction
extends Transaction

A CompoundTransaction contains a list of Transactions (children). In some cases the child Transactions may also be CompoundTransactions (i.e., CompoundTransactions may be nested)

See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Fields inherited from class apollo.editor.Transaction
author, date, NEW, newProperties, OLD, oldProperties
 
Constructor Summary
CompoundTransaction(java.lang.Object source)
          phase out -> require source!
 
Method Summary
 void addTransaction(CompoundTransaction addedTrans)
          Adds the children of the compound trans NOT the CompoundTransaction itself.
 void addTransaction(Transaction childTrans)
          Add a child Transaction to this CompoundTransaction object.
protected  boolean flattenOnAddingToCompTrans()
          Returns true.
 AnnotationChangeEvent generateAnnotationChangeEvent()
          sets ace source to trans source.
 java.lang.String getCompoundTypeString()
           
 java.util.List getLeafTransactions()
          returns list of all non-compound leaf descendants.
 AnnotatedFeatureI getNewSplitFeature()
          If split compound transaction (isSplit == true), this returns the new split off feature.
 Transaction getTransaction(int i)
          Default return null.
 java.util.List getTransactions()
          Return list of transactions
 boolean hasCompoundType()
           
 boolean isCompound()
          default false.
 boolean isMerge()
           
 boolean isSplit()
           
 java.lang.String oneLineSummary()
          Short (one-line) summary of the object; concise alternative to toString() that displays every instance variable set in one of the constructors, plus date and author.
 void removeTransaction(Transaction transaction)
          Remove a child Transaction object from this CompoundTransaction object.
 void setSource(java.lang.Object source)
           
 int size()
          overridded by CompositeTransaction.
 java.lang.String toString()
           
 
Methods inherited from class apollo.editor.Transaction
addProperty, generateAnnotationChangeEvent, generateUndoChangeEvent, getAuthor, getClassString, getDate, getDeletedFeature, getNewId, getNewSubpartValue, getObjectClass, getOldComment, getOldId, getOldString, getOldSubpartValue, getOperation, getOperationString, getParentFeature, getParentFeatureClone, getParentTransaction, getProperty, getRank, getSeqFeature, getSeqFeatureClone, getSubpart, getSubpartRank, getSubpartString, hasKids, hasParentTransaction, isAdd, isAddPeptide, isDelete, isUpdate, isUpdateParent, setAuthor, setDate, setDate, setNewId, setNewSubpartValue, setObjectClass, setOldId, setOldSubpartValue, setOperation, setOperation, setParentFeature, setRank, setSeqFeature, setSubpart, setSubpartRank, subpartIsString, toString, updateClonedTranscriptIdsAndNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

CompoundTransaction

public CompoundTransaction(java.lang.Object source)
phase out -> require source!

Method Detail

hasCompoundType

public boolean hasCompoundType()

isSplit

public boolean isSplit()
Overrides:
isSplit in class Transaction

isMerge

public boolean isMerge()
Overrides:
isMerge in class Transaction

isCompound

public boolean isCompound()
Description copied from class: Transaction
default false. CompoundTransactions overrides with true.

Overrides:
isCompound in class Transaction

addTransaction

public void addTransaction(Transaction childTrans)
Add a child Transaction to this CompoundTransaction object.

Parameters:
transaction -

addTransaction

public void addTransaction(CompoundTransaction addedTrans)
Adds the children of the compound trans NOT the CompoundTransaction itself. A CompoundTransaction is flat (at least for now)


flattenOnAddingToCompTrans

protected boolean flattenOnAddingToCompTrans()
Returns true. this means flatten out this transactions when adding it as a child to another compound transactions, which is the default. in other words dont preserve this comp trans in the comp trans heirarchy. subclasses (UpdateParent) override this to preserve themselves. actually if we have a type (split,merge) we probably need to be preserved, otherwise probably no need to. The reason no need to is that compound trans are often just used as trans collection and have no meaning. typed compound trans are the exception to that.


getTransaction

public Transaction getTransaction(int i)
Description copied from class: Transaction
Default return null. Returns ith child transaction if composite.

Overrides:
getTransaction in class Transaction

size

public int size()
Description copied from class: Transaction
overridded by CompositeTransaction. Number of child transactions.

Overrides:
size in class Transaction

getCompoundTypeString

public java.lang.String getCompoundTypeString()

toString

public java.lang.String toString()
Overrides:
toString in class Transaction

getTransactions

public java.util.List getTransactions()
Return list of transactions


removeTransaction

public void removeTransaction(Transaction transaction)
Remove a child Transaction object from this CompoundTransaction object.

Parameters:
transaction -

setSource

public void setSource(java.lang.Object source)
Overrides:
setSource in class Transaction

generateAnnotationChangeEvent

public AnnotationChangeEvent generateAnnotationChangeEvent()
Description copied from class: Transaction
sets ace source to trans source. subclasses override this


getLeafTransactions

public java.util.List getLeafTransactions()
returns list of all non-compound leaf descendants. should there be a TransactionList class?

Overrides:
getLeafTransactions in class Transaction

getNewSplitFeature

public AnnotatedFeatureI getNewSplitFeature()
If split compound transaction (isSplit == true), this returns the new split off feature. getSeqFeature() returns the feature split off from.

Overrides:
getNewSplitFeature in class Transaction

oneLineSummary

public java.lang.String oneLineSummary()
Short (one-line) summary of the object; concise alternative to toString() that displays every instance variable set in one of the constructors, plus date and author.

Overrides:
oneLineSummary in class Transaction