org.apache.commons.jrcs.diff

Class SimpleDiff

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      (package private) static int EOS 
      (package private) static int NOT_FOUND_i 
      (package private) static int NOT_FOUND_j 
    • Constructor Summary

      Constructors 
      Constructor and Description
      SimpleDiff() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected java.util.Map buildEqSet(java.lang.Object[] orig, java.lang.Object[] rev)
      create a Map from each common item in orig and rev to the index of its first occurrence in orig
      protected int[] buildIndex(java.util.Map eqs, java.lang.Object[] seq, int NF)
      build a an array such each a[i] = eqs([i]) or NF if eqs([i]) undefined
      Revision diff(java.lang.Object[] orig, java.lang.Object[] rev)
      Compute the difference between original and revised sequences.
      protected int scan(int[] ndx, int i, int target) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleDiff

        public SimpleDiff()
    • Method Detail

      • scan

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

        public Revision diff(java.lang.Object[] orig,
                    java.lang.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 java.util.Map buildEqSet(java.lang.Object[] orig,
                               java.lang.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(java.util.Map eqs,
                       java.lang.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 2002 the Apache Software Foundation
Copyright ? 1999-2001 Juancarlo A?ez, Caracas, Venezuela.
All rights reserved
. http://www.suigeneris.org/jrcs