Skip navigation links
org.apache.commons.jrcs.diff

Class SimpleDiff

    • Constructor Detail

      • SimpleDiff

        public SimpleDiff()
    • Method Detail

      • scan

        protected int scan(int[] ndx,
                           int i,
                           int target)
      • diff

        public Revision diff(Object[] orig,
                             Object[] rev)
                      throws DifferentiationFailedException
        Compute the difference between original and revised sequences.
        Specified by:
        diff in interface DiffAlgorithm
        Parameters:
        orig - The original sequence.
        rev - The revised sequence to be compared with the original.
        Returns:
        A Revision object describing the differences.
        Throws:
        DifferenciationFailedException - if the diff could not be computed.
        DifferentiationFailedException - if the diff could not be computed.
      • buildEqSet

        protected Map buildEqSet(Object[] orig,
                                 Object[] rev)
        create a Map from each common item in orig and rev to the index of its first occurrence in orig
        Parameters:
        orig - the original sequence of items
        rev - the revised sequence of items
      • buildIndex

        protected int[] buildIndex(Map eqs,
                                   Object[] seq,
                                   int NF)
        build a an array such each a[i] = eqs([i]) or NF if eqs([i]) undefined
        Parameters:
        eqs - a mapping from Object to Integer
        seq - a sequence of objects
        NF - the not found marker

Copyright © 2003–2019 The Sakai Foundation. All rights reserved.