info.bioinfweb.treegraph.document.undo.format
Class DistanceValuesByNodeBranchDataEdit

java.lang.Object
  extended by info.bioinfweb.treegraph.document.undo.DocumentEdit
      extended by info.bioinfweb.treegraph.document.undo.format.NodeBranchDataFormatEdit
          extended by info.bioinfweb.treegraph.document.undo.format.DistanceValuesByNodeBranchDataEdit
All Implemented Interfaces:
UndoableEdit

public class DistanceValuesByNodeBranchDataEdit
extends NodeBranchDataFormatEdit


Field Summary
private  boolean changeUndefined
           
private  float factor
           
private  boolean inheritToTerminals
           
private  float min
           
private  Vector<Float>[] oldValues
           
private  NodeDataAdapter sourceAdapter
           
private  DistanceAdapter[] targetAdapters
           
 
Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
document
 
Constructor Summary
DistanceValuesByNodeBranchDataEdit(Document document, NodeDataAdapter sourceAdapter, float min, float max, boolean changeUndefined, boolean inheritToTerminals, DistanceAdapter[] targetAdapters)
           
 
Method Summary
 String getPresentationName()
           
 void redo()
           
private  void saveOldSubtreeValues(Node root)
          Saves the old widths in a linear list (ordering is root, child 0..n)
private  void saveOldValues()
           
private  void setNewValues(Node root)
          Sets the branch widths according to the specified range and node data.
private  int setOldWidths(Node root, int index)
          Assigns the previously saved line widths to the branches in the subtree under root.
 void undo()
           
 
Methods inherited from class info.bioinfweb.treegraph.document.undo.format.NodeBranchDataFormatEdit
calculateMaxNodeData
 
Methods inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
addEdit, canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceAdapter

private NodeDataAdapter sourceAdapter

min

private float min

factor

private float factor

changeUndefined

private boolean changeUndefined

inheritToTerminals

private boolean inheritToTerminals

targetAdapters

private DistanceAdapter[] targetAdapters

oldValues

private Vector<Float>[] oldValues
Constructor Detail

DistanceValuesByNodeBranchDataEdit

public DistanceValuesByNodeBranchDataEdit(Document document,
                                          NodeDataAdapter sourceAdapter,
                                          float min,
                                          float max,
                                          boolean changeUndefined,
                                          boolean inheritToTerminals,
                                          DistanceAdapter[] targetAdapters)
Method Detail

saveOldValues

private void saveOldValues()

saveOldSubtreeValues

private void saveOldSubtreeValues(Node root)
Saves the old widths in a linear list (ordering is root, child 0..n)

Parameters:
root -

setNewValues

private void setNewValues(Node root)
Sets the branch widths according to the specified range and node data.

Parameters:
root -

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class DocumentEdit
Throws:
CannotRedoException

setOldWidths

private int setOldWidths(Node root,
                         int index)
Assigns the previously saved line widths to the branches in the subtree under root.

Parameters:
root -
index - - the index of the value for root in oldWidths
Returns:
the next unused index of oldWidths

undo

public void undo()
          throws CannotUndoException
Specified by:
undo in interface UndoableEdit
Overrides:
undo in class DocumentEdit
Throws:
CannotUndoException

getPresentationName

public String getPresentationName()