Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document.undo.file
Class AddSupportValuesEdit

    java.lang.Object
      info.bioinfweb.treegraph.document.undo.DocumentEdit
          info.bioinfweb.treegraph.document.undo.ComplexDocumentEdit
              info.bioinfweb.treegraph.document.undo.file.AddSupportValuesEdit

All Implemented Interfaces:
  UndoableEdit

    public class AddSupportValuesEdit

extends ComplexDocumentEdit

Nested Class Summary
`static class` | `AddSupportValuesEdit.TargetType`

Field Summary
`static DecimalFormat` | `CONFLICT_DECIMAL_FORMAT`
`static String` | `CONFLICT_NAME`
`private TextElementDataAdapter` | `conflictAdapter` The node/branch data column to write imported conflict values to
`static String` | `KEY_LEAF_REFERENCE`
`private Vector<TextElementData>` | `leafValues`
`static int` | `MAX_TERMINAL_ERROR_COUNT`
`private boolean` | `processRooted`
`static NodeNameAdapter` | `SOURCE_LEAFS_ADAPTER`
`private NodeBranchDataAdapter` | `sourceAdapter` The node/branch data to be imported (node names or branch lengths)
`private Document` | `src`
`static DecimalFormat` | `SUPPORT_DECIMAL_FORMAT`
`static String` | `SUPPORT_NAME`
`private TextElementDataAdapter` | `supportAdapter` The node/branch data column to write imported support values to
`private TextElementDataAdapter` | `targetLeafsAdapter` The column that contains the terminal identifiers in the target document (usually nodes names)

Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
`document`

Constructor Summary
`AddSupportValuesEdit(Document document, Document src, TextElementDataAdapter terminalsAdapter, AddSupportValuesEdit.TargetType targetType, String idPrefix, NodeBranchDataAdapter sourceAdapter, boolean processRooted)`

Method Summary
`private void` | `addLeafFields(Node root, TextElementDataAdapter adapter)` Adds a boolean field which indicates the leafs located under `root` to the attribute map of `root`.
`private void` | `addLeafList(List<TextElementData> list, Node root, TextElementDataAdapter adapter)` Fills the specified list with the values of all leafs under `root`.
`private String` | `compareLeafs()`
`static AddSupportValuesEdit` | `createInstance(Document document, Document src, TextElementDataAdapter terminalsAdapter, AddSupportValuesEdit.TargetType targetType, String idPrefix, boolean importNodeNames, boolean processRooted)` Returns a new instance of `AddSupportValuesEdit` or `null` if the given source document contains internal node names that are not decimal.
`private double` | `findHighestConflict(Node root, double highest, Node targetNode, NodeInfo info)` This method is the recursive part called by `findHighestConflict`.
`private NodeInfo` | `findSourceNodeWithAllLeafs(Node sourceRoot, LeafField targetLeafs)`
`private LeafField` | `getLeafField(Node node)`
`private int` | `getLeafIndex(TextElementData value)`
`String` | `getPresentationName()`
`private double` | `getSupportValue(Node node)`
`private static boolean` | `internalsAreDecimal(Node root, NodeBranchDataAdapter adapter)` Tests if all internal nodes in the subtree under `root` contain decimal values.
`protected void` | `performRedo()`
`private void` | `processSubtree(Node targetRoot)` Finds the support or conflict values in the source document.

Methods inherited from class info.bioinfweb.treegraph.document.undo.ComplexDocumentEdit
`findEquivilant, findEquivilant, redo, undo`

