Class AbstractListMergeModel<T extends PrimitiveId,​C extends ConflictResolveCommand>

    • Method Detail

      • cloneEntryForMergedList

        protected abstract T cloneEntryForMergedList​(T entry)
        Creates a clone of an entry of type T suitable to be included in the list of merged entries
        Parameters:
        entry - the entry
        Returns:
        the cloned entry
      • isEqualEntry

        public abstract boolean isEqualEntry​(T e1,
                                             T e2)
        checks whether two entries are equal. This is not necessarily the same as e1.equals(e2).
        Parameters:
        e1 - the first entry
        e2 - the second entry
        Returns:
        true, if the entries are equal, false otherwise.
      • setValueAt

        protected abstract void setValueAt​(javax.swing.table.DefaultTableModel model,
                                           java.lang.Object value,
                                           int row,
                                           int col)
        Handles method dispatches from TableModel.setValueAt(Object, int, int).
        Parameters:
        model - the table model
        value - the value to be set
        row - the row index
        col - the column index
        See Also:
        TableModel.setValueAt(Object, int, int)
      • getMyPrimitive

        public OsmPrimitive getMyPrimitive​(T entry)
        Replies primitive from my dataset referenced by entry
        Parameters:
        entry - entry
        Returns:
        Primitive from my dataset referenced by entry
      • fireFrozenChanged

        protected void fireFrozenChanged​(boolean oldValue,
                                         boolean newValue)
      • setFrozen

        public final void setFrozen​(boolean isFrozen)
        Sets the frozen status for this model.
        Parameters:
        isFrozen - true if it should be frozen.
      • isFrozen

        public final boolean isFrozen()
        Check if the model is frozen.
        Returns:
        The current frozen state.
      • copyMyToTop

        public void copyMyToTop​(int... rows)
        Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. Inserts the nodes at the top of the list of merged nodes.
        Parameters:
        rows - the indices
      • copyTheirToTop

        public void copyTheirToTop​(int... rows)
        Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. Inserts the nodes at the top of the list of merged nodes.
        Parameters:
        rows - the indices
      • copyToEnd

        public void copyToEnd​(ListRole source,
                              int... rows)
        Copies the nodes given by indices in rows from the list of nodes in source to the list of merged nodes. Inserts the nodes at the end of the list of merged nodes.
        Parameters:
        source - the list of nodes to copy from
        rows - the indices
      • copyMyToEnd

        public void copyMyToEnd​(int... rows)
        Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. Inserts the nodes at the end of the list of merged nodes.
        Parameters:
        rows - the indices
      • copyTheirToEnd

        public void copyTheirToEnd​(int... rows)
        Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. Inserts the nodes at the end of the list of merged nodes.
        Parameters:
        rows - the indices
      • clearMerged

        public void clearMerged()
        Clear the merged list.
      • copy

        private void copy​(ListRole sourceRole,
                          int[] rows,
                          int position)
      • copyAll

        public void copyAll​(ListRole source)
        Copies over all values from the given side to the merged table..
        Parameters:
        source - The source side to copy from.
      • copyBeforeCurrent

        protected void copyBeforeCurrent​(ListRole source,
                                         int[] rows,
                                         int current)
        Copies the nodes given by indices in rows from the list of nodes source to the list of merged nodes. Inserts the nodes before row given by current.
        Parameters:
        source - the list of nodes to copy from
        rows - the indices
        current - the row index before which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • copyMyBeforeCurrent

        public void copyMyBeforeCurrent​(int[] rows,
                                        int current)
        Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. Inserts the nodes before row given by current.
        Parameters:
        rows - the indices
        current - the row index before which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • copyTheirBeforeCurrent

        public void copyTheirBeforeCurrent​(int[] rows,
                                           int current)
        Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. Inserts the nodes before row given by current.
        Parameters:
        rows - the indices
        current - the row index before which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • copyAfterCurrent

        protected void copyAfterCurrent​(ListRole source,
                                        int[] rows,
                                        int current)
        Copies the nodes given by indices in rows from the list of nodes source to the list of merged nodes. Inserts the nodes after the row given by current.
        Parameters:
        source - the list of nodes to copy from
        rows - the indices
        current - the row index after which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • copyMyAfterCurrent

        public void copyMyAfterCurrent​(int[] rows,
                                       int current)
        Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. Inserts the nodes after the row given by current.
        Parameters:
        rows - the indices
        current - the row index after which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • copyTheirAfterCurrent

        public void copyTheirAfterCurrent​(int[] rows,
                                          int current)
        Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. Inserts the nodes after the row given by current.
        Parameters:
        rows - the indices
        current - the row index after which the nodes are inserted
        Throws:
        java.lang.IllegalArgumentException - if current < 0 or >= #nodes in list of merged nodes
      • moveUpMerged

        public void moveUpMerged​(int... rows)
        Moves the nodes given by indices in rows up by one position in the list of merged nodes.
        Parameters:
        rows - the indices
      • moveDownMerged

        public void moveDownMerged​(int... rows)
        Moves the nodes given by indices in rows down by one position in the list of merged nodes.
        Parameters:
        rows - the indices
      • removeMerged

        public void removeMerged​(int... rows)
        Removes the nodes given by indices in rows from the list of merged nodes.
        Parameters:
        rows - the indices
      • myAndTheirEntriesEqual

        protected boolean myAndTheirEntriesEqual()
        Replies true if the list of my entries and the list of their entries are equal
        Returns:
        true, if the lists are equal; false otherwise
      • buildResolveCommand

        public abstract C buildResolveCommand​(Conflict<? extends OsmPrimitive> conflict)
        Builds the command to resolve conflicts in the list.
        Parameters:
        conflict - the conflict data set
        Returns:
        the command
        Throws:
        java.lang.IllegalStateException - if the merge is not yet frozen