org.spockframework.runtime.condition
Class EditDistance

java.lang.Object
  extended by org.spockframework.runtime.condition.EditDistance

public class EditDistance
extends java.lang.Object

Calculates Levenshtein distance and corresponding edit path between two character sequences. Inspired from: http://etorreborre.blogspot.com/2008/06/edit-distance-in-scala_245.html Ideas for improvements: - Favor fewer EditOperationS when calculating distance and/or path - Use algorithm with lower time and/or space complexity

Author:
Peter Niederwieser

Constructor Summary
EditDistance(java.lang.CharSequence seq1, java.lang.CharSequence seq2)
           
 
Method Summary
 java.util.List<EditOperation> calculatePath()
           
 int getDistance()
           
 int[][] getMatrix()
           
 int getSimilarityInPercent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditDistance

public EditDistance(java.lang.CharSequence seq1,
                    java.lang.CharSequence seq2)
Method Detail

getMatrix

public int[][] getMatrix()

getDistance

public int getDistance()

getSimilarityInPercent

public int getSimilarityInPercent()

calculatePath

public java.util.List<EditOperation> calculatePath()


Copyright © 2013. All rights reserved