Methods inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
`addEdit, canRedo, canUndo, die, getIsSubedit, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, setIsSubedit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SUPPORT_NAME

    public static final String SUPPORT_NAME

See Also:
  Constant Field Values

### CONFLICT_NAME

    public static final String CONFLICT_NAME

See Also:
  Constant Field Values

### SUPPORT_DECIMAL_FORMAT

    public static final DecimalFormat SUPPORT_DECIMAL_FORMAT

### CONFLICT_DECIMAL_FORMAT

    public static final DecimalFormat CONFLICT_DECIMAL_FORMAT

### KEY_LEAF_REFERENCE

    public static final String KEY_LEAF_REFERENCE

### MAX_TERMINAL_ERROR_COUNT

    public static final int MAX_TERMINAL_ERROR_COUNT

See Also:
  Constant Field Values

### SOURCE_LEAFS_ADAPTER

    public static final NodeNameAdapter SOURCE_LEAFS_ADAPTER

### src

    private Document src

### targetLeafsAdapter

    private TextElementDataAdapter targetLeafsAdapter

  The column that contains the terminal identifiers in the target document (usually nodes names)

### sourceAdapter

    private NodeBranchDataAdapter sourceAdapter

  The node/branch data to be imported (node names or branch lengths)

### supportAdapter

    private TextElementDataAdapter supportAdapter

  The node/branch data column to write imported support values to

### conflictAdapter

    private TextElementDataAdapter conflictAdapter

  The node/branch data column to write imported conflict values to

### leafValues

    private Vector<TextElementData> leafValues

### processRooted

    private boolean processRooted

Constructor Detail

### AddSupportValuesEdit

    public AddSupportValuesEdit(Document document,
                                Document src,
                                TextElementDataAdapter terminalsAdapter,
                                AddSupportValuesEdit.TargetType targetType,
                                String idPrefix,
                                NodeBranchDataAdapter sourceAdapter,
                                boolean processRooted)

Method Detail

### internalsAreDecimal

    private static boolean internalsAreDecimal(Node root,
                                               NodeBranchDataAdapter adapter)

  Tests if all internal nodes in the subtree under `root` contain decimal values.

  Parameters:
    `root` - the root of the subtree to be checked
    `adapter` - the adapter to obtain the data from the nodes
  Returns:
    `true` if only decimal values are found

### createInstance

    public static AddSupportValuesEdit createInstance(Document document,
                                                      Document src,
                                                      TextElementDataAdapter terminalsAdapter,
                                                      AddSupportValuesEdit.TargetType targetType,
                                                      String idPrefix,
                                                      boolean importNodeNames,
                                                      boolean processRooted)

  Returns a new instance of `AddSupportValuesEdit` or `null` if the given source document contains internal node names that are not decimal.

  Parameters:
    `document` - the document to add the support values to
    `src` - the document to obtain the support values frim
    `terminalsAdapter` - the adapter to obtain the terminal names from the target document
    `targetType` - the type of node data to store the new support values
    `idPrefix` - the prefix of the IDs that will be given to the new support (and conflict values)
    `importNodeNames` - If `true` the internal node names are imported as support valus, otherwise the internal branch lengths are used.
    `processRooted` - defines whether the two specified trees shall be merged rooted or not (no matter if the specified documents are rooted or not)
  Returns:
    a new instance of `AddSupportValuesEdit` or `null`

### performRedo

    protected void performRedo()

  Specified by:
    `performRedo` in class `ComplexDocumentEdit`

### addLeafList

    private void addLeafList(List<TextElementData> list,
                             Node root,
                             TextElementDataAdapter adapter)

  Fills the specified list with the values of all leafs under `root`.

  Parameters:
    `list` -
    `root` -
    `adapter` -

### compareLeafs

    private String compareLeafs()

### getLeafField

    private LeafField getLeafField(Node node)

### getLeafIndex

    private int getLeafIndex(TextElementData value)

### addLeafFields

    private void addLeafFields(Node root,
                               TextElementDataAdapter adapter)

  Adds a boolean field which indicates the leafs located under `root` to the attribute map of `root`.

  Parameters:
    `root` - the root of the subtree

### findSourceNodeWithAllLeafs

    private NodeInfo findSourceNodeWithAllLeafs(Node sourceRoot,
                                                LeafField targetLeafs)

### getSupportValue

    private double getSupportValue(Node node)

### findHighestConflict

    private double findHighestConflict(Node root,
                                       double highest,
                                       Node targetNode,
                                       NodeInfo info)

  This method is the recursive part called by `findHighestConflict`. The only difference between the two is that this method can return the support value of root itsself as `findHighestConflict` does not.

  Parameters:
    `root` - the root of the subtree to be searched (a node in the source document)
    `highest` - the initial support value
    `targetNode` - the node in the target document to attach a support value to
    `info` - information about the node in the source document which contains all terminals of `targetNode` in its subtree
  Returns:
    the node with the highest support value found (in the source document)

### processSubtree

    private void processSubtree(Node targetRoot)

  Finds the support or conflict values in the source document.

  Parameters:
    `targetRoot` - the root of the subtree to add support values to (a node of the target document)

### getPresentationName

    public String getPresentationName()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD