public static long generationFromSegmentsFileName(String fileName) {if (fileName.equals(OLD_SEGMENTS_GEN)) {throw new IllegalArgumentException("\"" + OLD_SEGMENTS_GEN + "\" is not a valid segment file name since 4.0");} else if (fileName.equals(IndexFileNames.SEGMENTS)) {return 0;} else if (fileName.startsWith(IndexFileNames.SEGMENTS)) {return Long.parseLong(fileName.substring(1+IndexFileNames.SEGMENTS.length()),Character.MAX_RADIX);} else {throw new IllegalArgumentException("fileName \"" + fileName + "\" is not a segments file");}}

public static long GenerationFromSegmentsFileName(string fileName){if (fileName.Equals(IndexFileNames.SEGMENTS, StringComparison.Ordinal)){return 0;}else if (fileName.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal)){return Number.Parse(fileName.Substring(1 + IndexFileNames.SEGMENTS.Length), Character.MaxRadix);}else{throw new System.ArgumentException("fileName \"" + fileName + "\" is not a segments file");}}
