Example usage for org.apache.commons.jrcs.diff.myers MyersDiff diff

List of usage examples for org.apache.commons.jrcs.diff.myers MyersDiff diff

Introduction

In this page you can find the example usage for org.apache.commons.jrcs.diff.myers MyersDiff diff.

Prototype

public Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException 

Source Link

Usage

From source file:uk.ac.cam.caret.sakai.rwiki.tool.bean.GenericDiffBean.java

/**
 * initialise the bean. To be called after the leftContent and rightContent
 * have been set./* w  w  w.j a v a  2s.  c o  m*/
 */
public void init() {
    MyersDiff diffAlgorithm = new MyersDiff();

    try {
        objectifiedLeft = leftContent.split("\n");

        objectifiedRight = rightContent.split("\n");

        difference = diffAlgorithm.diff(objectifiedLeft, objectifiedRight);

    } catch (DifferentiationFailedException e) {
        // Quite why JRCS has this I don't know!
        throw new RuntimeException("DifferentiationFailedException occured: " + "This should never happen!", e);
    }

}