/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @param algorithm * the difference algorithm to use * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(final Object[] orig, final Object[] rev, final DiffAlgorithm algorithm) throws DifferentiationFailedException { if ((orig == null) || (rev == null)) { throw new IllegalArgumentException(); } return new Diff(orig, algorithm).diff(rev); }
/** * Converts an array of {@link Object Object} to a string using {@link Diff#NL Diff.NL} as the * line separator. * * @param o * the array of objects. * @return String */ public static String arrayToString(Object[] o) { return arrayToString(o, Diff.NL); }
/** * Performs random edits on the input sequence. Useful for testing. * * @param text * The input sequence. * @return The sequence with random edits performed. */ public static Object[] randomEdit(final Object[] text) { return randomEdit(text, text.length); }
/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException { if (orig == null || rev == null) { throw new IllegalArgumentException(); } return diff(orig, rev, null); }
/** * Shuffles around the items in the input sequence. * * @param text * the input sequence. * @return The shuffled sequence. */ public static Object[] shuffle(Object[] text) { return shuffle(text, text.length); }
/** * Generate a random sequence of the given size. * * @param size * the size of the sequence to generate. * @return The generated sequence. */ public static Object[] randomSequence(final int size) { return randomSequence(size, size); }
/** * Create a differencing object using the given algorithm * * @param original * the original text that will be compared * @param algorithm * the difference algorithm to use. */ public Diff(Object[] original, DiffAlgorithm algorithm) { if (original == null) { throw new IllegalArgumentException(); } orig = original; if (algorithm != null) { this.algorithm = algorithm; } else { this.algorithm = defaultAlgorithm(); } }
/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException { if (orig == null || rev == null) { throw new IllegalArgumentException(); } return diff(orig, rev, null); }
/** * Shuffles around the items in the input sequence. * * @param text * the input sequence. * @return The shuffled sequence. */ public static Object[] shuffle(final Object[] text) { return shuffle(text, text.length); }
/** * Generate a random sequence of the given size. * * @param size * the size of the sequence to generate. * @return The generated sequence. */ public static Object[] randomSequence(int size) { return randomSequence(size, size); }
/** * Create a differencing object using the given algorithm * * @param original * the original text that will be compared * @param algorithm * the difference algorithm to use. */ public Diff(final Object[] original, final DiffAlgorithm algorithm) { if (original == null) { throw new IllegalArgumentException(); } orig = original; if (algorithm != null) { this.algorithm = algorithm; } else { this.algorithm = defaultAlgorithm(); } }
/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @param algorithm * the difference algorithm to use * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(Object[] orig, Object[] rev, DiffAlgorithm algorithm) throws DifferentiationFailedException { if (orig == null || rev == null) { throw new IllegalArgumentException(); } return new Diff(orig, algorithm).diff(rev); }
/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(final Object[] orig, final Object[] rev) throws DifferentiationFailedException { if ((orig == null) || (rev == null)) { throw new IllegalArgumentException(); } return diff(orig, rev, null); }
/** * Performs random edits on the input sequence. Useful for testing. * * @param text * The input sequence. * @return The sequence with random edits performed. */ public static Object[] randomEdit(Object[] text) { return randomEdit(text, text.length); }
/** * Converts an array of {@link Object Object} to a string using {@link Diff#NL Diff.NL} as the * line separator. * * @param o * the array of objects. * @return String */ public static String arrayToString(final Object[] o) { return arrayToString(o, Diff.NL); }
/** * Shuffles around the items in the input sequence. * * @param text * the input sequence. * @return The shuffled sequence. */ public static Object[] shuffle(Object[] text) { return shuffle(text, text.length); }
/** * Generate a random sequence of the given size. * * @param size * the size of the sequence to generate. * @return The generated sequence. */ public static Object[] randomSequence(int size) { return randomSequence(size, size); }
/** * Create a differencing object using the given algorithm * * @param original * the original text that will be compared * @param algorithm * the difference algorithm to use. */ public Diff(Object[] original, DiffAlgorithm algorithm) { if (original == null) { throw new IllegalArgumentException(); } orig = original; if (algorithm != null) { this.algorithm = algorithm; } else { this.algorithm = defaultAlgorithm(); } }
/** * compute the difference between an original and a revision. * * @param orig * the original * @param rev * the revision to compare with the original. * @param algorithm * the difference algorithm to use * @return a Revision describing the differences * @throws DifferentiationFailedException */ public static Revision diff(Object[] orig, Object[] rev, DiffAlgorithm algorithm) throws DifferentiationFailedException { if (orig == null || rev == null) { throw new IllegalArgumentException(); } return new Diff(orig, algorithm).diff(rev); }
public boolean checkLicenseHeader(File file) { Revision revision = null; try { String header = extractLicenseHeader(file, 0, 16); revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING)); } catch (Exception e) { Assert.fail(e.getMessage()); } return revision.size() == 0; }