Java String Suffix suffixes(char[] x, int[] suff)

Here you can find the source of suffixes(char[] x, int[] suff)

Description

suffixes

License

Open Source License

Declaration

private static void suffixes(char[] x, int[] suff) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private int m;

    private static void suffixes(char[] x, int[] suff) {
        int f = 0, g, i, m = x.length;

        suff[m - 1] = m;/*w ww.j a v a 2s .c o m*/
        g = m - 1;
        for (i = m - 2; i >= 0; --i) {
            if (i > g && suff[i + m - 1 - f] < i - g)
                suff[i] = suff[i + m - 1 - f];
            else {
                if (i < g)
                    g = i;
                f = i;
                while (g >= 0 && x[g] == x[g + m - 1 - f])
                    --g;
                suff[i] = f - g;
            }
        }
    }
}

Related

  1. suffix(String str, String suf)
  2. suffix(String string, final String suffix)
  3. suffix(String value, String prefix)
  4. suffix(String[] columns, String suffix)
  5. suffixClassName(String tableName)
  6. suffixLabel(String label, String tagSuffix)
  7. suffixName(String name)
  8. suffixNotNullStringOrDefault(String str, String defaultStr, String suffix)
  9. suffixWith(String receiver, char suffix, boolean ignoreCase)