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.edit
Class AddSupportValuesEdit

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

All Implemented Interfaces:
  javax.swing.undo.UndoableEdit

    public class AddSupportValuesEdit

extends ComplexDocumentEdit

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

Field Summary
`static java.text.DecimalFormat` | `CONFLICT_DECIMAL_FORMAT`
`static java.lang.String` | `CONFLICT_NAME`
`private NodeDataAdapter` | `conflictAdapter`
`static java.lang.String` | `KEY_LEAF_REFERENCE`
`static int` | `MAX_TERMINAL_ERROR_COUNT`
`private static NodeDataAdapter` | `SOURCE_ADAPTER`
`private Document` | `src`
`static java.text.DecimalFormat` | `SUPPORT_DECIMAL_FORMAT`
`static java.lang.String` | `SUPPORT_NAME`
`private NodeDataAdapter` | `supportAdapter`
`private NodeDataAdapter` | `terminalsAdapter`

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

Constructor Summary
`private` | `AddSupportValuesEdit(Document document, Document src, NodeDataAdapter terminalsAdapter, AddSupportValuesEdit.TargetType targetType, java.lang.String idPrefix)`

Method Summary
`private void` | `addLeafReferences(Node root)` Adds direkt references to all leaves of the subtree under `root` to the attribute map of `root`.
`static AddSupportValuesEdit` | `createInstance(Document document, Document src, NodeDataAdapter terminalsAdapter, AddSupportValuesEdit.TargetType targetType, java.lang.String idPrefix)` Returns a new instance of `AddSupportValuesEdit` or `null` if the given source document contains internal node names that are not decimal.
`private Node` | `findDeepestNodeWithLeafs(AddSupportValuesEdit.LeafList leafs)` Finds the deepest node in the source document which has a subtree that contains all the specified leafs.
`private double` | `findHighestConflict(Node root, AddSupportValuesEdit.LeafList leafs)` Finds the highest conflicting support value in the subtree under `root`.
`private double` | `findHighestConflictRek(Node root, double highest, AddSupportValuesEdit.LeafList leafs)` This method is the recursive part called by `findHighestConflict`.
`private Node` | `findSubnodeWithLeafs(AddSupportValuesEdit.LeafList leafs, Node parent)` Finds the direct subnode under `root` that contains all the specified leafs.
`private AddSupportValuesEdit.LeafList` | `getLeafList(Node node)` Returns the leaf list of `node` that is stored in its attribute map.
`java.lang.String` | `getPresentationName()`
`private double` | `getSupportValue(Node node)`
`private static boolean` | `internalsAreDecimal(Node root, NodeDataAdapter adapter)` Tests if all internal nodes in the subtree under `root` contain decimal values.
`protected void` | `performRedo()`
`private void` | `processSubtree(Node root)` 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, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit`

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 java.lang.String SUPPORT_NAME

See Also:
  Constant Field Values

### CONFLICT_NAME

    public static final java.lang.String CONFLICT_NAME

See Also:
  Constant Field Values

### SUPPORT_DECIMAL_FORMAT

    public static final java.text.DecimalFormat SUPPORT_DECIMAL_FORMAT

### CONFLICT_DECIMAL_FORMAT

    public static final java.text.DecimalFormat CONFLICT_DECIMAL_FORMAT

### KEY_LEAF_REFERENCE

    public static final java.lang.String KEY_LEAF_REFERENCE

### MAX_TERMINAL_ERROR_COUNT

    public static final int MAX_TERMINAL_ERROR_COUNT

See Also:
  Constant Field Values

### SOURCE_ADAPTER

    private static final NodeDataAdapter SOURCE_ADAPTER

### src

    private Document src

### terminalsAdapter

    private NodeDataAdapter terminalsAdapter

### supportAdapter

    private NodeDataAdapter supportAdapter

### conflictAdapter

    private NodeDataAdapter conflictAdapter

Constructor Detail

### AddSupportValuesEdit

    private AddSupportValuesEdit(Document document,
                                 Document src,
                                 NodeDataAdapter terminalsAdapter,
                                 AddSupportValuesEdit.TargetType targetType,
                                 java.lang.String idPrefix)

Method Detail

### createInstance

    public static AddSupportValuesEdit createInstance(Document document,
                                                      Document src,
                                                      NodeDataAdapter terminalsAdapter,
                                                      AddSupportValuesEdit.TargetType targetType,
                                                      java.lang.String idPrefix)

  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)
  Returns:
    a new instance of `AddSupportValuesEdit` or `null`

### internalsAreDecimal

    private static boolean internalsAreDecimal(Node root,
                                               NodeDataAdapter 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

### getLeafList

    private AddSupportValuesEdit.LeafList getLeafList(Node node)

  Returns the leaf list of `node` that is stored in its attribute map.

  Parameters:
    `node` - - the node of the returned leaf list
  Returns:
    the leaf list instance or `null` if the node contains no leaf list

### addLeafReferences

    private void addLeafReferences(Node root)

  Adds direkt references to all leaves of the subtree under `root` to the attribute map of `root`.

  Parameters:
    `root` - - the root of the subtree

### findSubnodeWithLeafs

    private Node findSubnodeWithLeafs(AddSupportValuesEdit.LeafList leafs,
                                      Node parent)

  Finds the direct subnode under `root` that contains all the specified leafs.

  Note that this method should only be used with nodes of the source document because of the correct use of the `NodeDataAdapter`s.

  Parameters:
    `leafs` - - the leaf list of a node from the target document
    `parent` - - the direct parent node of the nodes to be searched (a node of the source document)
  Returns:
    the according subnode or `null` if none is found

### findDeepestNodeWithLeafs

    private Node findDeepestNodeWithLeafs(AddSupportValuesEdit.LeafList leafs)

  Finds the deepest node in the source document which has a subtree that contains all the specified leafs.

  Parameters:
    `leafs` - - the leaf list of a node from the target document
  Returns:
    the deepest node in the source document

### getSupportValue

    private double getSupportValue(Node node)

### findHighestConflict

    private double findHighestConflict(Node root,
                                       AddSupportValuesEdit.LeafList leafs)

  Finds the highest conflicting support value in the subtree under `root`. (Root itsself is not included.) Conflicting nodes have to contain at least one leaf node of the leafs the original node had and at least one leaf node the original node did not have.

  Parameters:
    `root` - - the root of the subtree to be searched (a node in the source document)
    `highest` - - the initial support value
    `leafs` - - the leaf list of the node of the target document
  Returns:
    the node with the highest support value found (in the source document)

### findHighestConflictRek

    private double findHighestConflictRek(Node root,
                                          double highest,
                                          AddSupportValuesEdit.LeafList leafs)

  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
    `leafs` - - the leaf list of the node of the target document
  Returns:
    the node with the highest support value found (in the source document)

### processSubtree

    private void processSubtree(Node root)

  Finds the support or conflict values in the source document.

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

### performRedo

    protected void performRedo()

  Specified by:
    `performRedo` in class `ComplexDocumentEdit`

### getPresentationName

    public java.lang.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